Repository navigation
fix(gateway): recover embedded channel runs in chat startup projection - #123189
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
36cf24d to
16a8d36
Compare
|
Codex review: needs maintainer review before merge. Reviewed August 27, 2026, 10:58 AM ET / 14:58 UTC. ClawSweeper reviewWhat this changesThe PR lets Control UI recover an active channel-originated embedded run’s identity, original timer, bounded progress, and safe Stop route after reload. Merge readinessThis PR remains necessary: current main marks embedded runs active but cannot project their identity or recovery snapshot into chat startup/history. The branch adds that missing owner-boundary bridge without a concrete correctness defect found in review; merge still needs exact-head CI and live review-state refresh. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherChannel turns are owned by the embedded-run registry, while Control UI reloads obtain session state from Gateway chat history/startup. This change joins the registry’s live owner to the existing bounded chat projection so the UI can resume and cancel the correct run. flowchart LR
A[Channel turn] --> B[Embedded run registry]
B --> C[Gateway recovery projection]
D[Bounded chat progress] --> C
C --> E[Control UI reload]
E --> F[Timer and activity restored]
E --> G[Exact safe Stop]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +271, Tests +372. Total +643 across 25 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep one registry-owned recovery projection, preserve summary-only progress redaction and complete-controller semantics for Do we have a high-confidence way to reproduce the issue? Yes. The linked report supplies a precise active Telegram embedded-run reload scenario, the PR records a before/after Telegram Test Server run, and current-main source independently shows the controller-only projection gap. Is this the best way to solve the issue? Yes. Reusing the embedded registry as the authoritative owner and the existing bounded chat projection avoids a duplicate replay buffer while retaining exact-run cancellation fencing. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 671e41a8773b. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (41 earlier review cycles; latest 8 shown)
|
772d747 to
6e059e2
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
da68010 to
8a35edd
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. |
813319c to
7e5115d
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
d163391 to
0500ecd
Compare
0500ecd to
f049ab7
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Thanks @SunnyShu0925! Proof: A real Telegram Test Server direct message started a long embedded run. On current
Example
Checks
|
|
@obviyus Thanks for your optimization and merge — it's been a real pleasure working with you! |
Related to #121756
What Problem This Solves
A run started from Telegram can remain active while Control UI receives only
hasActiveRun: true. It receives no exact run identity or recovery snapshot. After reload, the timer restarts, recent activity is incomplete, and Stop cannot target the recorded embedded-run owner.Why This Change Was Made
The embedded-run registry owns the live run identity. Gateway history only projected browser-started chat controllers. The submitted patch added a second replay buffer inside the embedded registry. This revision removes that duplicate owner.
Gateway now combines the embedded registry's exact identity and core start time with the existing bounded chat progress snapshot. Embedded tool replay uses the same recorder in summary mode. It keeps only phase, tool name, and call ID. It drops arguments, output, diffs, partial output, and review payloads.
Control UI marks this recovery snapshot as session-owned. Stop sends the exact run ID through
sessions.abort. The embedded owner is revalidated at use time, so a stale Stop cannot cancel replacement work.User Impact
After a reload, Control UI keeps the active Telegram run's original timer and recent activity. Stop interrupts that exact run. No configuration changes are required.
Evidence
The same Telegram Test Server direct-message scenario ran against current main and the final production patch.
hasActiveRun: true; noactiveRunIds; noinFlightRunsessionAbortable: true, and three bounded activity events1mto1m 1sname,phase, andtoolCallIdThe green run used
dcad49f482f8. The current head26e7738ed334differs only by removal of invalid test-fixture fields. Production code is byte-identical.Focused checks:
chat.historyandchat.startup.Sanitized Control UI proof
After reload, the original timer and activity remain:
After Stop, the run is no longer active:
AI Assistance