Repository navigation
fix(gateway): keep slow catalogs from blocking other session sources - #155114
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. |
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 5:15 PM ET / 21:15 UTC. ClawSweeper reviewWhat this changesThe PR serializes foreground session discovery per provider, preserves concurrency across providers, updates scheduling documentation and regression fixtures, and moves the Matrix Doctor test onto the shared process helper. Merge readiness✅ Ready for maintainer review This fix remains useful: current main and the latest release still allow one slow provider to occupy every admission slot. No blocking introduced defect was found, and CI passed for the reviewed head. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway gathers session lists from plugin-provided catalogs for clients. Its admission queue controls when provider work runs before results and progress updates reach each authorized caller. flowchart TD
A[Client session-list requests] --> B[Gateway catalog selection]
B --> C[Provider-aware admission queue]
C --> D[One active step per provider]
D --> E[Catalog provider work]
E -->|More steps| C
E --> F[Current visibility checks]
F --> G[Results and progress updates]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +11, Tests +98, Docs +6. Total +115 across 14 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep provider fairness in the existing admission owner while preserving bounded work, cancellation settlement, and current per-caller visibility checks. Do we have a high-confidence way to reproduce the issue? Yes, from source: four unsettled same-provider lists consume current main's four global slots and prevent a healthy provider from starting. The PR supplies a focused regression; this read-only review did not execute it. Is this the best way to solve the issue? Yes. Extending the existing queue provides provider fairness without a second scheduler, and the tests retain the relevant cancellation, continuation, sharing, and privacy contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 14f8ec46c133. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…penclaw#155114) * fix(gateway): keep slow catalogs from blocking other session sources * test(gateway): preserve catalog proofs with provider serialization * test(matrix): use the shared Doctor process fixture
What Problem This Solves
Fixes healthy session catalogs waiting behind repeated requests to a slow catalog provider. Four remote-node waits could occupy the entire shared queue's execution capacity.
User Impact
Other catalog providers can publish their results and serve provider-specific requests while the slow provider is still waiting. Requests to the same provider run one foreground step at a time, so independent requests to that provider may wait longer under load. An aggregate request still waits for every selected provider. No schema, configuration, permission, or timeout changes are required.
Why This Change Was Made
The existing admission owner now allows one active foreground step per provider ID within the existing four-step global limit and 32-step queue. It starts the oldest eligible queued step, preserves each provider's FIFO order, and keeps cancelled work admitted until its native promise settles. Multi-step continuations retain their queue reservation and original request context. Provider fanout and background-publication ownership are unchanged.
Evidence
The new timer-free provider-boundary regression failed on the original code because the healthy provider never started while four slow requests were held; it passes with this change. All 98 focused tests across the nine changed test files pass, including cancellation, overflow, scope retention, lifecycle retirement, request sharing, progress delivery, and current privacy checks. Three additional catalog suites also passed.
A separate synthetic benchmark held four requests to one provider for 500 ms: another provider started after 501.40 ms before the change and 0.44 ms afterward. This measures local admission, not production response latency. The candidate has not been deployed to a live Gateway.
Measured single-worker command wall times: list-admission 3.18 s; provider-access 2.94 s; provider-steps 3.87 s; owner-steps 46.65 s. The existing RPC-owner fixture spends most of its 46.65 s in cold worker compilation and source transformation; its four test bodies took 40 ms in total. This change only updates that fixture to use distinct provider IDs and adds no Gateway boot or timer.
The first CI run exposed existing fixtures that required concurrent foreground calls from one provider. Those fixtures now use distinct providers for global-cap saturation or the existing stepped-list contract for bounded progress. They retain the original sharing, privacy, cancellation, and publication assertions. The real Gateway proof still holds a request across 128 completed queries and verifies follower progress. No assertions were suppressed and no timeouts increased.
Additional single-worker command wall times: provider diagnostics 9.04 s; progress 53.21 s; privacy 110.73 s; real Gateway sharing 104.45 s; native registration 24.63 s. These are existing suites; the change adds no Gateway boot or timer.
Independent review completed. A reported abort-settlement issue was rejected: the existing post-step
signal.throwIfAborted()rejects before queuing a continuation. A direct held-successor probe confirmed the aborted caller settles while its same-provider successor remains unresolved. There are no accepted unresolved findings.The complete changed checks and focused follow-up checks passed. In CI run 35647111450, all 98 catalog tests passed. Hosted test-body totals by changed file were: list-admission 0.022 s; provider-access 0.021 s; provider-steps 0.016 s; owner-steps 0.040 s; diagnostics 0.020 s; progress 0.172 s; privacy 25.386 s; Gateway sharing 1.059 s; native registration 1.095 s (27.831 s total).
That run failed two existing process-heavy fixtures outside the catalog path. The Matrix Doctor fixture bypassed the shared CLI child-process owner, omitting its Node compiler safeguards, diagnostic capture, and cleanup time reservation. It now uses that existing owner through the private repository-only test facade. The real Doctor/data/archive assertions and outer 120-second test budget are unchanged. Independent review and the affected type, lint, formatting, import-boundary, SDK surface/export, and repository guards passed. The original 11-file shard passes all 99 tests with the correction (95.350 s wall; Doctor body 59.078 s); the required single-file command passes in 64.282 s wall (body 40.210 s, cold worker preparation 11.554 s). The unchanged original shard also passed locally, so this establishes the fixture policy correction, not the cause of the original hosted timeout. The corrected-head Matrix test also passed in hosted CI in 58.754 seconds (job 106504842324).
The other failure was the managed-worktree large-index GC fixture's 60-second child-process deadline. Its original 56-file shard passed all 1,184 tests in the same order locally (652.049 s wall). Passive observation showed the child continuing CPU/filesystem work and exiting naturally at roughly 59 seconds under contention. The fixture and owner match the tested head and current main. No safe causal repair was established; its code, timeout, and assertions remain unchanged. The unchanged GC fixture also passed on corrected-head hosted CI. Neither passing run proves the original failure resolved. Corrected-head CI run 35651367205 completed successfully: all 131 executed jobs passed, including the aggregate CI gate; 16 jobs were skipped.