Repository navigation
Surface PTY StreamOutput broadcast lag to clients as a loss marker (closes #2985) - #3057
Conversation
Pragmatic Code Review — PR #3057Review Type: Initial Review (commits Requirements Check (#2985)
Code Review Findings🟢 Suggestion: notices and warn logs can repeat under sustained backpressure 🟢 Suggestion: the notice clears the running program's text attributes 🟢 Suggestion: integration test timing 🟢 Nit: notice text exists in two languages 🟢 Nit: Positives
RecommendationAPPROVE. The PR fully resolves #2985 with a minimal, additive contract change, all consumers updated, and a real regression test. The suggestions above are optional polish. |
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 (6d0afb1)✅ Addressed (3)
⏭️ Skipped (2)
Re-review: not needed. The changes are comments plus one small unit test, with no logic change. |
…loses #2985) OutputChunk gains dropped_chunks; the daemon yields a marker chunk (empty data, dropped_chunks = N) on RecvError::Lagged instead of only warning server-side. The Tauri bridge forwards it, and the desktop terminal and CLI render an "[output truncated: N chunks dropped]" notice in its place. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… test CLI notice - Explain that the 2s no-read sleep is what creates the backpressure - Cross-reference the duplicated notice wording in TS and Rust - Unit-test the CLI dropped_notice (fresh line, pluralisation) Skipped: coalescing repeated markers (speculative, the Tauri reader drains fast) and avoiding the SGR reset (matches the existing session-closed notice; a header badge is a separate UI change). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
6d0afb1 to
eeb3ca5
Compare
Summary
When a PTY output subscriber fell behind the daemon's broadcast buffer,
RecvError::Laggedwas only logged server-side, so the terminal silently rendered a truncated or desynced stream. This PR makes the gap visible all the way to the user.OutputChunkgainsuint64 dropped_chunks = 3. A non-zero value marks a loss marker: itsdatais empty, and that many chunks were dropped just before this point.agent_session_service.rs): onLagged(n), still warns and keeps draining, but now also yields a marker chunk withdropped_chunks: n. The stale TODO is removed.PtyOutputPayloadforwardsdroppedChunks.pty-terminal.svelte): shows[output truncated: N chunks dropped]in yellow, styled like the[Session closed]notice. The text comes fromformatDroppedNotice.nodespace session): writes the same notice inline.The unit is chunks rather than bytes because that is what
broadcastreports. Each chunk is at most 4 KiB.Unrelated fix, needed to get the pre-push gate green
methodology_linear_execution_test::rollover_moves_a_task_rather_than_leaving_it_in_both_cyclesbuiltend_datefromLocal::now(). CELtoday()now readsUtc::now(), so onmainthe test fails every day between local midnight and UTC midnight in timezones east of UTC. It now uses UTC, in its own commit.Tests
stream_output_reports_dropped_chunks_when_subscriber_lags. It floods 32 MiB through a real PTY while the client doesn't read, then asserts that a marker arrives with empty data. I confirmed it fails with the marker count forced to 0.pty-terminal.test.ts: ordinary bytes are written unchanged, and a marker writes the truncation notice.🤖 Generated with Claude Code