[FIX] Rectify: CLI Variadic Flag Positional Argument Consumption#3302
Merged
Trecek merged 4 commits intoMay 30, 2026
Merged
Conversation
Claude Code's CLI parser greedily consumes positional tokens following variadic flags (--tools, --add-dir) as flag arguments. Moving the initial_prompt positional arg before the variadic flag loops in both the Claude and Codex backends prevents the greeting from being consumed as a tool/directory name instead of the auto-submit prompt. Adds VARIADIC_CLAUDE_FLAGS registry, parametrized arch ordering test, and per-flag ordering contract tests to prevent silent regressions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…er assertion Reviewer (finding tests/execution/backends/test_codex_backend.py:712): commit 28ef57b weakened 'assert spec.cmd[-1] == "hello"' to 'assert "hello" in spec.cmd' and renamed the test. With no variadic flags, CodexBackend places initial_prompt as the last element unconditionally; the weaker assertion no longer catches positional regressions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reviewer (findings test_commands.py:70 and :78): commit 28ef57b injected identical ordering assertions into test_includes_initial_prompt_as_positional_arg AND added a dedicated test_initial_prompt_precedes_tools_flag covering the same inputs and assertions. Fix: revert test_includes_initial_prompt_as_positional_arg to its original intent (presence + non-headless check only, no tools= arg) and remove the redundant dedicated test. Ordering coverage is retained by test_initial_prompt_precedes_all_variadic_flags_combined and the arch test. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
a38cbd7 to
25408bf
Compare
This was referenced May 30, 2026
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.
Summary
ClaudeCodeBackend.build_interactive_cmd()appends theinitial_promptpositional argument after variadic CLI flags (--tools,--add-dir). Claude Code's CLI parser treats these flags as variadic (<tools...>,<directories...>), so the parser greedily consumes the greeting string as a tool/directory name rather than as the auto-submit initial prompt. The session launches but sits idle at an empty>prompt. The fix movesinitial_promptbefore variadic flags, addsVARIADIC_CLAUDE_FLAGSmetadata to the flags registry, and adds ordering contract tests. The same fix is applied to the Codex backend.Requirements
Conflict Resolution Decisions
The following files had merge conflicts that were automatically resolved.
Changed Files
New (★):
Modified (●):
Closes #3298
Implementation Plan
Plan file:
.autoskillit/temp/rectify/rectify_variadic_flag_ordering_2026-05-29_220000.md🤖 Generated with Claude Code via AutoSkillit
Token Usage Summary
* Step used a non-Anthropic provider; caching behavior may differ.
Token Efficiency
Model Usage Breakdown