test(parity): lock clean JSON prompt transport output

PARITY.md still claimed tool-capable JSON prompt runs leaked human-readable tool result lines, but a local mock SSE reproduction showed stdout already stays transport-clean. Add a real CLI regression test around the binary prompt path and update the parity note so future work does not chase a stale bug report.

Constraint: Keep scope limited to JSON prompt parity and leave the existing README Philosophy edits untouched
Rejected: Modify claw-cli transport code | current behavior already verified clean via a mock SSE prompt run
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep prompt JSON stdout parseable as a single transport object even when tool loops fire
Tested: cargo test -p claw-cli prompt_json_with_tool_use_writes_clean_transport_output --test prompt_json_transport -- --nocapture
Tested: cargo test -p claw-cli parses_bare_prompt_and_json_output_flag -- --nocapture
Tested: cargo test -p claw-cli response_to_events_preserves_empty_object_json_input_outside_streaming -- --nocapture
Not-tested: Live provider behavior outside the local mock SSE harness
This commit is contained in:
Yeachan-Heo
2026-04-01 23:15:15 +00:00
parent bcaf6e0771
commit 06ee5a2dc4
2 changed files with 303 additions and 4 deletions

View File

@@ -137,7 +137,7 @@ Evidence:
- Missing major TS command families: `/agents`, `/hooks`, `/mcp`, `/plugin`, `/skills`, `/plan`, `/review`, `/tasks`, and many others.
- No Rust equivalent to TS structured IO / remote transport layers.
- No TS-style handler decomposition for auth/plugins/MCP/agents.
- JSON prompt mode is improved on this branch, but still not clean transport parity: empirical verification shows tool-capable JSON output can emit human-readable tool-result lines before the final JSON object.
- JSON prompt mode now maintains clean transport output in tool-capable runs; targeted CLI coverage should guard against regressions.
**Status:** functional local CLI core, much narrower than TS.
@@ -161,7 +161,7 @@ Evidence:
- No TS-style hook-aware orchestration layer.
- No TS structured/remote assistant transport stack.
- No richer TS assistant/session-history/background-task integration.
- JSON output path is no longer single-turn only on this branch, but output cleanliness still lags TS transport expectations.
- JSON output path is no longer single-turn only on this branch, and tool-capable prompt output now stays transport-clean like the TypeScript behavior.
**Status:** strong core loop, missing orchestration layers.
@@ -209,6 +209,6 @@ Evidence:
- **Unlimited max_iterations**
- Verified at `rust/crates/runtime/src/conversation.rs` with `usize::MAX`.
### Remaining notable parity issue
### JSON prompt output cleanliness status
- **JSON prompt output cleanliness**
- Tool-capable JSON mode now loops, but empirical verification still shows pre-JSON human-readable tool-result output when tools fire.
- Verified clean in tool-capable prompt mode: stdout remains a single final JSON object when tools fire.