Skip to content

test(gateway): await scope upgrade cancellation signals - #134091

Merged
steipete merged 3 commits into
mainfrom
codex/test-scope-upgrade-signals
Aug 31, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/test-scope-upgrade-signals

Conversation

@steipete

@steipete steipete commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

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

  • All four tests passed after merging main f81afb28435b5417ee88e49b52ffb46f217a5e76 into this branch. The refreshed commit is f44bcb7ba69bf8d384a02b81d3910188fb9dc442; the test diff is unchanged from the previous PR head.
  • Focused proof: 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.
  • The original local comparison reduced total test-body time from 181.4 ms to 26.7 ms. These are local observations, not a CI-wide benchmark.
  • The original full changed-file gate passed. This mechanical main refresh passed the focused proof, formatting, staged and base-relative diff checks, and fresh structured Codex autoreview at its configured P0 scope.
  • Production unchanged; tests +14/-5. Both one-second startup failure bounds remain, and both cancelled operations are awaited. Exact-head hosted CI remains required before landing.

@clawsweeper

clawsweeper Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 31, 2026
@clawsweeper

clawsweeper Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 9:48 AM ET / 13:48 UTC.

ClawSweeper review

What this changes

The PR makes the gateway scope-upgrade cancellation test await abort-listener registration and both cancellation rejections instead of polling request startup.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

No 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
Reviewed head: f44bcb7ba69bf8d384a02b81d3910188fb9dc442
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving test cleanup with source-aligned synchronization and no actionable defect found.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored, test-only PR changes no production behavior requiring contributor real-behavior proof; the reported focused Vitest run is supplemental validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored, test-only PR changes no production behavior requiring contributor real-behavior proof; the reported focused Vitest run is supplemental validation.
Evidence reviewed 6 items Introduced synchronization change: The pinned PR delta changes only the cancellation/restart test: it resolves a deferred only after registering the abort listener, bounds both waits, and awaits the restarted rejection.
Current-main comparison: Current main still uses vi.waitFor polling and detaches the restarted request rejection, so the PR's central test cleanup is not already implemented there.
Runtime-owner boundary: The production owner creates one active operation, clears it before aborting, and forwards the same signal to the indefinite gateway wait; the test now synchronizes at that registered-listener boundary.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Decision needed

Question Recommendation
Should this maintainer-labeled test-only PR be merged once required checks are green for its exact head? Merge after exact-head checks: Accept the deterministic test cleanup once the required checks for f44bcb7 pass.

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 merge

None.

Agent review details

Security

None.

PR surface

Tests +9. Total +9 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 14 5 +9
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 14 5 +9

Review metrics

Metric Value Why it matters
Production versus test LOC production 0, tests +9 net All 14 additions and 5 deletions are confined to the colocated test; runtime and public package behavior are unchanged.

Technical review

Best 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.

Labels

Label justifications:

  • P3: This is a low-risk test synchronization cleanup with no production behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored, test-only PR changes no production behavior requiring contributor real-behavior proof; the reported focused Vitest run is supplemental validation.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-31T12:14:55.806Z sha b85b175 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-31T12:33:28.968Z sha 4aac92c :: needs maintainer review before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Aug 31, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 31, 2026
@steipete
steipete marked this pull request as ready for review August 31, 2026 13:41
@steipete

Copy link
Copy Markdown
Contributor Author

Exact-head CI passed for f44bcb7ba69bf8d384a02b81d3910188fb9dc442: CI run 33398374563 and required openclaw/ci-gate.

node scripts/run-vitest.mjs packages/gateway-client/src/scope-upgrade.test.ts
{"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.

@steipete
steipete merged commit 328f3ef into main Aug 31, 2026
192 of 202 checks passed
@steipete
steipete deleted the codex/test-scope-upgrade-signals branch August 31, 2026 14:52
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 1, 2026
)

* test(gateway): await scope upgrade cancellation signals

* test(gateway): keep scope upgrade startup waits bounded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant