Repository navigation
fix(gateway): keep concurrent session descriptions responsive - #155471
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. |
74c39bf to
50ee4d1
Compare
|
Codex review: needs maintainer review before merge. Reviewed September 22, 2026, 4:04 PM ET / 20:04 UTC (Revision 12). ClawSweeper reviewWhat this changesThe PR shares and bounds concurrent session-placement reads, preserves per-session freshness, and improves benchmark isolation and test cleanup. Merge readiness✅ Ready for maintainer review This remains a useful fix absent from current main. No blocking correctness or security findings remain, and the updated evidence addresses the prior test-cost request. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway prepares session metadata for descriptions and session events using placement facts read by a database worker. This projection coordinates those reads before current session information is presented to authorized clients. flowchart TD
A[Session descriptions and events] --> B[Placement preparation]
B --> C[Share or queue bounded reads]
C --> D[Database worker]
D --> E[Check session freshness]
F[Committed session changes] --> E
E --> G[Authorized session response]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +165, Tests +644, Other +1. Total +810 across 8 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep scheduling and freshness in the existing placement projection, with bounded shared reads and synchronous authorized response consumption. Do we have a high-confidence way to reproduce the issue? Yes, source establishes independent cold reads reaching bounded worker admission and unrelated publications invalidating otherwise usable reads; focused regressions exercise both paths. This read-only review did not execute a current-main reproduction. Is this the best way to solve the issue? Yes, the patch extends the existing projection owner, preserves atomic snapshots and private consumption frames, and avoids a competing cache or public configuration surface. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f0d26603a5c1. 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 (11 earlier review cycles; latest 8 shown)
|
35aa810 to
e2e45b5
Compare
e2e45b5 to
6058078
Compare
|
The remaining test-cost request is addressed in the PR's Evidence section. All four changed test files passed individually on current head @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
* commit 'ba4bc10ee5283f37813593da158cd3146f4cf2bf': (53 commits) fix(tests): drain persistence deliveries before fixture cleanup (openclaw#155934) fix(tests): drain Gateway abort deliveries before teardown (openclaw#155913) fix(test): give the bundled MCP tarball checks time on Windows runners (openclaw#155931) improve: explain where session catalog requests spend time (openclaw#155786) fix(test): recognize deletion cancellation in SQLite lifecycle proof test(gateway): join request lifetimes before fixture teardown test(codex): assert late-abort interrupt identity (openclaw#154853) fix(cron): avoid blocking Gateway during retention discovery (openclaw#155414) fix(tests): drain subagent deliveries before teardown (openclaw#155910) fix(ci): recover Security Review when diff data settles slowly (openclaw#155921) fix(ci): recover Security Review after checkout failures (openclaw#155919) fix(infra): retain SQLite reader modules in PR wrapper inventory ci: pack test jobs and add opt-in Spot cron routing (openclaw#155403) fix(gateway): retain approval authority across storage waits (openclaw#150237) test(media): isolate base64 memory accounting per VM (openclaw#155638) fix(gateway): keep concurrent session descriptions responsive (openclaw#155471) fix(test): await Talk storage cleanup before removing fixtures fix(tests): settle subagent steer work before teardown (openclaw#155888) test(ci): respect retained command worker caps (openclaw#155735) test(ui): synchronize release fixtures with owned lifetimes ...
…aw#155471) * fix(gateway): keep concurrent session descriptions responsive * fix(bench): use canonical gateway fixture paths * fix(bench): disable startup update checks through config * test(gateway): settle rollover hook work on assertion failure * test(gateway): join gated requests before fixture teardown * fix(gateway): bound retained placement read input * fix(ci): keep advisory shard limit private
What Problem This Solves
Fixes failed or delayed session descriptions when overlapping cold reads flood the shared placement reader, and avoids repeated reads caused by unrelated session updates.
User Impact
Concurrent descriptions and session-event snapshots reuse placement preparation while retaining current placement, move, and reconciliation facts. A keyed description can complete while an unrelated bulk refresh is held. No schema or configuration migration is required.
The projection now bounds retained ID input before worker capture: at most 128 batches and 256 MiB of conservative encoded-ID weight. This does not bound caller promises, result snapshots, resident rows, complete worker envelopes, or total heap. No production-wide CPU saving or elimination of all Gateway stalls is claimed.
Why This Change Was Made
The existing projection owner runs two physical reads, shares already-covered requests, and coalesces only a compatible FIFO tail up to 256 IDs / 64 KiB of weighted input. A larger individual read retains its atomic snapshot. Capacity counts batches rather than consumers, so hundreds of callers can share work. Reservations remain until physical settlement and the final consumer release. Per-session invalidation avoids discarding results for unrelated changes; exact/resident separation, original ID spelling, private consumption frames, and disposal remain intact.
The benchmark canonicalizes its temporary parent on macOS and disables startup update discovery through supported configuration. Reset/archive fixtures now release gates and join owned work after assertion failures and runner timeouts, without increasing deadlines. Acquired admission leases are released before dependent creation is joined. This preserves the ordinary cleanup semantics from #155751 and #155770 while adding fixture-owned timeout cleanup.
Evidence
e2e45b5through worker-overload rejection. The bounded candidate passes 13 tests in two files, covering 160 descriptions with large IDs, retained-batch refusal/recovery, FIFO, disposal, identity and freshness. A first baseline filter matched zero tests; it is explicitly excluded from proof.60580787c744eb6d8589a207c66d8efe4b9f35fdincorporates main814a7e75, including the canonical memory-fixture repair fix(tasks): throttle unchanged attempt activity #155745. All six production/test fixture postimages retain their reviewed bytes; the benchmark retains upstream activity-summary diagnostics. Dependencies were reconciled to the new lockfile. Final composition passes 239 cases across 12 files (five script cases skipped), and the complete selected gate passes in 959.98 seconds. Exact-head main CI is successful. The separate Workflow Sanity scanner-install failure passed its qualified single-job retry on attempt 2. No dependency pin or enforcement rule changed. Native recovery merged the exact reviewed head asa0838d92c34b8dbaa60474ca1bd93defd9a901a6; main ancestry and clean checkout are verified. The one-line advisory-export CI prerequisite had independently reached main before this merge and is not part of its net source change.All four changed test files passed individually on the current head with one worker and retries disabled. Command wall time includes startup/collection; case time sums rounded reported test durations.
src/gateway/session-row-placement-projection.lifecycle.test.tssrc/gateway/session-row-projection.prepared-read.test.tssrc/gateway/server.sessions.reset-hooks.test.tssrc/gateway/server.sessions.archive-worker-placement.test.tsThe two fixture files exceed 30 seconds of command wall time, while their reported case time stays below 30 seconds. They cover real registered session lifecycle, placement persistence and cleanup ownership; helper-only tests would miss those boundaries. These existing suites are retained, with no deadline or retry increase. Successful Linux CI reports the following rounded case-time sums and owning job wall times; it does not emit per-file startup/collection wall time. The reset/archive entries share one job, so its wall time is not additive.
session-row-placement-projection.lifecycle.test.tssession-row-projection.prepared-read.test.tsserver.sessions.reset-hooks.test.tsserver.sessions.archive-worker-placement.test.tsHistorical stress and unfavorable evidence
Before the final bounded-input and lease-order repairs, 20 standalone repetitions of each reset/archive fixture plus three original ordered 40-file Gateway groups passed: 2,710 test executions with retries disabled. Separate
e2e45b5composition passed 112 cases in nine files. Those runs cover their recorded earlier source, not the final candidate.The historical built replay used
74c39bf, not the current head: 1,000 sessions, 48 measured/16 warmup turns, 100 updates, 256 history reads and 64 probe rounds. Four task-list probes failed, 59/64 readiness observations were degraded, and all four catalog inventories reported refresh warnings. Sampled loop maxima were 366.5 ms during load and 806.9 ms during warmup, with a 3.130-second maximum probe-start gap. There is no completed matched baseline, so no improvement percentage is claimed.The earlier unbounded-input review finding is now repaired in this PR; its historical deferred disposition is superseded. Earlier compile-cache/model-publication failures remain unexplained after bounded non-reproduction. A previous native merge attempt stopped in a read-only policy fetch before dispatch. Its outcome and capture remain intact; qualified native recovery completed after current-head review and CI gates passed.