Skip to content

fix(agy): support --model, --add-dir workspace, and pre-prompt extra args - #4481

Open
timoyan wants to merge 1 commit into
github:mainfrom
timoyan:fix/agy-model-and-workspace-support
Open

fix(agy): support --model, --add-dir workspace, and pre-prompt extra args#4481
timoyan wants to merge 1 commit into
github:mainfrom
timoyan:fix/agy-model-and-workspace-support

Conversation

@timoyan

@timoyan timoyan commented Sep 8, 2026

Copy link
Copy Markdown

Summary

Fixes three bugs in AgyIntegration that together prevented specify workflow run from working correctly with agy. Closes #4480.

Bugs Fixed

1. --model was silently ignored

build_exec_args() had a comment # agy does not support --model ... both params are ignored and hardcoded no --model flag. agy >=1.20 fully supports agy --model <name> --print <prompt>. Workflow YAML model: pins had no effect.

Fix: Pass --model <model> before --print when model is set.

2. EXTRA_ARGS were appended after --print (silently absorbed as prompt text)

agy treats every token after --print as part of the prompt string, not as CLI flags. Operator flags like --dangerously-skip-permissions or --print-timeout 30m set via SPECKIT_INTEGRATION_AGY_EXTRA_ARGS were appended after --print and silently became part of the prompt.

Fix: _apply_extra_args_env_var() is now called before args.extend(['--print', prompt]).

3. No workspace passed to agy -- 'no active workspace'

The base dispatch_command() sets cwd=project_root for the subprocess, but agy does not read cwd as its workspace root -- it requires an explicit --add-dir <path> flag. Without it, agy falls back to its own scratch directory, cannot locate .agents/skills/, and reports 'no active workspace' -- making all installed Spec Kit skills invisible.

Fix: build_exec_args() now accepts project_root: Path | None and injects --add-dir <project_root> before --print when project_root is given. dispatch_command() is overridden in AgyIntegration to thread project_root through to build_exec_args().

Flag Order Guarantee

All flags appear before --print so agy parses them correctly:

agy [--model <m>] [--add-dir <d>] [<EXTRA_ARGS>] --print <prompt>

Tests

  • Updated ignores_model -> honors_model (asserts --model is now included)
  • Updated extra_args_honors -> extra_args_before_print (asserts extra args come BEFORE --print)
  • Added: test_build_exec_args_add_dir_for_workspace
  • Added: test_build_exec_args_no_add_dir_when_project_root_is_none
  • Added: test_build_exec_args_no_model_flag_when_model_is_none
  • Added: test_build_exec_args_combined_flag_order

All 47 tests pass.

AI Assistance Disclosure

This PR was drafted with substantial AI assistance (Google Antigravity / agy). The bugs were discovered while personally running specify workflow run against a real project and observing the failures firsthand. The root cause analysis, fix design, and test verification were reviewed and validated by me. AI was used to write the code, tests, commit message, and PR body.

…args

Three bugs fixed in AgyIntegration:

1. --model was silently ignored
   agy >=1.20 supports `agy --model <name> --print <prompt>`.
   build_exec_args() now passes --model before --print when model is set.

2. EXTRA_ARGS were appended after --print (swallowed as prompt text)
   agy treats every token after --print as part of the prompt string,
   not as CLI flags. Operator flags from SPECKIT_INTEGRATION_AGY_EXTRA_ARGS
   (e.g. --dangerously-skip-permissions, --print-timeout) were silently
   absorbed into the prompt and had no effect.
   Fixed: extra args are now inserted before --print.

3. Workspace was not passed to agy (no active workspace error)
   The workflow engine sets cwd=project_root for the subprocess but agy
   does not read cwd as its workspace root. Without --add-dir, agy falls
   back to its own scratch directory, cannot locate .agents/skills/, and
   reports no active workspace -- making all installed Spec Kit skills
   invisible.
   Fixed: build_exec_args() now accepts project_root and injects
   --add-dir <project_root> before --print when project_root is given.
   dispatch_command() is overridden in AgyIntegration to thread
   project_root through to build_exec_args().

Flag order guarantee: agy --model <m> --add-dir <d> <EXTRA_ARGS> --print <prompt>

Fixes github#4480
@timoyan
timoyan requested a review from mnriem as a code owner September 8, 2026 21:31
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.

bug(agy): --model ignored, EXTRA_ARGS appended after --print, and --add-dir workspace not passed

1 participant