Expose session tree inspection and navigation over RPC#316
Conversation
Implementation PlanProblemThe planned web dashboard (issue 307) needs session-tree visibility and navigation for parity with the TUI's Prior artThe Agent Client Protocol (ACP) has a Design decisions1. Tree DTO — trimmed, stable, no raw entry dumps New
Response payload: Full message payloads are deliberately not serialized; 2. {"type": "navigate_tree", "targetId": "abc123", "summarize": true, "customInstructions": "...", "replaceInstructions": false, "label": "..."}Options pass through verbatim to Response:
3. Core fix — streaming guard in
Fix in core, not in the RPC handler: add a loud throw at the top of 4. Error paths All surface as explicit
5. RpcClient timeout
Deliverables
Files to create or modify
Testing approachAll new tests run without an API key, using
Risks and open questions
Plan created by mach6 |
Vitest coverage
|
Adds get_tree and navigate_tree RPC commands with a stable RpcTreeNode DTO (no raw entry/message payloads), RpcClient methods with a summarize-aware client timeout, and a streaming guard in AgentSession.navigateTree that fails loudly instead of silently replacing agent messages mid-run.
Progress UpdateFull implementation of the plan — all deliverables complete:
Verification: full workspace build, biome clean, entire test suite green (4014 passed / 0 failed via pre-commit hook). Additionally QA'd against the compiled binary in live RPC mode: tree DTO shape, payload-leakage check, navigation, post-navigation Commit: Progress tracked by mach6 |
Code ReviewImportantFinding 1 — Streaming guard is a TOCTOU check; concurrent SuggestionsFinding 2 — Finding 3 — Finding 4 — Most Finding 5 — Finding 6 — Strengths
Agents run: code-reviewer, error-auditor, test-reviewer, completeness-checker, simplifier Reviewed by mach6 |
Review AssessmentAssessing the review findings above (#316 (comment)). Each finding was independently verified against the actual source. Classifications
Counts: 3 genuine, 2 nitpicks, 0 false positives, 1 deferred. Action Plan
Follow-up to track separately (finding 1): file an issue for RPC command-dispatch serialization / navigation-vs-prompt atomicity (unserialized Assessment by mach6 |
Review Assessment — Amendment: finding 1 reclassifiedAmending the assessment above: finding 1 (streaming-guard TOCTOU) is reclassified from deferred to genuine — fix in this PR. Why the reclassificationTwo corrections to the original assessment, based on a closer read of
What stays out of scopeFull RPC command-dispatch serialization remains a follow-up: navigate-vs-navigate interleavings, the semantic oddity of a prompt completing entirely within the summary window (append-only tree, no corruption — the new entries are simply abandoned by the navigation, arguably as requested), and Updated classificationsCounts: 4 genuine (findings 1, 3, 4, 5), 2 nitpicks (findings 2, 6), 0 false positives, 0 deferred. Updated Action Plan
Optional follow-up issue (downgraded, no longer tracks a corruption bug): serialize RPC command dispatch for multi-client robustness (navigate-vs-navigate, fork exposure) ahead of the dashboard work. Assessment by mach6 |
…ew mapping, expand tests
Progress UpdateAll six review findings addressed (per the amended assessment: findings 1, 3, 4, 5 genuine; 2, 6 nitpick polish):
Test suite for the file: 24 passed (up from 18). Pre-commit full run: 4036 passed / 0 failed. Biome clean; full workspace build green. Commit: Progress tracked by mach6 |
Code Review (round 2)This round verified the fixes from the previous review cycle and hunted for new issues. All six prior findings are confirmed genuinely resolved — both code-reviewer and error-auditor independently read the full ImportantFinding 1 — navigateTree re-check throw wedges SuggestionsFinding 2 — Finding 3 — Finding 4 — Strengths
Agents run: code-reviewer, error-auditor, test-reviewer, completeness-checker, simplifier Reviewed by mach6 |
Review Assessment (round 2)Assessing the round-2 review findings above (#316 (comment)). Each finding was independently verified against the actual source, with full control-flow tracing of Classifications
Counts: 4 genuine (1 correctness, 1 trivial correctness, 2 test coverage), 0 nitpicks, 0 false positives, 0 deferred. Also confirmed this round: all six round-1 findings are genuinely resolved — the TOCTOU re-check placement was independently re-verified (no await between re-check and mutation block). Action Plan
Assessment by mach6 |
…r on all exit paths, fix empty-title preview parity, add e2e dispatch tests
Progress UpdateAll four round-2 review findings addressed (all classified genuine by the assessment):
Verification: Commit: Progress tracked by mach6 |
Code Review (round 3)This round verified the round-2 fixes (commit
The test-reviewer additionally verified the round-2 test additions are non-tautological: the ImportantFinding 1 — Concurrent SuggestionsFinding 2 — Finding 3 — Summarization branch of Finding 4 — Finding 5 — Extension-cancel path has no test (test-reviewer, confidence 82, severity low) Strengths
Agents run: code-reviewer, error-auditor, test-reviewer, completeness-checker, simplifier Reviewed by mach6 |
Review Assessment (round 3)Assessing the round-3 review findings above (#316 (comment)). Each finding was independently verified against the actual source, including cross-checking sibling methods ( Classifications
Counts: 2 genuine (findings 1, 5), 2 nitpicks (findings 2, 4), 1 false positive (finding 3), 0 deferred. Also confirmed this round: all four round-2 fixes are correctly implemented — the try/finally fires on every exit path, the ~140-line re-indent dropped nothing, and the new tests are non-tautological (the Action PlanThe PR is merge-ready except for two cheap, in-scope items:
Optional (non-blocking) follow-up: file a dispatch-serialization hardening issue against the issue-307 dashboard work — read-only commands are interleave-safe and Assessment by mach6 |
…t navigation/compaction, test extension-cancel cleanup path
Progress UpdateBoth round-3 genuine findings addressed (per the round-3 assessment: findings 1 and 5 genuine; 2 and 4 nitpicks; 3 false positive):
Also fixed in passing (no-pre-existing-failures rule): two lock-contention tests ( Nitpick findings 2 (post-commit Verification: rpc-tree-commands suite 27 passed; full coding-agent suite 2533 passed / 0 failed; pre-commit hook full run 3999 passed / 0 failed; biome clean; full workspace build green. Commit: Progress tracked by mach6 |
Closes #313
Adds
get_treeandnavigate_treeRPC commands so external frontends (the planned web dashboard) can inspect the session tree and navigate to another node — TUI/treeparity over RPC. Also adds a missing streaming guard toAgentSession.navigateTreein core.Implementation plan posted as a comment below.