Skip to content

fix(gateway-client): build pending stop without Promise.withResolvers - #165479

Merged
steipete merged 1 commit into
mainfrom
fix/gateway-client-pending-stop-es2023
Oct 5, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/gateway-client-pending-stop-es2023

Conversation

@steipete

@steipete steipete commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

#165340 replaced the gateway-client pending-stop helper with Promise.withResolvers. That is the first production use of it in the repository: the workspace package declaration build (tsdown-packages, rolldown dts) compiles against the root tsconfig.json lib ES2023, which has no withResolvers, so pnpm build fails on current main:

packages/gateway-client/src/client.ts@23157: error TS2550: Property 'withResolvers' does not exist on type 'PromiseConstructor'.
[build-all] tsdown-packages failed after 17.4s

The Team deployer (openclaw-release-deploy) builds every candidate with pnpm build, so every deployment of current main aborts before cutover (round 50, 2026-10-05 09:22Z, unit team-round50-deploy-20261005-091920). PR CI did not catch it because the package dts build is not part of the PR lanes.

User Impact

pnpm build and every release or deployment built from main work again. No runtime behavior change: the pending-stop contract (ws, promise, resolve, terminateTimer) is unchanged.

Why This Change Was Made

Creating the promise explicitly (the shape used before #165340, kept inline) is the smallest change that compiles against the ES2023 lib the package build uses. Lifting the root lib to ES2024 (Node 22 already has withResolvers) or adding the package dts build to a PR lane are reasonable follow-ups, but both are toolchain changes that should land on their own.

Evidence

  • Reproduced by the Team deployer build log (TS2550 above, round 50 unit journal on team-metal).
  • Full pnpm build of this branch on the rig node (the same command the deployer runs) is linked in a comment once it finishes.

#165340 introduced Promise.withResolvers in the gateway-client package. The
package declaration build compiles against the repository's ES2023 lib, so
tsdown-packages fails with TS2550 and pnpm build (the Team deployer) aborts
before cutover. Create the pending-stop promise explicitly again.
@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete enabled auto-merge (squash) October 5, 2026 09:29
@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 5, 2026, 5:38 AM ET / 09:38 UTC (Revision 2).

ClawSweeper review

What this changes

The PR constructs the Gateway client's shutdown promise explicitly so its package declarations can compile against ES2023.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

This remains a necessary, focused build repair: current main still uses an API absent from its declared ES2023 library. No introduced correctness defect was found.

Priority: P1
Reviewed head: a4494c416842aff7dd6cc7decab29ed8a78f6916

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A narrow, behavior-preserving repair with no actionable finding; after-fix declaration-build success remains unverified.
Proof confidence 🌊 off-meta tidepool Not applicable: Verified repository-admin authorship exempts this PR from external-contributor proof. The changed contract is Gateway client declaration compilation; the supplied deployment trace establishes the before-fix failure, while after-fix build success remains unverified. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Verified repository-admin authorship exempts this PR from external-contributor proof. The changed contract is Gateway client declaration compilation; the supplied deployment trace establishes the before-fix failure, while after-fix build success remains unverified. No stored-data contract changes.
Evidence reviewed 7 items Pinned introduced change: The patch changes only promise construction. The Promise executor assigns the resolver synchronously before PendingStop is installed; socket-close settlement, forced termination, repeated shutdown, and accepted-storage draining retain their existing behavior.
Current-main necessity: The fetched main revision still calls Promise.withResolvers<void>() in beginStop. The repair is therefore not already present in the reviewed current-main context.
Compiler and build contract: Root tsconfig.json selects ES2023. The root build includes tsdown-packages, and the Gateway client uses the declaration-producing workspace package configuration. This matches the captured PR body's TS2550 failure and reported deployment abort before cutover.
Findings None None.
Security None None.

How this fits together

The Gateway client connects OpenClaw consumers to the Gateway over WebSocket. Its shutdown promise coordinates socket cleanup, and its source feeds the published package declaration build.

flowchart TD
  A[Shutdown request] --> B[Gateway client]
  B --> C[Create shutdown promise]
  C --> D[Socket closes or termination timer fires]
  D --> E[Resolve shutdown wait]
  C --> F[ES2023 declaration build]
  F --> G[Published client package]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +4. Total +4 across 1 file.

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

Review metrics

None.

Technical review

Best possible solution:

Keep explicit promise construction in the existing shutdown owner, preserving ES2023 compilation and socket-settlement behavior.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: the declaration build includes Promise.withResolvers under the ES2023 library, matching the supplied TS2550 trace. This read-only review did not execute the build.

Is this the best way to solve the issue?

Yes. Explicit promise construction removes the compiler-contract mismatch without raising the language-library target or changing shutdown semantics.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 13c1d87f6df4.

Labels

Label changes:

  • add P1: The source-supported package declaration-build regression reportedly aborts real deployment candidates before cutover, beyond ordinary PR check failures.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Verified repository-admin authorship exempts this PR from external-contributor proof. The changed contract is Gateway client declaration compilation; the supplied deployment trace establishes the before-fix failure, while after-fix build success remains unverified. No stored-data contract changes.

Label justifications:

  • P1: The source-supported package declaration-build regression reportedly aborts real deployment candidates before cutover, beyond ordinary PR check failures.
  • 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: Verified repository-admin authorship exempts this PR from external-contributor proof. The changed contract is Gateway client declaration compilation; the supplied deployment trace establishes the before-fix failure, while after-fix build success remains unverified. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced change: The patch changes only promise construction. The Promise executor assigns the resolver synchronously before PendingStop is installed; socket-close settlement, forced termination, repeated shutdown, and accepted-storage draining retain their existing behavior. (packages/gateway-client/src/client.ts:602, a4494c416842)
  • Current-main necessity: The fetched main revision still calls Promise.withResolvers<void>() in beginStop. The repair is therefore not already present in the reviewed current-main context. (packages/gateway-client/src/client.ts:602, 13c1d87f6df4)
  • Compiler and build contract: Root tsconfig.json selects ES2023. The root build includes tsdown-packages, and the Gateway client uses the declaration-producing workspace package configuration. This matches the captured PR body's TS2550 failure and reported deployment abort before cutover. (tsconfig.json:10, a4494c416842)
  • Prior implementation and area history: The raw recorded parent and commit patch show the earlier explicit-promise helper being replaced by Promise.withResolvers in the merged async cleanup at refactor(async): deslop bounded waits and retry ownership #165340. This repair retains that cleanup's inline ownership rather than restoring the removed helper. File history also records prior merged contributions from Peter Steinberger. (packages/gateway-client/src/client.ts, 2faa6a047fc2)
  • Existing settlement coverage: Existing tests cover a socket closing during stop without forced termination and a lingering socket settling stopAndWait after termination. These were inspected as supplemental source evidence; no tests or builds were executed. (src/gateway/client.test.ts:709, a4494c416842)
  • Trusted author and re-review continuity: GitHub verifies steipete has repository admin permission, resolving the differing author-association values in the supplied context. The previous review had no findings and explicitly described attaching the promised declaration-build result as optional. The inspected discussion still contains no after-fix build result; that remains a useful rank-up rather than an external-contributor proof blocker.

Likely related people:

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

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach the promised package declaration-build result for the reviewed head.

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 (1 earlier review cycle)
  • reviewed 2026-10-05T09:31:36.209Z sha a4494c4 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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. labels Oct 5, 2026
@steipete
steipete merged commit 926d7a1 into main Oct 5, 2026
115 of 117 checks passed
@steipete
steipete deleted the fix/gateway-client-pending-stop-es2023 branch October 5, 2026 09:40
@steipete

steipete commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Build proof on the rig node (openclaw-node-01, same pnpm build the Team deployer runs, branch head a4494c4):

[build-all] phase timings: total 8m 16.8s; slowest tsdown-packages 4m 18.2s; tsdown-unified (failed) 3m 8.4s; tsdown-ai 35.8s; plugins:assets:build 14.4s

tsdown-packages, the phase that failed on main with TS2550, completes with this change. The later tsdown-unified failure on the rig is the 30 GB box OOM-killing tsc (kernel log: Out of memory: Killed process (tsc) anon-rss:6525992kB), not a code failure; the Team deployer build of the merged main (round 50 attempt 2) is the production proof and is linked in the perf ledger.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 6, 2026
…openclaw#165479)

openclaw#165340 introduced Promise.withResolvers in the gateway-client package. The
package declaration build compiles against the repository's ES2023 lib, so
tsdown-packages fails with TS2550 and pnpm build (the Team deployer) aborts
before cutover. Create the pending-stop promise explicitly again.
fuller-stack-dev added a commit to fuller-stack-dev/openclaw that referenced this pull request Oct 26, 2026
The packages/ai declaration program compiles observeAsyncIterator under the
ES2023 library, so Promise.withResolvers fails `pnpm build` with TS2550.
Capture the queued resolvers locally, as openclaw#165479 and openclaw#181806 did.

PR CI could not see this class of failure: tsgo:core admits the
`/// <reference lib="es2024.promise" />` directives in worker-runtime for
every package, and the ciArtifacts profile skipped the package declaration
producers. Run tsdown-ai and tsdown-packages in ciArtifacts ahead of the
runtime pass, with declarations forced on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fuller-stack-dev added a commit that referenced this pull request Oct 26, 2026
…85050)

The packages/ai declaration program compiles observeAsyncIterator under the
ES2023 library, so Promise.withResolvers fails `pnpm build` with TS2550.
Capture the queued resolvers locally, as #165479 and #181806 did.

PR CI could not see this class of failure: tsgo:core admits the
`/// <reference lib="es2024.promise" />` directives in worker-runtime for
every package, and the ciArtifacts profile skipped the package declaration
producers. Run tsdown-ai and tsdown-packages in ciArtifacts ahead of the
runtime pass, with declarations forced on.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 27, 2026
…enclaw#185050)

The packages/ai declaration program compiles observeAsyncIterator under the
ES2023 library, so Promise.withResolvers fails `pnpm build` with TS2550.
Capture the queued resolvers locally, as openclaw#165479 and openclaw#181806 did.

PR CI could not see this class of failure: tsgo:core admits the
`/// <reference lib="es2024.promise" />` directives in worker-runtime for
every package, and the ciArtifacts profile skipped the package declaration
producers. Run tsdown-ai and tsdown-packages in ciArtifacts ahead of the
runtime pass, with declarations forced on.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 High-priority user-facing bug, regression, or broken workflow. 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