Skip to content

fix: source builds fail when declaring the shared stream observer - #185050

Merged
fuller-stack-dev merged 1 commit into
openclaw:mainfrom
fuller-stack-dev:fix/package-lib-es2023-guard
Oct 26, 2026
Merged

fuller-stack-dev merged 1 commit into
openclaw:mainfrom
fuller-stack-dev:fix/package-lib-es2023-guard

Conversation

@fuller-stack-dev

Copy link
Copy Markdown
Member

Related: #184797, #181799, #184969

What Problem This Solves

Fixes: pnpm build (and therefore source updates) fails on main since #184797 when the packages/ai declaration step compiles observeAsyncIterator, with TS2550: Property 'withResolvers' does not exist on type 'PromiseConstructor'.

User Impact

User impact: main builds 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.json with the ES2023 library. observeAsyncIterator now 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:core checks every package in one program. /// <reference lib="es2024.promise" /> in packages/worker-runtime is program-global there, so Promise.withResolvers type-checks in every package.
  • The ciArtifacts build that PR CI runs left out the tsdown-ai and tsdown-packages declaration steps. Only release-dispatch pnpm build compiled each package's own declaration program.

ciArtifacts now 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.

  • Red, unmodified base: pnpm build fails in tsdown-ai with TS2550 at packages/llm-core/src/utils/observe-async-iterator.ts.
  • Green, this branch: pnpm build passes (4m 22s). tsdown-ai 8.4 s, tsdown-packages 42.2 s. After rebasing onto ec34584e091, which still has the failing call, pnpm build on the exact PR head also passes (4m 42s).
  • Gap: perf(agents): share stable stream observers #184797's PR build-artifacts job passed; its log shows no tsdown-ai/tsdown-packages step. tsc --explainFiles on tsconfig.core.json shows lib.es2024.promise.d.ts admitted only via packages/worker-runtime/src/retained-operation.ts and worker-task-server.ts.
  • Guard red: the new ciArtifacts profile with the old observe-async-iterator.ts fails at tsdown-ai with the same TS2550 (exit 1, 8.2 s).
  • Guard green: the new ciArtifacts profile 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 ambient OPENCLAW_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, oxlint on the changed files: passed.

This PR's own CI run is a cold ciArtifacts build, since it touches scripts/build-all.mts. Its [build-all] phase timings line 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 ciArtifacts produces; both docs are updated here.

I read all of test/scripts/build-all.test.ts for 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

@clawsweeper

clawsweeper Bot commented Oct 26, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts labels 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
fuller-stack-dev force-pushed the fix/package-lib-es2023-guard branch from 047d157 to 019f408 Compare October 26, 2026 21:30
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

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

  • Before: The AI declaration compiler fails with TS2550 because ES2023 libraries omit Promise.withResolvers.
  • After: The observer compiles without raising the shared library baseline, and CI artifact builds also check the package declaration programs.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-supported repair with reported production-build validation and green exact-head checks.
Proof confidence 🐚 platinum hermit (4/6) This maintainer-authored PR is outside the contributor proof gate; its body reports macOS arm64 full-build success and cold CI-artifact red/green validation of the changed declaration path, supported by successful exact-head CI, although raw job logs could not be retrieved through the allowed hosts.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Developers and source-update operators cannot build current main because package declaration compilation rejects the shared stream observer.
Reason: The maintainer-authored direction restores a necessary build path and addresses repeated escapes using existing compiler and cache owners; the additional CI compilation cost is explicitly acknowledged.

Regression provenance

Possible 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
Reviewed head: 019f408458dec168f058ca48045bf64893c52ff1

Before merge

None.

Findings

None.

Agent review details

How this fits together

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

Technical review

Best 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

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Current-main failure remains: Fetched main still calls Promise.withResolvers in the observer, while tsconfig.packages.json inherits the root ES2023 library setting and tsdown.ai.config.ts uses that configuration. (packages/llm-core/src/utils/observe-async-iterator.ts:42, a9abf368ccf1)
  • Verified introduced repair: The pinned introduction diff captures promise resolvers synchronously without changing FIFO scheduling, settlement, cleanup, or either consumer’s policy. (packages/llm-core/src/utils/observe-async-iterator.ts:42, 019f408458de)
  • Existing build owners reused: ciArtifacts now selects the existing cached tsdown-ai and tsdown-packages producers before runtime compilation; cold compilation overrides an ambient declaration skip, while validated cache hits retain their existing reuse behavior. (scripts/build-all.mts:194, 019f408458de)
  • Original CI tradeoff considered: perf(ci): skip global declaration emission in the CI artifacts build #108949 deliberately omitted global declarations to shorten CI. This maintainer-authored PR explains the repeated escaped failures and accepts additional package compilation while preserving the SDK-only global declaration path. (scripts/build-all.mts:250, 019f408458de)
  • Reported production-entry validation: The PR body records failing unmodified full builds, successful patched full builds, and a cold ciArtifacts negative control that fails with the old observer and passes with the replacement; existing iterator and consumer suites are also reported passing. (019f408458de)
  • Exact-head checks and mergeability: Complete pagination shows 65 successful, 44 skipped, and one neutral check, with no unfinished or failed check; all three commit statuses succeed, and GitHub reports the reviewed head cleanly mergeable. (019f408458de)

Likely related people:

  • Vincent Koc: Raw commit 4e1447e adds scripts/build-all.mts:85 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4e1447e18665; files: scripts/build-all.mts)

PR surface

Source +6, Tests +31, Docs +1, Other +4. Total +42 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 9 3 +6
Tests 1 31 0 +31
Docs 2 4 3 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 1 14 10 +4
Total 5 58 16 +42

Labels

Label changes:

  • add P1: Current main cannot complete full source builds, causing source-update candidate preflight to fail.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P1: Current main cannot complete full source builds, causing source-update candidate preflight to fail.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 26, 2026, 5:47 PM ET / 21:47 UTC.

@fuller-stack-dev
fuller-stack-dev merged commit 40b2953 into openclaw:main Oct 26, 2026
123 checks passed
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

@fuller-stack-dev
fuller-stack-dev deleted the fix/package-lib-es2023-guard branch October 26, 2026 22:10
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

docs Improvements or additions to documentation P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: S 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