Repository navigation
Make PTY capture store a prose summary and the harness's own session id (closes #3454) - #3487
Conversation
Pragmatic Code Review: PR #3487Review Type: Initial Review SummaryThe PR does what the issue asks and is a clear net improvement: the summary is no longer 500 bytes of raw scrollback, the stored id is the harness's own, and the PTY id is no longer stored on the node. There are no blockers. Four gaps are worth folding in before merge; all are confirmed by reading the code. The first two concern the privacy guarantee the PR itself states. What I ran: Requirements Check
Code Review Findings🟡 Important1.
2. Nothing but the prompt stops the summary being a copy of the output
3. A late summary can land on a node that has since hosted another session
4. Previous session's summary and transcript survive a session that saves neither
🟢 Suggestions5. The viewer picks an arbitrary session when a node has several
6. No test crosses the whole summary path
7.
Nit: Nit: Nit: What I checked and found sound
RecommendationAPPROVE. No blockers, and the change is a clear net improvement over storing raw scrollback. Findings 1 to 4 should be folded into this PR rather than filed separately. Finding 1 is the one I would not merge without, since it is the invariant the PR is built on and the fix is small. |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
Review addressed (commit 4b4a91b)Addressed
Found while addressing
Run against the real model
Skipped
Still not verified: the Codex rollout layout against a real Codex install (fixtures only).
Re-Review DecisionDecision: RE-REVIEW NEEDED Rationale: four Important findings were addressed with logic changes (a trait method deciding locality, a new copy check, a conditional second write, always-cleared fields), and a module was added to the branch that the first review only saw on disk. |
Pragmatic Code Review: PR #3487Review Type: Re-Review (commit Previous Review Summary
No blockers. The two Important findings are the two sides of the new copy check's calibration: it discards honest summaries that name a file or function, and it keeps a short session echoed back whole. What I ran
Verification of the first review's findings
Requirements Check (issue #3454)
Code Review Findings🟡 ImportantA. The copy check discards honest summaries that name a file, function or branch
B. A short session echoed back whole is still stored
A and B are not blockers. Core has no sync path, so nothing leaves the machine today, and the result is strictly better than 🟢 SuggestionsC. The
D. The session-end task skips the shutdown token and pins the PTY session while it waits
E.
Nitpicks
Checked and found sound
RecommendationAPPROVE. The first review's findings are addressed and the fixes for 1, 3 and 4 are structurally right, with tests that fail on the old code. A and B should be folded into this PR: they are small and sit in one function, and the PR's own docs describe what that function enforces. Neither blocks the merge. |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review (re-review): APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
Re-review addressed (commit a4891dc)Addressed
Live run, repeated on this commit: a third sample session that names long files, a function and a branch was added. All 9 replies across the three sessions were kept. Repetitions of a session were identical again, so this is three independent samples. Stated limits (in the module doc, ADR-088 and the tests): a short secret, a key made only of letters, and a bare host name are not caught. Skipped
Re-Review DecisionDecision: RE-REVIEW NEEDED (scoped to Rationale: the copy check was rewritten in response to two Important findings. The other changes are small and mechanical. |
Pragmatic Code Review: PR #3487Review Type: Re-Review (second), scoped to commit Previous Review Summary
What I ran
Verification of the last review's findings
Code Review FindingsNo Critical or Important findings. Three suggestions, all in one function and all failing safe (no summary) or within the limits the module already states. 🟢 Suggestions1. An echo with a full stop added is not a
2. A window of punctuation-only tokens matches any output, and edge punctuation lowers the eight-word threshold
3. Some names a summary would use are still read as machine text
Nitpicks
Checked and found sound
RecommendationAPPROVE. Findings A and B are addressed, the tests pin the review's probes, and the skipped items are reasonable to skip. Findings 1 and 2 are a few lines in |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review (second re-review): APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
Second re-review addressed (commit 0575f4f)Addressed
Live run on this commit: 8 of 9 replies kept across the three sample sessions. The one missing reply was a failed generation (Metal out of memory while another process held the GPU), not a discard. A first attempt at the run failed outright for the same reason.
Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: the last review had no Critical or Important findings. This commit changes one function's normalisation in response to its three suggestions, every probe the reviewer gave is now a test, and nothing outside |
…ion id (#3454) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…PTY id (#3454) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… output, re-validate the late summary write - local_engine asks the engine whether it runs on this machine instead of pairing the active model id with the engine slot across two locks - a reply that repeats a line or a long unbroken run of the output is discarded - the summary is written only while the node still describes the session - every field describing the ended session is rewritten or cleared each time - the viewer attaches to the node's latest running session - the summary module is renamed terminal_summary: .gitignore's session*.rs pattern kept session_summary.rs out of the first commits - live test: the native model's summary of two sample sessions Skipped: refusing a second LaunchSession for a node (new daemon behaviour, beyond this issue); computing plain text lazily (milliseconds); making SessionCapture::overflowed private (used by the daemon's tests). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…e text; long names are kept - copied_from_output replaces the whole-line and any-long-run checks: a reply that is a passage of the output, repeats eight words running of it, or shares a run shaped like a path, URL, assignment or key is discarded; a long file, function or branch name is not a copy - discards are logged at info with the reason - a runaway reply is cut at a sentence end, not at the dot in a file name - the finished PTY session is dropped before the summary is awaited - .gitignore: session*.rs is anchored to the repo root, so it no longer hides source modules - live test: a third session that names long files and functions Skipped: racing the summary's idle wait against a shutdown token (the summarizer holds the process-global agent, which has none; the runtime's shutdown ends the task); sub-second ordering of two sessions launched for one node in the same second. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…Type::method names - the passage and eight-word checks compare bare words on both sides, so a full stop or a list marker does not turn an echo into a summary, and free-standing punctuation neither makes nor shortens a run of words - `::` joins the parts of a name and is not a path separator; the module doc lists what is still discarded (a relative path, a file:line reference, a name carrying eight digits) - fixtures use a neutral branch name Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
0575f4f to
773dd61
Compare
Closes #3454.
What changes
A terminal chat's
summaryandsession_idnow hold what ADR-061 §6–§7 say they hold.Summary. It was the first 500 bytes of raw terminal output. It is now prose, or absent:
Session id. It was the daemon's PTY session id. It is now the id the harness gave its own conversation, read from the harness's session store when the session exits:
~/.claude/projects/<working directory, slugged>/<id>.jsonl.session_metaline of the rollout under~/.codex/sessions/whosecwdis the session's working directory.The PTY session id is no longer stored on the node. It is a handle on a live process and is useless after the daemon restarts.
ListSessionsnow reports each session'snode_id, and the viewer asks the daemon which session is running for its node. A node that readsactivewith no running session now shows the launch form rather than a blank terminal.Node type sequence
ai-chat-pty, a core subtype of the abstractai-chat(structured category unchanged).session_id(local_only) changes what it holds;summary(base) changes how it is produced. Both are still written through the validated update.session_iddoc comment.ai-chat-ptysheet incomponents/node-types.md, ADR-088 (the two open questions this resolves become decisions),architecture/ai-chat-node.mdandarchitecture/agent-session.md.Tests
plain_text.rs: each sequence family, carriage returns, cursor movement, repaints, output ending inside a sequence.capture.rs: a sequence split across reads; an overflowed buffer that starts inside a sequence.harness_session.rs: fixture session stores for Claude Code and Codex (match by working directory, latest wins, non-session files ignored, symlinked directory, no store).capture_service.rs: the stored summary for a transcript with escapes and for an overflowed buffer; no summary without a summarizer; the harness id stored for both harnesses in thelocal_onlyfield; a missing id clears the previous one.session_summary.rs,local_agent_service.rs: reply sanitizing; only a local model summarizes, and a remote endpoint is never called.session_id.bun run test:changedpasses (frontend, scripts, browser, types drift, Rust workspace).Not verified
🤖 Generated with Claude Code