Repository navigation
fix(tui): bound run state when terminal events are missing - #109492
ZengWen-DT wants to merge 2 commits into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 17, 2026, 1:22 AM ET / 05:22 UTC. Summary PR surface: Source +17, Tests +32. Total +49 across 2 files. Reproducibility: yes. from source and submitted live output: ingesting 201 distinct run IDs without terminal events leaves 201 retained states on main, while the PR bounds the same production component to 200. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Land the bounded recently-active run map after routine maintainer review, retaining terminal-event cleanup and the untracked late-finalization path exactly as covered by the regression tests. Do we have a high-confidence way to reproduce the issue? Yes, from source and submitted live output: ingesting 201 distinct run IDs without terminal events leaves 201 retained states on main, while the PR bounds the same production component to 200. Is this the best way to solve the issue? Yes. Bounding state inside TuiStreamAssembler is the narrow owner-boundary fix, and refreshing insertion order preserves active runs while matching the TUI's existing 200-run bookkeeping ceiling. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 44b79d44ae13. Label changesLabel justifications:
Evidence reviewedPR surface: Source +17, Tests +32. Total +49 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
Use untracked temporary state when finalize() handles a run id that is no longer tracked, so capacity pruning only happens during delta ingest. Co-authored-by: Cursor <[email protected]>
|
Addressed ClawSweeper P2: @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Fix cross-client terminal history synchronization without letting stale snapshots erase in-flight responses. Bound orphaned stream assembly, preserve session and agent ownership, and cover real Gateway delivery, persistence races, reconnects, and stress bursts. Closes #38829. Credits prior issue investigation in #96252 and bounded-stream work in #109492. Co-authored-by: Harjoth Khara <[email protected]> Co-authored-by: Wynne668 <[email protected]>
|
Thank you for identifying the unbounded TUI stream-run state. This is now fixed on main by #114443 (ac6009e), which uses the shared bounded-map helper, retains at most 200 recently active runs, handles late finals safely, and includes a 2,000-run regression. Your investigation is credited in the merged PR and you are recorded as a commit co-author. Closing this PR as superseded by the landed fix. |
…114443) Fix cross-client terminal history synchronization without letting stale snapshots erase in-flight responses. Bound orphaned stream assembly, preserve session and agent ownership, and cover real Gateway delivery, persistence races, reconnects, and stress bursts. Closes openclaw#38829. Credits prior issue investigation in openclaw#96252 and bounded-stream work in openclaw#109492. Co-authored-by: Harjoth Khara <[email protected]> Co-authored-by: Wynne668 <[email protected]>
What Problem This Solves
Fixes an issue where a long-running TUI session could retain streamed run state indefinitely when a run emitted deltas but its terminal event never arrived, such as after a transport interruption.
Why This Change Was Made
The stream assembler now keeps at most 200 run states and refreshes insertion order for recently active runs, matching the existing TUI run-bookkeeping ceiling. Normal
final,aborted, anderrorcleanup is unchanged; the bounded fallback only matters when terminal cleanup is missing. The risk is limited to very old orphaned stream state being unavailable if a terminal event arrives after more than 200 other tracked runs.User Impact
TUI sessions no longer accumulate unbounded in-memory stream state after missing terminal events, while current and recently active streamed responses continue to assemble normally.
Evidence
AI-assisted change; I reviewed the lifecycle paths and ran the following evidence locally on Linux with Node 24.18.0.
Real behavior proof used the same script against two isolated worktrees at latest
upstream/main(0a19e1ed586) and the fixed head. The script imported the real exportedTuiStreamAssembler, ingested 201 distinct run IDs without terminal events, refreshed the oldest active run, and inspected the production object's runtime map only to report its size. No transport or assembler logic was mocked.Before, latest main retained all 201 entries:
After, the fixed head retained 200 entries, preserved the recently active and newest runs, and evicted the oldest orphan:
Focused regression test:
Static checks:
A live Gateway disconnect was not forced; the direct production-component run exercises the exact state-retention boundary before transport-specific handling. Full repository build and test suites were not run locally and are left to CI.