Skip to content

fix: forward leading harness flags when run is the default command - #242

Draft
ncrmro with Copilot wants to merge 2 commits into
mainfrom
copilot/forward-pi-flags-default-command
Draft

fix: forward leading harness flags when run is the default command#242
ncrmro with Copilot wants to merge 2 commits into
mainfrom
copilot/forward-pi-flags-default-command

Conversation

Copilot AI commented Jul 31, 2026

Copy link
Copy Markdown

When run acts as the default command, Commander's positional parsing consumes leading flags like -r and --resume as the optional [agent] argument, producing a misleading "Unknown agent" error instead of forwarding them to Pi.

$ outfitter -r
Unknown agent '-r'. Run 'outfitter list agents' to see resolvable agents.

Changes

  • RunAgentCommand.ts — Detect option-shaped agent values (starting with -) in the action handler and reclassify them as pass-through arguments, letting default_agent resolve normally while the flag reaches the harness CLI.
  • run-agent.test.ts — Four new tests: -r forwarding, --resume forwarding, explicit agent selection preserved, --harness/--strict preserved alongside forwarding.
  • cli.md — Document the default-command pass-through syntax with examples.

Approach

The fix is intentionally narrow — a guard in the action callback rather than restructuring Commander's argument definition. This avoids changing the [agent] positional contract while correctly handling the ambiguity that only arises through default-command dispatch:

if (agent !== undefined && agent.startsWith('-')) {
  effectiveAgent = undefined;
  effectivePassThrough = [agent, ...passThroughArgs];
}

Copilot AI linked an issue Jul 31, 2026 that may be closed by this pull request
4 tasks
When `run` is used as the default command, Commander consumes leading
flags like `-r` and `--resume` as the optional `[agent]` positional
argument. Detect option-shaped agent values (starting with `-`) and
reclassify them as pass-through arguments so they reach the harness CLI.

Closes #239
Copilot AI changed the title [WIP] Forward Pi flags when run is the default command fix: forward leading harness flags when run is the default command Jul 31, 2026
Copilot AI requested a review from ncrmro July 31, 2026 17:41
@ncrmro

ncrmro commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

@copilot please rebase this and fix any merge conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Forward Pi flags when run is the default command

2 participants