Skip to content

Commit 91ba54d

Browse files
committed
ROADMAP ultraworkers#136: --compact flag silently overrides --output-format json — compact turn always emits plain text even when JSON requested; unreachable Json arm in run_with_output() match; joins output-format completeness cluster ultraworkers#90/ultraworkers#91/ultraworkers#92/ultraworkers#127/ultraworkers#130 and CLI/REPL parity §7.1
1 parent 8b52e77 commit 91ba54d

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

ROADMAP.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5051,3 +5051,29 @@ ear], /color [scheme], /effort [low|medium|high], /fast, /summary, /tag [label],
50515051
**Blocker.** None. Requires a UUID/nanoid generated at session init and threaded through the event emitter.
50525052

50535053
**Source.** Jobdori dogfood 2026-04-21 01:54 KST on main HEAD `50e3fa3` during recurring cron cycle. Joins **Session identity completeness at creation time** (ROADMAP §4.7) — §4.7 covers identity fields at creation time; #134 covers the stable correlation handle that ties those fields to downstream events. Joins **Event provenance / environment labeling** (§4.6) — provenance requires a stable anchor; without `session.id` the provenance chain is broken at the root. Natural bundle with **#241** (no startup run/correlation id, filed by gaebal-gajae 2026-04-20) — #241 approached from the startup cluster; #134 approaches from the event-stream observer side. Same root fix closes both. Session tally: ROADMAP #134.
5054+
5055+
## Pinpoint #136. `--compact` flag output is not machine-readable — compact turn emits plain text instead of JSON when `--output-format json` is also passed
5056+
5057+
**Gap.** `claw --compact <prompt>` runs a prompt turn with compacted output (tool-use suppressed, final assistant text only). But `run_with_output()` routes on `(output_format, compact)` with an explicit early-return match: `CliOutputFormat::Text if compact => run_prompt_compact(input)`. The `CliOutputFormat::Json` branch is never reached when `--compact` is set. Result: passing `--compact --output-format json` silently produces plain-text output — the compact flag wins and the format flag is silently ignored. No warning or error is emitted.
5058+
5059+
**Trace path.**
5060+
- `rust/crates/rusty-claude-cli/src/main.rs:3872-3879` — `run_with_output()` match:
5061+
```
5062+
CliOutputFormat::Text if compact => self.run_prompt_compact(input),
5063+
CliOutputFormat::Text => self.run_turn(input),
5064+
CliOutputFormat::Json => self.run_prompt_json(input),
5065+
```
5066+
The `Json` arm is unreachable when `compact = true` because the first arm matches first regardless of `output_format`.
5067+
- `run_prompt_compact()` at line 3879 calls `println!("{final_text}")` — always plain text, no JSON envelope.
5068+
- `run_prompt_json()` at line 3891 wraps output in a JSON object with `message`, `model`, `iterations`, `usage`, `tool_uses`, `tool_results`, etc.
5069+
5070+
**Fix shape (~20 lines).**
5071+
1. Add a `CliOutputFormat::Json if compact` arm (or merge compact flag into `run_prompt_json` as a parameter) that produces a JSON object with `message: <final_text>` and a `compact: true` marker. Tool-use fields remain present but empty arrays (consistent with compact semantics — tools ran but are not returned verbatim).
5072+
2. Emit a warning or `error.kind: "flag_conflict"` if conflicting flags are passed in a way that silently wins (or document the precedence explicitly in `--help`).
5073+
3. Regression tests: `claw --compact --output-format json <prompt>` must produce valid JSON with at minimum `{message: "...", compact: true}`.
5074+
5075+
**Acceptance.** An orchestrator that requests compact output for token efficiency AND machine-readable JSON gets both. Silent flag override is never a correct behavior for a tool targeting machine consumers.
5076+
5077+
**Blocker.** None. Additive change to existing match arms.
5078+
5079+
**Source.** Jobdori dogfood 2026-04-21 12:25 KST on main HEAD `8b52e77` during recurring cron cycle. Joins **Output format completeness** cluster (#90/#91/#92/#127/#130) — all surfaces that produce inconsistent or plain-text fallbacks when JSON is requested. Also joins **CLI/REPL parity** (§7.1) — compact is available as both `--compact` flag and `/compact` REPL command; JSON output gap affects only the flag path. Session tally: ROADMAP #136.

0 commit comments

Comments
 (0)