docs(roadmap): add #468 — duplicate global flags silently last-win/accumulate with no provenance#3081
Open
Yeachan-Heo wants to merge 1 commit into
Open
Conversation
…cumulate with no provenance
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.
ROADMAP pinpoint #468 — duplicate global flags silently last-win / accumulate with no provenance
Dogfooded for the 2026-05-24 18:30/19:00 Clawhip nudge window; finalized for message 1508182831573110904.
The pinpoint
Repeated global flags silently apply inconsistent merge semantics:
--model: last-write-wins--permission-mode: last-write-wins--output-format: last-write-wins, even if the first occurrence requested JSON--allowedTools: accumulates/unions every occurrenceNo
duplicate_flags, noflag_occurrences, no overwritten-values provenance.Repro matrix
Root cause traced
rust/crates/rusty-claude-cli/src/main.rs:617-694uses mutable scalar parser state:Each occurrence overwrites prior value.
But
--allowedToolsaccumulates all occurrences intoallowed_tool_valuesand normalizes later:Same parser layer, two duplicate semantics, no provenance.
Why distinct
--output-formatvalues. This covers valid duplicate values, especially JSON intent overwritten by later text.-pgreedily swallowing flags into prompt text. This covers normal global flags before subcommand.--base-commitaccepting arbitrary values / swallowing args. This covers duplicate flags that parse successfully.--allowedTools ""; this entry notesallowedToolsaccumulation semantics versus scalar last-wins.--modelaccepting garbage; this uses valid model values and focuses on duplicate/conflict invisibility.Why it matters
CLAW_ARGS="--output-format json"+ wrapper-appended--output-format textsilently breaks JSON consumers.--permission-mode read-only --permission-mode danger-full-accesssilently escalates if unsafe flag appears later.--model openai/gpt-4 --model opussilently flips provider.--allowedToolsunion but duplicate--permission-modeoverwrite?statuscannot tell a claw whether final value came from one flag or conflicting duplicates.Required fix shape
(a) Track occurrences for every global flag during parse with raw values and argv positions.
(b) For scalar flags, either reject duplicates with structured
duplicate_flagparse error or allow last-wins but emitduplicate_flags/overwritten_flagsprovenance instatusanddoctor.(c) For machine-output flags, prefer reject:
--output-format json --output-format textshould not silently break JSON consumers.(d) For
--allowedTools, document/expose accumulation semantics explicitly (source:"flag_accumulated",occurrences:2) or require comma-list single occurrence.(e) Regression matrix covering examples above plus repeated
--reasoning-effort/--base-commit.Acceptance check
Should either fail with
kind:"duplicate_flag"in a JSON error envelope or return JSON containing:{"duplicate_flags":[{"flag":"--output-format","values":["json","text"],"effective":"text"}]}Current behavior emits plain text and exit 0.
Method honesty
Initial repeated-flag probe was contaminated by zsh scalar splitting (whole arg string passed as one token). Evidence was re-run with
evaland separate stdout/stderr capture before filing.—
[repo owner's gaebal-gajae (clawdbot) 🦞]