Repository navigation
fix(gateway): keep chat subscriptions stable during unrelated approvals - #158633
Conversation
|
🦞👀 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 26, 2026, 1:20 AM ET / 05:20 UTC (Revision 3). ClawSweeper reviewWhat this changesThe branch makes Gateway chat subscriptions share pending approval reads while unrelated sessions or reviewers change, and adds regression coverage and protocol documentation. Merge readiness✅ Ready for maintainer review Keep open. Current main still invalidates every approval replay after any approval publication. The branch addresses that failure with scoped invalidation, and this review found no actionable introduced defect. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway accepts chat subscription requests, reads pending approvals from SQLite, and returns a replay before delivering live approval events. Approval lifecycle publications determine whether an in-flight replay remains current. flowchart LR
A[Chat viewer] --> B[Gateway subscription]
B --> C[Session access check]
C --> D[Approval replay]
E[Approval lifecycle events] --> F[Scoped freshness check]
D --> F
F --> G[Subscription response]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +44, Tests +51, Docs 0. Total +95 across 8 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep one Gateway replay owner that shares only in-flight reads, invalidates matching session and reviewer scopes, and preserves final-response access checks. Do we have a high-confidence way to reproduce the issue? Yes. Current main's global revision gives a clear source-level reproduction path: publish an unrelated approval while a subscription waits for its pending-approval read. The PR reports a before-fix handler failure, but this read-only review did not execute it. Is this the best way to solve the issue? Yes. Scoping replay invalidation to the audience and reviewer predicates already used by the durable reader is a focused repair, and the handler retains the scope through its response. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0d7a4e817abc. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
b7fd495 to
efca669
Compare
|
Merged via squash.
|
* commit '66b812f26e725cd709e08860d2cb46ba496cd308': (70 commits) fix(gateway): preserve typed boxed-number coercion chore(ui): refresh control ui locales (#158689) fix(gateway): reset staged headers on authority errors (#158669) fix(workers): keep inbound staging stable during quota scans fix: preserve Telegram delivery after bot identity changes (#158612) fix(ui): keep automation starter prompts out of startup (#158482) fix(cli): distinguish configuration read failures from invalid input (#158671) test: remove retired progress coercion suppression allowance refactor(gateway): schedule worker placement maintenance (#158662) fix(daemon): keep native service checks within their timeout (#154565) fix(test): restore gateway steering fixture contracts (#158478) fix(acpx): use SDK filesystem publication boundary fix(agentsapi): load OpenClaw persona and workspace context (#158328) fix(gateway): drop progress snapshot coercion suppression fix(qa): accept native Codex truncation in cache evidence (#158454) fix(gateway): keep chat subscriptions stable during unrelated approvals (#158633) perf(gateway): release event payloads from live text guards (#158643) perf(sessions): reduce stalls when saving large chat messages (#158402) fix(qa): reject history-bearing utility requests without session affinity (#158496) test: allow intentional progress snapshot coercion ...
* fix(test): verify followup completion ordering Exercise the real presentation settlement helper with asynchronous cleanup, preserve continuation and admission semantics, and unconditionally release and join the held work. Remote proof covers the strengthened ordering contract and both missing-await faults. * fix(test): verify followup completion ordering * chore: retain followup test branch ancestry The current-main reconstruction preserves the original reviewed scope and supersedes its stale base. Keep the remotely qualified candidate tree unchanged while retaining the original PR ancestry for a non-force branch update. * commit 'ff35145de21cf6296bec05e86bee37b5ed53bcb8': fix(test): verify followup completion ordering * test(auto-reply): signal queued presentation entry * chore: refresh followup test on boundary fix * commit '66b812f26e725cd709e08860d2cb46ba496cd308': (70 commits) fix(gateway): preserve typed boxed-number coercion chore(ui): refresh control ui locales (#158689) fix(gateway): reset staged headers on authority errors (#158669) fix(workers): keep inbound staging stable during quota scans fix: preserve Telegram delivery after bot identity changes (#158612) fix(ui): keep automation starter prompts out of startup (#158482) fix(cli): distinguish configuration read failures from invalid input (#158671) test: remove retired progress coercion suppression allowance refactor(gateway): schedule worker placement maintenance (#158662) fix(daemon): keep native service checks within their timeout (#154565) fix(test): restore gateway steering fixture contracts (#158478) fix(acpx): use SDK filesystem publication boundary fix(agentsapi): load OpenClaw persona and workspace context (#158328) fix(gateway): drop progress snapshot coercion suppression fix(qa): accept native Codex truncation in cache evidence (#158454) fix(gateway): keep chat subscriptions stable during unrelated approvals (#158633) perf(gateway): release event payloads from live text guards (#158643) perf(sessions): reduce stalls when saving large chat messages (#158402) fix(qa): reject history-bearing utility requests without session affinity (#158496) test: allow intentional progress snapshot coercion ... Co-authored-by: Vincent Koc <[email protected]>
* fix(test): verify followup completion ordering Exercise the real presentation settlement helper with asynchronous cleanup, preserve continuation and admission semantics, and unconditionally release and join the held work. Remote proof covers the strengthened ordering contract and both missing-await faults. * fix(test): verify followup completion ordering * chore: retain followup test branch ancestry The current-main reconstruction preserves the original reviewed scope and supersedes its stale base. Keep the remotely qualified candidate tree unchanged while retaining the original PR ancestry for a non-force branch update. * commit 'ff35145de21cf6296bec05e86bee37b5ed53bcb8': fix(test): verify followup completion ordering * test(auto-reply): signal queued presentation entry * chore: refresh followup test on boundary fix * commit '622be54be3ffe0fce27d6a4b147c76d4b19c528c': (70 commits) fix(gateway): preserve typed boxed-number coercion chore(ui): refresh control ui locales (openclaw#158689) fix(gateway): reset staged headers on authority errors (openclaw#158669) fix(workers): keep inbound staging stable during quota scans fix: preserve Telegram delivery after bot identity changes (openclaw#158612) fix(ui): keep automation starter prompts out of startup (openclaw#158482) fix(cli): distinguish configuration read failures from invalid input (openclaw#158671) test: remove retired progress coercion suppression allowance refactor(gateway): schedule worker placement maintenance (openclaw#158662) fix(daemon): keep native service checks within their timeout (openclaw#154565) fix(test): restore gateway steering fixture contracts (openclaw#158478) fix(acpx): use SDK filesystem publication boundary fix(agentsapi): load OpenClaw persona and workspace context (openclaw#158328) fix(gateway): drop progress snapshot coercion suppression fix(qa): accept native Codex truncation in cache evidence (openclaw#158454) fix(gateway): keep chat subscriptions stable during unrelated approvals (openclaw#158633) perf(gateway): release event payloads from live text guards (openclaw#158643) perf(sessions): reduce stalls when saving large chat messages (openclaw#158402) fix(qa): reject history-bearing utility requests without session affinity (openclaw#158496) test: allow intentional progress snapshot coercion ... Co-authored-by: Vincent Koc <[email protected]>
What Problem This Solves
Fixes: chat message subscriptions repeat approval queries or fail during approval activity in unrelated sessions.
User Impact
Concurrent chat viewers can subscribe without unrelated approval changes discarding their shared replay. Relevant approval changes and revoked access still prevent stale acknowledgements. No configuration, permissions, schema, or migration changes are required.
Why This Change Was Made
Approval replay used one global publication revision, so every lifecycle event invalidated every in-flight replay. Revisions now follow the exact session audience and reviewer binding. Each caller retains that scope until its response or failure, then releases it; completed snapshots are not cached. Expiry reconciliation, durable writes, and authorization checks keep their existing owners and ordering.
Evidence
UNAVAILABLEunder unrelated approval publications. With the fix, 64 concurrent subscribers share one pending-approval read and all receive the expected 200 approvals.da8149b8ba7d. Both repairs are incorporated. The subscription production and test files remain byte-identical to the tested revision; exact-head hosted CI passed: 124 successful jobs, 20 inapplicable jobs skipped, no failures (run 36219893761).47a9e77007f7(41.7 s command wall), which contains merge commit970de8701da3.Test cost
Measured with
pnpm test <file> --maxWorkers=1on macOS/Node 26.9.0:src/gateway/operator-approval-session-events.test.tssrc/gateway/server-methods/sessions.messages-subscribe-approvals.test.tssrc/gateway/server-methods/sessions.messages-subscribe-perf.test.tsCommand wall time includes the repository's worker preparation and transformation. The existing database-backed owner suite preserves durable approval transitions and waiter reconciliation; the existing stress test now covers 64 subscribers and unrelated publications rather than adding a duplicate suite. Hosted CI completed in 880 seconds of total run wall time. The run did not publish per-file timing artifacts; this is whole-run time, not time attributed to these three files.