Skip to content

[Bug]: Forge dispatch sends --model/--output-format — neither exists in the Forge CLI #4666

Description

@hmohammadi

Bug Description

ForgeIntegration never overrides build_exec_args(), so it inherits the generic implementation from MarkdownIntegration (src/specify_cli/integrations/base.py), which emits:

<exe> -p <prompt> --model <model> --output-format json

Forge accepts -p/--prompt, but --model and --output-format do not exist in the Forge CLI. Every workflow command:/prompt: step dispatching to Forge fails immediately at argument parsing with exit code 2, even with forge installed and authenticated.

This is the forge row of the audit in #2416.

Unlike the Amp case (#4581), both inherited extra flags are invalid, so both dispatch paths break:

  • stream=False (output_json=True) always appends --output-format json → exit 2.
  • stream=True (the default) drops --output-format but still appends --model <model> whenever a model is configured → exit 2.

The only surviving combination is stream=True with no model configured, which reduces to forge -p <prompt> — the one form that actually works.

Steps to Reproduce

  1. Generate the argv Spec Kit dispatches with, from a source checkout at main (b9e7389):
$ uv run python -c "from specify_cli.integrations import get_integration; print(get_integration('forge').build_exec_args('hello', model='gpt-4o', output_json=True))"
['forge', '-p', 'hello', '--model', 'gpt-4o', '--output-format', 'json']
  1. Run exactly that against the real Forge CLI:
$ npx -y @antinomyhq/forge@latest -p "hello" --model gpt-4o --output-format json
error: unexpected argument '--model' found

Usage: forge.exe --prompt <PROMPT>
$ echo $?
2
  1. Each invalid flag fails independently:
$ forge -p "hello" --model gpt-4o
error: unexpected argument '--model' found          (exit 2)

$ forge -p "hello" --output-format json
error: unexpected argument '--output-format' found  (exit 2)
  1. Confirm the flags Forge actually accepts:
$ forge --help
Options:
  -p, --prompt <PROMPT>
      --conversation <CONVERSATION>
      --conversation-id <CONVERSATION_ID>
  -C, --directory <DIRECTORY>
      --sandbox <SANDBOX>
      --verbose
      --agent <AGENT>
  -e, --event <EVENT>
  -h, --help
  -V, --version

Expected Behavior

Spec Kit dispatches to Forge using flags Forge actually accepts, so the command runs:

forge -p <prompt>

Actual Behavior

The dispatch fails at argument parsing with error: unexpected argument '--model' found (exit 2). The agent is never invoked.

Checked against forge --help (v2.13.21):

Flag Spec Kit sends Present in Forge CLI? Notes
-p <prompt> Yes correct as-is; also accepts the /speckit-… slash invocations
--model <model> No Forge has no model flag — model is set out of band via forge config set model <provider> <model>
--output-format json No no top-level equivalent; --porcelain exists only on certain subcommands

Specify CLI Version

1.0.10.dev0 (source checkout, git b9e7389)

AI Agent

Forge

Operating System

Windows 11

Python Version

3.14.7

Error Logs

$ npx -y @antinomyhq/forge@latest -p "hello" --model gpt-4o --output-format json
error: unexpected argument '--model' found

Usage: forge.exe --prompt <PROMPT>

For more information, try '--help'.

For contrast, the proposed argv parses and proceeds:

$ npx -y @antinomyhq/forge@latest -p "/speckit-plan add OAuth" --stop-here-bogus
error: unexpected argument '--stop-here-bogus' found

Only the deliberately-bogus probe flag is rejected — -p "/speckit-plan add OAuth" itself is accepted, confirming the slash-command prompt shape parses.

Additional Context

Forge CLI version tested: 2.13.21, installed via npx -y @antinomyhq/forge@latest.

Upstream source of truth: the clap Cli struct in crates/forge_main/src/cli.rs declares prompt (short p), conversation, conversation_id, directory, sandbox, verbose, agent and event. There is no model field and no output_format field, at main or at the released v2.13.21 tag.

On model: Forge exposes no model-selection flag. Model choice is a persisted setting (forge config set model, or interactive forge select model). --agent <AGENT> selects an agent ID, not a model, so forwarding Spec Kit's model value onto it would silently select the wrong thing. A fix should drop the model flag rather than remap it.

On flag order: Forge's global flags parse before -p (forge --verbose -p "x" --bogus rejects only --bogus), so SPECKIT_INTEGRATION_FORGE_EXTRA_ARGS can be applied before -p as with opencode / goose / codex / cursor-agent.

Same fix shape as the existing one-off overrides for Amp (#4581), opencode (#2409) and goose (#3781). Happy to open a PR.

AI Assistance Disclosure: AI assistance (Claude Code, model Claude Opus 5, interactive CLI session) was used for the source inspection, reproduction and drafting of this report. All CLI output above was executed and captured on the reporting machine against the real Forge binary.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage-nice-to-haveVerdict: evidence-backed fix or greenlit feature — land after review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions