Repository navigation
fix: source builds fail when declaring the shared stream observer - #185050
fuller-stack-dev merged 1 commit into
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. |
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]>
047d157 to
019f408
Compare
|
Codex review: needs maintainer review before merge. What this changesThis PR replaces the observer’s ES2024 promise helper with an equivalent ES2023-compatible promise and adds workspace declaration compilation to CI artifact builds. Example: Run pnpm build on main containing the shared stream observer.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review Keep open: this PR repairs a current source-build regression and closes the CI coverage gap that missed it; no introduced correctness or security defect was found. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe build orchestrator turns workspace sources into runtime bundles and declarations; the shared observer is compiled through the AI package’s declaration graph and used by Responses transport and model diagnostics. flowchart LR
A[Workspace sources] --> B[Build orchestrator]
B --> C[AI declarations]
B --> D[Workspace declarations]
C --> E[Runtime compilation]
D --> E
E --> F[Artifact validation]
Technical reviewBest possible solution: Land the ES2023-compatible observer repair with declaration checks owned by the existing build orchestrator. Do we have a high-confidence way to reproduce the issue? The ES2023 declaration configuration and current-main Promise.withResolvers call establish the failure path, corroborated by reported full-build failures in this PR and earlier reports; no target code was executed during review. Is this the best way to solve the issue? The patch uses existing owners, preserves observer semantics and other build profiles, and adds focused coverage for the declaration-program boundary without widening shared compiler libraries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a9abf368ccf1. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +6, Tests +31, Docs +1, Other +4. Total +42 across 5 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 26, 2026, 5:47 PM ET / 21:47 UTC. |
|
Merged via squash.
|
…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.
Related: #184797, #181799, #184969
What Problem This Solves
Fixes:
pnpm build(and therefore source updates) fails onmainsince #184797 when thepackages/aideclaration step compilesobserveAsyncIterator, withTS2550: Property 'withResolvers' does not exist on type 'PromiseConstructor'.User Impact
User impact:
mainbuilds again, and source-update candidates no longer fail their preflight build. PR CI now fails when a package declaration program cannot compile, instead of leaving it to the next full build.Why This Change Was Made
Package declaration programs use
tsconfig.packages.jsonwith the ES2023 library.observeAsyncIteratornow captures its queued resolvers locally, the same repair as #165479 and #181806. Runtime behavior is unchanged.This is the third recurrence in a month. PR CI could not see it for two reasons:
tsgo:corechecks every package in one program./// <reference lib="es2024.promise" />inpackages/worker-runtimeis program-global there, soPromise.withResolverstype-checks in every package.ciArtifactsbuild that PR CI runs left out thetsdown-aiandtsdown-packagesdeclaration steps. Only release-dispatchpnpm buildcompiled each package's own declaration program.ciArtifactsnow runs both declaration producers before the runtime pass, in the same order as the full build. It forces declarations on so an inherited skip cannot silently disable the check. On a cold local cache the two steps take about 55 s, and they keep their existing build-all cache.I left the shared library level alone. Raising it to ES2024, as #184969 tried, also flows into the Control UI program, which #167980 keeps free of post-Chromium-114 APIs. It would not stop the next newer API from slipping through the same gap either.
Evidence
Base
f1bf17df378, macOS arm64, Node 24.22.1, pnpm 12.15.0, project-local virtual store.pnpm buildfails intsdown-aiwith TS2550 atpackages/llm-core/src/utils/observe-async-iterator.ts.pnpm buildpasses (4m 22s).tsdown-ai8.4 s,tsdown-packages42.2 s. After rebasing ontoec34584e091, which still has the failing call,pnpm buildon the exact PR head also passes (4m 42s).build-artifactsjob passed; its log shows notsdown-ai/tsdown-packagesstep.tsc --explainFilesontsconfig.core.jsonshowslib.es2024.promise.d.tsadmitted only viapackages/worker-runtime/src/retained-operation.tsandworker-task-server.ts.ciArtifactsprofile with the oldobserve-async-iterator.tsfails attsdown-aiwith the same TS2550 (exit 1, 8.2 s).ciArtifactsprofile passes, 4m 20s cold (OPENCLAW_BUILD_CACHE=0), against 3m 03s for the old profile.test/scripts/build-all.test.ts: 55 passed. The new case fails against the old profile and passes with this change. It checks that both declaration compilers run with declarations enabled despite an ambientOPENCLAW_RUN_NODE_SKIP_DTS_BUILD=1, and that a failing declaration program stops the build with its exit code before the runtime pass.observe-async-iterator.test.ts, which compares queued overlapping reads, FIFO order and async context against a real generator, and its consumers (openai-responses-stream-observer-internal.test.ts,attempt.model-diagnostic-events.iterator.test.ts): passed. One existing conditional skip in the transport file is untouched.test/scripts/build-all-ownership.test.ts,pnpm tsgo:core,pnpm tsgo:scripts,oxfmt --check,oxlinton the changed files: passed.This PR's own CI run is a cold
ciArtifactsbuild, since it touchesscripts/build-all.mts. Its[build-all] phase timingsline shows the added cost on CI hardware.Codex autoreview could not run: the configured API route failed authentication. A separate independent review found no correctness issues. It flagged the cold-path cost above and two CI docs that describe what
ciArtifactsproduces; both docs are updated here.I read all of
test/scripts/build-all.test.tsfor the test audit. No helper, fixture or import became unused, and nothing was removed. The existing ciArtifacts heap test still covers every child invocation, including the new ones.🤖 Generated with Claude Code