fix(integrations): cursor-agent honors executable/extra-args env overrides#3265
Open
jawwad-ali wants to merge 1 commit into
Open
fix(integrations): cursor-agent honors executable/extra-args env overrides#3265jawwad-ali wants to merge 1 commit into
jawwad-ali wants to merge 1 commit into
Conversation
…rrides cursor-agent's build_exec_args() hardcoded self.key as argv[0] and never called _apply_extra_args_env_var(), so the documented SPECKIT_INTEGRATION_CURSOR_AGENT_EXECUTABLE (issue github#2596) and SPECKIT_INTEGRATION_CURSOR_AGENT_EXTRA_ARGS (issue github#2595) hooks were silently dropped — unlike every other CLI-dispatch integration (codex, devin). Route argv[0] through _resolve_executable() and apply the extra-args hook after the mandatory headless flags, mirroring the twins. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes parity for the cursor-agent integration by ensuring it honors the same documented per-integration environment-variable hooks as other CLI-dispatch integrations (notably executable override and extra CLI args injection).
Changes:
- Route
CursorAgentIntegrationargv[0] throughself._resolve_executable()soSPECKIT_INTEGRATION_CURSOR_AGENT_EXECUTABLEis honored. - Invoke
self._apply_extra_args_env_var(args)inCursorAgentIntegration.build_exec_args()soSPECKIT_INTEGRATION_CURSOR_AGENT_EXTRA_ARGSis applied. - Add targeted tests validating both overrides for
cursor-agent.
Show a summary per file
| File | Description |
|---|---|
| src/specify_cli/integrations/cursor_agent/init.py | Uses _resolve_executable() and _apply_extra_args_env_var() to honor executable and extra-args env overrides in cursor-agent CLI dispatch. |
| tests/integrations/test_integration_cursor_agent.py | Adds tests for executable override and extra args injection for cursor-agent build_exec_args(). |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Low
Comment on lines
+155
to
+158
| i = get_integration("cursor-agent") | ||
| args = i.build_exec_args("/speckit-plan", output_json=False) | ||
| assert "--foo" in args | ||
| assert "bar" in args |
mnriem
requested changes
Jun 30, 2026
mnriem
left a comment
Collaborator
There was a problem hiding this comment.
Please address Copilot feedback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Spec Kit exposes two documented per-integration env hooks on every CLI-dispatch integration:
SPECKIT_INTEGRATION_<KEY>_EXECUTABLE— pin the binary path (issue feat(integrations): support SPECIFY_<KEY>_EXTRA_ARGS env var for agent subprocess flags #2596), via_resolve_executable().SPECKIT_INTEGRATION_<KEY>_EXTRA_ARGS— inject extra flags into the spawned agent (issue [Feature]: Inject extra CLI flags into the agent subprocess via env var #2595), via_apply_extra_args_env_var().codexanddevinboth route through these helpers:But
CursorAgentIntegration.build_exec_args()hardcodedself.keyas argv[0] and never called_apply_extra_args_env_var():So
SPECKIT_INTEGRATION_CURSOR_AGENT_EXECUTABLEandSPECKIT_INTEGRATION_CURSOR_AGENT_EXTRA_ARGSwere silently ignored for cursor-agent — the lone CLI-dispatch outlier.Fix
Route argv[0] through
self._resolve_executable()and apply the extra-args hook immediately after the mandatory headless flags (before the--model/--output-formatextends), mirroring codex/devin. The mandatory-p --trust --approve-mcps --forceflags are unchanged.Testing
test_build_exec_args_honors_executable_overrideandtest_build_exec_args_honors_extra_args_override: fail before (argv[0]==cursor-agent, no--foo), pass after (verified by stashing the source — both fail). The mandatory-flags assertion still holds under the override.cursor-agentonly in the default no-env case (where_resolve_executable()falls back toself.key), so they stay green.TestCursorAgentCliDispatchpasses (12);uvx ruff checkclean.AI Disclosure
Found and fixed with Claude Code (Claude Opus 4.8) under my direction. AI flagged the codex/devin-vs-cursor-agent parity gap; I confirmed the dropped overrides, proved fail-before via source-stash, and reviewed the diff before submitting.