Skip to content

fix(integrations): drop invalid --model/--output-format flags from Forge dispatch - #4667

Open
chelsealong wants to merge 1 commit into
github:mainfrom
chelsealong:fix/forge-build-exec-args-4666
Open

chelsealong wants to merge 1 commit into
github:mainfrom
chelsealong:fix/forge-build-exec-args-4666

Conversation

@chelsealong

Copy link
Copy Markdown
Contributor

Summary

ForgeIntegration never overrode build_exec_args(), so it inherited the generic MarkdownIntegration implementation, which appends --model <model> and --output-format json. Neither flag exists in the Forge CLI (forge only accepts -p/--prompt, --conversation, --directory, --sandbox, --verbose, --agent, --event), so every workflow command:/prompt: step dispatched to Forge failed immediately at argument parsing with exit code 2.

Fixes #4666.

This overrides build_exec_args() in ForgeIntegration (src/specify_cli/integrations/forge/__init__.py) to emit forge -p <prompt> only, applying the SPECKIT_INTEGRATION_FORGE_EXTRA_ARGS operator override before -p (Forge's global flags parse before the prompt flag, matching the existing opencode/goose/codex/cursor-agent ordering). model is intentionally dropped rather than remapped onto --agent, since --agent selects an agent ID, not a model — model selection in Forge is a persisted setting (forge config set model). Same fix shape as the existing overrides for Amp (#4581), opencode (#2409) and goose (#3781).

Test plan

Added TestForgeExecArgs to tests/integrations/test_integration_forge.py covering:

  • only -p <prompt> is emitted (no --model/--output-format)
  • output_json=True does not append --output-format
  • model=... does not append --model or --agent
  • SPECKIT_INTEGRATION_FORGE_EXTRA_ARGS is applied before -p

Verified the new tests fail without the fix (via git checkout HEAD -- src/specify_cli/integrations/forge/__init__.py to restore the inherited MarkdownIntegration.build_exec_args, confirming exit code 2 shape):

$ uv run pytest tests/integrations/test_integration_forge.py -k TestForgeExecArgs -q
...
FAILED ...test_build_exec_args_omits_output_format_flag
FAILED ...test_build_exec_args_omits_model_flag
FAILED ...test_build_exec_args_applies_extra_args_before_prompt
3 failed, 1 passed, 26 deselected in 0.11s

With the fix restored:

$ uv run pytest tests/integrations/test_integration_forge.py -q
============================== 30 passed in 0.63s ==============================

$ uv run pytest -q
========== 8364 passed, 12 skipped, 53 warnings in 404.47s (0:06:44) ===========

$ uvx ruff@0.15.0 check src/specify_cli/integrations/forge/__init__.py tests/integrations/test_integration_forge.py
All checks passed!
  • Added/updated tests, confirmed to fail without the fix
  • Full test suite passes
  • ruff check passes

AI disclosure

This change was authored by an AI coding agent (Claude Code).

🤖 Generated with Claude Code

…rge dispatch

ForgeIntegration never overrode build_exec_args(), so it inherited
MarkdownIntegration's default, which appends --model and --output-format.
Neither flag exists in the Forge CLI, so every workflow command/prompt
step dispatched to Forge failed immediately with exit code 2. Forge
only accepts -p/--prompt; model is set out of band via
`forge config set model`, so it is dropped rather than remapped.

Fixes github#4666
@chelsealong
chelsealong requested a review from mnriem as a code owner September 22, 2026 09:15
@mnriem mnriem added the triage-out-of-scope Verdict: won't land in core — invalid, duplicate, off-mission, or redirected to an extension label Sep 22, 2026

This branch has not been deployed

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

Labels

triage-out-of-scope Verdict: won't land in core — invalid, duplicate, off-mission, or redirected to an extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants