Repository navigation
test(gateway): await scope upgrade cancellation signals - #134091
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 9:48 AM ET / 13:48 UTC. ClawSweeper reviewWhat this changesThe PR makes the gateway scope-upgrade cancellation test await abort-listener registration and both cancellation rejections instead of polling request startup. Merge readinessNo introduced correctness defect was found. Current main still contains the polling and detached-rejection test shape, while this protected maintainer PR replaces it with lifecycle-bound synchronization; retain it for normal exact-head validation and maintainer merge judgment. Priority: P3 Review scores
Verification
How this fits togetherThe gateway client requests a temporary scope upgrade, waits for its terminal result, and can cancel then restart that wait. This test verifies that cancellation clears the active operation before a restart without changing client runtime behavior. flowchart LR
A[Gateway client] --> B[Scope upgrade request]
B --> C[Gateway wait request]
C --> D[Abort listener registered]
D --> E[Cancellation rejects wait]
E --> F[New scope upgrade request]
Decision needed
Why: The patch is narrow and correct, but the maintainer label and maintainer authorship require an explicit human merge judgment rather than automated cleanup. Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +9. Total +9 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep the cancellation test synchronized on registered abort-listener state and consume both cancelled operations, preserving the production client unchanged. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR improves test synchronization rather than reporting a user-facing failure. The PR body supplies a focused test run, and source inspection identifies the precise cancellation lifecycle it exercises. Is this the best way to solve the issue? Yes. Resolving the deferred after abort-listener registration directly observes the state produced by the wait request, avoids polling, and retains bounded failure diagnostics. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 145d9ffafa55. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Exact-head CI passed for {"numPassedTests":4,"numFailedTests":0,"numPendingTests":0,"success":true}All four cases pass. Both startup observations retain one-second bounds; readiness follows abort-listener registration, and both cancelled operations are awaited. Approval persistence, rejection/expiry, coalescing, cancellation and restart remain covered. The final diff matches the saved reviewed candidate byte for byte. The mechanical refresh passed focused execution, formatting/diff checks and scoped Codex autoreview with no actionable P0 issue. The original full changed gate passed and was not repeated for the unchanged diff. Latest ClawSweeper review (2026-08-31T13:48:55.385Z): The latest ClawSweeper review has no findings or Before merge repairs. Its explicit decision is normal maintainer acceptance after exact-head checks; the linked required check is now successful. Production +0/-0; tests +14/-5. Two startup polls are removed. The earlier 181.4 to 26.7 ms case-duration observation is historical local evidence, not a new or CI-wide timing claim. |
|
Merged via squash.
|
What Problem This Solves
The scope-upgrade cancellation test polls for request startup twice. It also abandons the restarted request's rejection instead of awaiting cleanup.
Why This Change Was Made
Resolve the shared deferred helper when the mocked request has registered its abort listener, then await that signal before cancelling. Await the restarted request's rejection too. This follows the actual lifecycle boundary and removes timer-driven polling. The existing timeout helper retains the former one-second request-start failure bound for both the initial request and its restart.
User Impact
No runtime change. All four cases retain approval storage before reconnect, rejection and expiry behavior, request coalescing, cancellation, and restart coverage.
Evidence
f81afb28435b5417ee88e49b52ffb46f217a5e76into this branch. The refreshed commit isf44bcb7ba69bf8d384a02b81d3910188fb9dc442; the test diff is unchanged from the previous PR head.node scripts/run-vitest.mjs packages/gateway-client/src/scope-upgrade.test.ts. The wrapper routed to the gateway-client configuration and passed one shard in 4.75 seconds, with zero failed or pending tests. The cancellation/restart case took 0.73 ms in this run.