Repository navigation
fix(chat): fence delayed history at terminal retirement - #140379
Conversation
Extend the existing terminal recap case with delayed history and visible run-state assertions. Production remains unchanged for the isolated before-fix proof.
Keep advertised completed runs settled by invalidating run snapshots at their shared terminal owner. Preserve accepted sequence handling, pending cleanup, and the legacy session-stream distinction.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 3:59 PM ET / 19:59 UTC. ClawSweeper reviewWhat this changesThe native chat UI invalidates older run snapshots when a run finishes, preventing delayed history from restoring stale streaming text and disabling Send. Merge readiness✅ Ready for maintainer review This remains a useful, focused fix: fetched main and v2026.9.2 lack the terminal-retirement snapshot fence. No introduced correctness or security defect was found, and the prior review contains no unresolved findings. Priority: P2 Review scores
Verification
How this fits togetherThe shared Apple chat view model combines Gateway lifecycle events and asynchronous chat-history responses. Its run-state reconciliation controls streaming text, pending activity, and whether the composer can send another message. flowchart TD
A[Gateway terminal event] --> B[Validate session and run]
B --> C[Retire run and advance generation]
D[Delayed history response] --> E[Compare snapshot generation]
C --> E
E --> F[Ignore stale run state]
F --> G[Keep composer available]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceOther +13. Total +13 across 3 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep stale run-state rejection at terminal retirement, using the existing generation guard while allowing ordinary transcript reconciliation to continue. Do we have a high-confidence way to reproduce the issue? Yes, from source: capture history for an advertised run, process its terminal session snapshot, then apply the older in-flight snapshot. The extended regression exercises this ordering; this review did not execute it. Is this the best way to solve the issue? Yes. Advancing the existing snapshot generation at the shared terminal owner closes the gap without adding another reconciliation mechanism or changing persisted state. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7974cc77bf27. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
…rol-ui * origin/main: docs: remove the empty release-sections nav group (#140427) fix(tooling): omit Codex machine squash credit (#140420) chore(ui): refresh control ui locales (#140384) refactor(plugin-sdk): reuse native approval input contracts (#140415) fix: silent model WebSocket streams hang past the idle timeout (#140335) perf(ai): avoid unused text extraction for image results (#140409) fix(ui): distinguish failed GitHub status checks from disconnected accounts (#140333) refactor(cron): share runtime feedback schema fields (#140408) fix: avoid duplicate cloud worker teardown during recovery (#140377) fix(cli): show executable approval scope (#138386) refactor(ui): reuse shared requirement records (#140407) test(gateway): table-drive device token lifecycle checks (#140403) fix(chat): fence delayed history at terminal retirement (#140379) test(skills): compare large upload bytes natively (#140402) refactor(delivery): reuse the canonical rendered batch plan type (#140386) docs(start): repair the first-run path from landing page to first channel (#140390) # Conflicts: # docs/.i18n/glossary.zh-CN.json
) * test(chat): capture advertised-run history regression Extend the existing terminal recap case with delayed history and visible run-state assertions. Production remains unchanged for the isolated before-fix proof. * fix(chat): fence delayed history at terminal retirement Keep advertised completed runs settled by invalidating run snapshots at their shared terminal owner. Preserve accepted sequence handling, pending cleanup, and the legacy session-stream distinction.
What Problem This Solves
A completed run advertised by another client could reappear as active when older chat history arrived after its terminal session update. The native composer then disabled sending and restored stale streaming text.
Why This Change Was Made
Invalidate run snapshots at the existing terminal-retirement owner and route accepted lifecycle terminals through it. Preserve sequence rejection, pending cleanup, local request failures and the legacy session-stream distinction. This removes a duplicate terminal assignment and branch, reducing production code by one line.
User Impact
Completed runs stay settled when delayed history arrives in native chat. The existing recap test gains 14 lines while retaining every prior assertion.
Evidence
Hosted BEFORE proof compiled the unchanged production and failed only the three new assertions: pending count 1, stale streaming text and disabled sending. The shared suite ran 1,670 Swift Testing cases in 126 suites; XCTest reported 60 cases, two live-audio skips and no failures.
Both production files pass formatting and strict lint. All 14 local canonical checks pass. One managed source-review invocation returned no findings across three automatic passes; its first pass withheld confidence pending the later evidence. Native AFTER passes the exact unchanged regression method and all 1,670 shared Swift Testing cases. The macOS app suite also passes 2,074 tests; its separate two-case isolation supplement and one-case health render are recorded independently from skipped probes. Exact-head PR CI passed 20 jobs with 21 skipped. BEFORE used serial execution and AFTER parallel; Xcode/Swift matched, while runner macOS versions differed. No live-audio or skipped-probe coverage is claimed. The test-only baseline workflow also exposed unrelated locale, cron-picker and docs-test failures, retained separately; its overall run was not green. No local native application or saved user state was used.