Repository navigation
fix(sessions): release PR caches when pending viewers leave - #157776
Conversation
Retain the keys owned by each pending replacement so disconnect and supersession retire abandoned cache interest immediately. Install successor interest before retiring the previous generation, and release completed generation tokens. Preserve per-viewer delivery and forced-refresh generations. Follow-up to #156121. Original production fails the disconnect and other-session controls; same-session reuse passes. All 57 owner and sibling cases, targeted typed lint, formatting, and independent review pass.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed September 24, 2026, 9:00 PM ET / September 25, 2026, 01:00 UTC. ClawSweeper reviewWhat this changesThe Gateway now releases shared pull-request cache interest when a preparing Control UI viewer disconnects or changes sessions, while preserving it for a same-session replacement. Merge readiness✅ Ready for maintainer review Keep open. Current main still has the pending-viewer cache lifetime gap, and the earlier merged session-read PR did not resolve it. This is a distinct, focused fix with no concrete correctness finding from source review. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI sends watched session keys to the Gateway. The Gateway authorizes each viewer, shares GitHub pull-request reads across viewers of a session, and sends updated status back to connected viewers. flowchart LR
A[Control UI viewer] --> B[Subscribe request]
B --> C[Authorized session read]
C --> D{Viewer still watching?}
D -->|Yes| E[Shared PR cache]
D -->|No| F[Release cache interest]
E --> G[PR status update]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +13, Tests +66. Total +79 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep cache retention tied to the union of live, authorized viewers throughout preparation, replacement, delivery, and disconnect. Do we have a high-confidence way to reproduce the issue? Yes. The current-main unsubscribe path and the added deferred-preparation controls give a specific reproduction path; the PR reports baseline failures, but this read-only review did not rerun them. Is this the best way to solve the issue? Yes. The existing Gateway subscription owner already manages viewer membership and cache lifetime, making it the narrowest place to retire abandoned interest. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 281967681fd0. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
* commit '05edd36e124dc376f63475256f45e82ec437412c': (30 commits) refactor(matrix): reuse bounded direct-room cache insertion (#157775) fix: preserve channel-owner revocation across recovery (#157709) fix(ci): stop blocking CI during release validation (#157757) refactor(tlon): remove unreachable DM summary branches (#157789) chore: speed up worktree recovery tests with Bun (#157674) fix(sessions): release PR caches when pending viewers leave (#157776) refactor(twitch): reuse setup account selection (#157787) test: skip empty task ledger resets in cron fixtures (#157767) perf: reduce gateway and state test startup (#157711) fix: preserve maintenance leases during slow heartbeat renewal (#157696) fix(channels): match non-TTY setup advice to registered flags (#157551) fix: keep failed update report uploads in the CLI (#156633) fix: preserve rejected settings reason when opening config (#157731) test(update): load real filesystem dependencies in swap fixture fix(ci): prevent Security Review checkout retry collisions (#157652) fix(ci): recover interrupted Security Review response bodies (#157651) test(ui): capture live operator authority in guest question fixture refactor(agents): deslop runners, harness and recovery (#157294) fix(auth): preserve Copilot tenant credentials during Doctor repair (#139131) refactor(msteams): share stored service URL validation (#157706) ...
…#157776) Retain the keys owned by each pending replacement so disconnect and supersession retire abandoned cache interest immediately. Install successor interest before retiring the previous generation, and release completed generation tokens. Preserve per-viewer delivery and forced-refresh generations. Follow-up to openclaw#156121. Original production fails the disconnect and other-session controls; same-session reuse passes. All 57 owner and sibling cases, targeted typed lint, formatting, and independent review pass.
|
Merged via squash auto-merge.
|
What Problem This Solves
A pending PR-panel subscription can keep its shared cache alive after the viewer disconnects or switches to another session, until the old preparation eventually finishes.
User Impact
Abandoned subscriptions release their PR cache immediately. A replacement that still watches the same session keeps the shared cache and avoids a redundant fetch.
Why This Change Was Made
Keep retained cache keys with each replacement generation so disconnect, supersession, and completion can retire their ownership. Install the successor’s interest before retiring its predecessor. This follows up on @galiniliev’s #156121 and preserves its generation-bound refresh acknowledgments, per-viewer delivery, and authorization checks.
Evidence