Skip to content

[FIX] Rectify: CLI Variadic Flag Positional Argument Consumption#3302

Merged
Trecek merged 4 commits into
developfrom
codex-backend-static-autoskillit-headless-in-mcp-config-cont/3298
May 30, 2026
Merged

[FIX] Rectify: CLI Variadic Flag Positional Argument Consumption#3302
Trecek merged 4 commits into
developfrom
codex-backend-static-autoskillit-headless-in-mcp-config-cont/3298

Conversation

@Trecek
Copy link
Copy Markdown
Collaborator

@Trecek Trecek commented May 30, 2026

Summary

ClaudeCodeBackend.build_interactive_cmd() appends the initial_prompt positional 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 moves initial_prompt before variadic flags, adds VARIADIC_CLAUDE_FLAGS metadata 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 (★):

  • tests/arch/test_variadic_ordering.py

Modified (●):

  • src/autoskillit/core/init.pyi
  • src/autoskillit/core/types/_type_enums.py
  • src/autoskillit/execution/backends/claude.py
  • src/autoskillit/execution/backends/codex.py
  • tests/arch/CLAUDE.md
  • tests/execution/backends/test_codex_backend.py
  • tests/execution/backends/test_codex_interactive.py
  • tests/execution/test_commands.py

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 Model count uncached output cache_read peak_ctx turns cache_write time
rectify* opus[1m] 1 64 21.5k 1.9M 136.8k 258 169.3k 23m 24s
review_approach* sonnet 1 52 5.9k 189.3k 47.8k 88 32.5k 8m 25s
dry_walkthrough* opus 1 45 10.2k 936.5k 71.0k 100 54.8k 6m 53s
implement* sonnet 1 262 11.4k 1.7M 69.1k 92 53.7k 5m 0s
audit_impl* sonnet 1 68 4.4k 231.2k 38.3k 19 25.8k 1m 30s
prepare_pr* sonnet 1 108.8k 3.7k 247.3k 30.9k 25 43.8k 1m 28s
compose_pr* sonnet 1 78.3k 1.5k 244.4k 30.9k 16 15.5k 44s
review_pr* sonnet 1 142 42.2k 837.0k 89.2k 53 74.6k 9m 5s
resolve_review* sonnet 1 237 19.2k 1.7M 78.8k 84 63.4k 9m 53s
Total 188.0k 119.8k 8.0M 136.8k 533.3k 1h 6m

* Step used a non-Anthropic provider; caching behavior may differ.

Token Efficiency

Step LoC Changed cache_read/LoC cache_write/LoC output/LoC
rectify 0
review_approach 0
dry_walkthrough 0
implement 90 18404.2 596.7 126.9
audit_impl 0
prepare_pr 0
compose_pr 0
review_pr 0
resolve_review 15 115990.6 4223.9 1277.3
Total 105 75826.5 5078.7 1140.7

Model Usage Breakdown

Model steps uncached output cache_read cache_write time
opus[1m] 1 64 21.5k 1.9M 169.3k 23m 24s
sonnet 7 187.9k 88.2k 5.1M 309.1k 36m 7s
opus 1 45 10.2k 936.5k 54.8k 6m 53s

Trecek and others added 4 commits May 29, 2026 23:35
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>
@Trecek Trecek force-pushed the codex-backend-static-autoskillit-headless-in-mcp-config-cont/3298 branch from a38cbd7 to 25408bf Compare May 30, 2026 06:35
@Trecek Trecek added this pull request to the merge queue May 30, 2026
Merged via the queue into develop with commit 5da03d5 May 30, 2026
3 checks passed
@Trecek Trecek deleted the codex-backend-static-autoskillit-headless-in-mcp-config-cont/3298 branch May 30, 2026 06:45
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.

1 participant