fix(agy): support --model, --add-dir workspace, and pre-prompt extra args - #4481
fix(agy): support --model, --add-dir workspace, and pre-prompt extra args#4481timoyan wants to merge 3 commits into
Conversation
…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
|
Thanks — and this is a model report→fix loop (#4480 + this), with genuinely exemplary disclosure and the bugs verified on a real project. The |
There was a problem hiding this comment.
🟡 Changes recommended
The production dispatch path lacks a regression test confirming that it forwards the workspace argument.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Fixes agy workflow dispatch by correctly ordering CLI flags and supplying workspace context.
Changes:
- Adds
--modeland--add-dirsupport. - Places extra arguments before
--print. - Expands argument-building tests.
File summaries
| File | Description |
|---|---|
src/specify_cli/integrations/agy/__init__.py |
Updates argument construction and dispatch. |
tests/integrations/test_integration_agy.py |
Tests flag inclusion and ordering. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
As suggested in PR github#4481, this removes the dispatch_command override in AgyIntegration to avoid duplicating subprocess and timeout logic. Instead, project_root is now threaded through IntegrationBase.dispatch_command directly into build_exec_args. All other integration subclasses have been updated to accept **kwargs to maintain signature compatibility.
@mnriem I think you're right, we could have project_root from base. Please check the latest commmit. :) |
Summary
Fixes three bugs in
AgyIntegrationthat together preventedspecify workflow runfrom working correctly withagy. Closes #4480.Bugs Fixed
1.
--modelwas silently ignoredbuild_exec_args()had a comment# agy does not support --model ... both params are ignoredand hardcoded no--modelflag.agy >=1.20fully supportsagy --model <name> --print <prompt>. Workflow YAMLmodel:pins had no effect.Fix: Pass
--model <model>before--printwhenmodelis set.2.
EXTRA_ARGSwere appended after--print(silently absorbed as prompt text)agytreats every token after--printas part of the prompt string, not as CLI flags. Operator flags like--dangerously-skip-permissionsor--print-timeout 30mset viaSPECKIT_INTEGRATION_AGY_EXTRA_ARGSwere appended after--printand silently became part of the prompt.Fix:
_apply_extra_args_env_var()is now called beforeargs.extend(['--print', prompt]).3. No workspace passed to
agy-- 'no active workspace'The base
dispatch_command()setscwd=project_rootfor the subprocess, butagydoes not readcwdas its workspace root -- it requires an explicit--add-dir <path>flag. Without it,agyfalls 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 acceptsproject_root: Path | Noneand injects--add-dir <project_root>before--printwhenproject_rootis given.dispatch_command()is overridden inAgyIntegrationto threadproject_rootthrough tobuild_exec_args().Flag Order Guarantee
All flags appear before
--printsoagyparses them correctly:agy [--model <m>] [--add-dir <d>] [<EXTRA_ARGS>] --print <prompt>Tests
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 runagainst 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.