roadmap: #263 filed

This commit is contained in:
Yeachan-Heo 2026-04-26 04:02:07 +00:00 committed by YeonGyu-Kim
parent 3606f589c1
commit e69fe1a7da

View File

@ -16890,3 +16890,15 @@ Cluster delta: joins the silent-fallback / silent-drop / silent-strip / silent-c
Required fix shape: (a) declare `--max-turns N` as a typed CLI flag with `validate_max_turns` accepting `u32` (rejecting negative and non-numeric values with a typed `MaxTurnsParseError`), thread `max_turns: Option<u32>` through `CliAction::Prompt` and `LiveCli::run_turn_with_output`, and pass it as a hard ceiling into the runtime turn loop so `runtime.run_turn` returns a typed `TurnBudgetExhausted` event when the count is reached; (b) add `--max-turns` to `CLI_OPTION_SUGGESTIONS` (`main.rs:176-194`) and to `--help` output; (c) restructure the `-p` arm at `main.rs:944` so it does NOT greedily slurp `args[index+1..].join(" ")` but instead consumes only the next argv slot as the prompt and continues the flag-parse loop, OR explicitly require `-p` to be the LAST flag (rejecting any token starting with `-` after `-p` with `error: -p must be the final flag; saw '--max-turns' after the prompt`); (d) treat `--max-turns 0` semantically as "return immediately after dispatch with `iterations: 0` and no model call" (matching upstream Claude Code's documented zero-turn behavior, useful for cost-zero parse-validation runs); (e) emit a `CliFlagWarning` structured event when `--output-format json` is active and an unknown flag is detected after `-p`, so downstream consumers can surface the would-have-been-silent prompt-pollution diagnostic; (f) add tests covering `["-p", "x", "--max-turns", "0"]`, `["--max-turns", "0", "-p", "x"]`, `["-p", "x", "--unknown-flag"]`, `["--max-turns=5", "-p", "x"]`, `["-p", "x", "--max-turns=-1"]`, and `["hello", "--max-turns", "0"]` (bare-prompt rest-positional case). Acceptance: `claw -p "x" --max-turns 0` either rejects with a typed error OR enforces the turn budget without silently mutating the prompt; `claw --max-turns 0 -p "x"` and `claw -p "x" --max-turns 0` produce structurally equivalent outcomes (no position-sensitive divergence); `claw --help` lists `--max-turns N`; downstream JSON consumers can detect the would-have-been-silent absorption case.
**Status:** Open. No source code changed. Filed 2026-04-26 12:32 KST. Branch: feat/jobdori-168c-emission-routing. HEAD: `2a0e5de` (post-#261 fast-forward verification onto gaebal-gajae's compact-summary self-consistency-check pinpoint). Cluster delta: silent-fallback-family extension 9→10 (no new top-level cluster founded, per #253 context-budget discipline). Position-sensitive-parse-asymmetry sub-shape introduced (request-side argv-parse layer, sibling to #258's empty-value-coercion at the same layer and #260's response-envelope-strip at the response-side serialize layer). Sibling: #258 (`--allowedTools ""` empty-coercion at CLI parse boundary, position-invariant), #260 (`--compact --output-format json` envelope strip at CLI response-envelope layer, position-invariant), #98/#136 (predecessor `--compact` silent-no-op family at the dispatch layer). Together with #258 and #260, #262 brackets the CLI parse boundary across THREE structurally distinct silent-fallback shapes: empty-value-coercion (#258), response-envelope-strip (#260), and position-sensitive-prompt-absorption-of-unknown-flag (#262). Tenth-cycle concurrent-dogfood-rebase parity confirmed local==origin==fork at HEAD `2a0e5de` before filing.
## Pinpoint #263`--compact` help text says "text mode only" even though the CLI has a live compact-JSON dispatch path, creating a stale-contract trap for operators auditing JSON observability
Dogfooded 2026-04-26 13:02 KST on `feat/jobdori-168c-emission-routing` at HEAD `0e4fd38` (post-#262). Fresh `cargo run --quiet --bin claw -- --help` from `rust/` prints `--compact Strip tool call details; print only the final assistant text (text mode only; useful for piping)`. That help text is now false/stale: #260 already verified that `LiveCli::run_turn_with_output` dispatches `CliOutputFormat::Json if compact` into `run_prompt_compact_json`, so `--compact --output-format json` is a real live mode, not text-only. The product surface therefore gives operators the wrong contract at exactly the place they would look before testing the compact JSON envelope.
Concrete failure mode: an operator trying to inspect or script compact JSON observability sees help text claiming `--compact` is text-mode-only, while the runtime actually accepts compact JSON and emits a reduced JSON envelope. This can cause two bad outcomes: (1) users avoid testing/using compact JSON because the help says it should not exist; or (2) downstream claws treat compact JSON behavior as accidental/unsupported even though there is a dedicated code path. That stale help text also masked #260's more serious envelope-field strip: the documented contract never states which JSON fields compact mode preserves or drops because it incorrectly says JSON mode is out of scope.
Gap. This is a **help-contract drift / doc-to-runtime divergence** at the CLI surface, distinct from #260. #260 is about the runtime compact-JSON envelope silently stripping observability fields after dispatch; #263 is about the advertised CLI contract being stale before dispatch. The runtime has a feature the help denies exists. It is also distinct from #262's `--max-turns` absence: #262 is a missing flag plus position-sensitive parse asymmetry; #263 is an existing flag whose mode matrix is documented incorrectly.
Required fix shape: (a) update `--compact` help text to describe the actual mode matrix: text mode strips tool-call detail into final assistant text; JSON mode emits a compact JSON envelope; (b) document the compact-JSON field contract after #260 is fixed, explicitly naming preserved fields (`iterations`, `auto_compaction`, `prompt_cache_events`, `usage`, `estimated_cost`) and intentionally stripped fields (`tool_uses`, `tool_results`); (c) add a help-output regression that fails if `--compact` still says `text mode only` while `CliOutputFormat::Json if compact` remains supported; (d) optionally add `claw --help --json` / structured flag metadata later so mode compatibility can be generated from the same source as parser dispatch instead of hand-written prose. Acceptance: `claw --help` no longer claims `--compact` is text-only; compact JSON's supported status and field delta are discoverable before running a prompt; help output and dispatch matrix cannot drift silently.
**Status:** Open. No source code changed. Filed 2026-04-26 13:02 KST. Branch: feat/jobdori-168c-emission-routing. HEAD: `0e4fd38` before filing. Cluster delta: help-contract-drift +1; CLI-contract-observability gap adjacent to #260 but not a duplicate. Concrete delta this cycle: ROADMAP-only pinpoint appended after fresh help-output verification; no implementation landed.