Skip to content

Auto-fix CI failures for PR #1375 - #1381

Closed
github-actions[bot] wants to merge 3 commits into
prefix-affinity-session-monitoringfrom
claude-fix-pr-1375-30714760553
Closed

Auto-fix CI failures for PR #1375#1381
github-actions[bot] wants to merge 3 commits into
prefix-affinity-session-monitoringfrom
claude-fix-pr-1375-30714760553

Conversation

@github-actions

@github-actions github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the Docker Build Test job failure in the PR Build Check workflow (run 30714661886) for PR #1375.

  • Adds a markAsUncloneable no-op polyfill on node:worker_threads so undici >= 8 can be imported under Bun during the Docker build stage.
  • Imports the polyfill as a side effect in the /v1 and /v1beta proxy route entry points (right after the existing @/lib/polyfills/file import), ahead of any transitive undici import.

Root cause

The failing error is:

TypeError: s.util.markAsUncloneable is not a function

during next build page-data collection for /v1/[...route].

  • undici 7.x's lib/web/webidl shipped a safe fallback: webidl.util.markAsUncloneable = markAsUncloneable || (() => {}).
  • undici 8.x removed the fallback and destructures directly: const { markAsUncloneable } = require('node:worker_threads').
  • node:worker_threads.markAsUncloneable is a Node.js 23+ API that Bun's JSC runtime does not implement, so under Bun the destructured binding is undefined and constructing any undici Web API object throws.
  • The Docker build stage runs bun run build on oven/bun:debian, which is why CI hit this while local Node builds did not.

This regression originates from dev's dependency bump in #1376 (undici: ^7 -> ^8.9.0). It is not caused by anything in PR #1375's own code.

Verification

  • bun run typecheck (tsgo) — clean
  • bun run lint (biome) — clean (2 pre-existing biome.json deprecation infos, unrelated)
  • bun run lint:fix — no fixes applied
  • bun run build with undici 8.9.0 installed (the exact failing scenario) — exit 0, route table renders /v1/[...route] and /v1beta/[...route] successfully
  • git diff --check — clean

The polyfill guard (typeof ... !== "function") ensures the real Node.js markAsUncloneable is used unchanged in production; the no-op only applies where the API is missing (the Bun build stage), matching the previous undici 7.x behavior exactly.

Notes for review — repo-wide regression on dev

The undici ^8.9.0 bump (dev commit 519c605, #1376) breaks the Bun-based Docker build repo-wide: dev's own "PR Build Check" is currently failing on the same error (run 30712055253, "release v0.9.1"). This PR unblocks #1375 in isolation, but the underlying dependency incompatibility should ideally be resolved on dev as well (a separate auto-fix branch, claude-fix-pr-1379-30714202270, applies the same polyfill approach for another affected PR).

This polyfill is a safe, surgical workaround with no behavior change and no dependency-version change, so it will not conflict with dev's undici: ^8.9.0 on merge.

Test plan

  • bun run typecheck passes
  • bun run lint / lint:fix pass
  • bun run build passes with undici 8.9.0 (reproduces and resolves the CI failure)
  • PR Build Check workflow passes on this branch

Greptile Summary

The PR adds a guarded node:worker_threads.markAsUncloneable compatibility polyfill and loads it before the proxy routes’ undici dependency graph.

  • Adds a no-op fallback only when the native API is unavailable.
  • Applies the compatibility setup to both /v1 and /v1beta route entrypoints.
  • Preserves native behavior on runtimes that already implement the API.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete changed-code failure identified.

The guarded shim leaves native implementations unchanged, and the affected Node.js route entrypoints evaluate it before their undici-dependent proxy modules.

Important Files Changed

Filename Overview
src/lib/polyfills/worker-threads.ts Adds a guarded import-time compatibility shim for runtimes lacking worker_threads.markAsUncloneable.
src/app/v1/[...route]/route.ts Loads the worker-threads shim before the /v1 proxy route’s undici-dependent imports.
src/app/v1beta/[...route]/route.ts Loads the same shim before the /v1beta proxy route’s undici-dependent imports.

Reviews (1): Last reviewed commit: "fix(build): polyfill markAsUncloneable f..." | Re-trigger Greptile

Context used:

ding113 and others added 3 commits August 2, 2026 01:37
undici >= 8 destructures markAsUncloneable from node:worker_threads without
a fallback. Bun (the Docker build stage runtime) does not implement this
Node.js 23+ API, so webidl.util.markAsUncloneable is undefined and next build
crashes during page-data collection for the /v1 and /v1beta proxy routes.

Add a side-effect polyfill that defines markAsUncloneable as a no-op when it
is missing, restoring the safe fallback that undici 7.x shipped. The guard
ensures the real Node.js implementation is used unchanged in production.

Verified: bun run build passes with undici 8.9.0 installed (the failing
scenario). typecheck and lint clean.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: de49db97dc

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@@ -1,4 +1,5 @@
import "@/lib/polyfills/file";
import "@/lib/polyfills/worker-threads";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Load the undici polyfill before legacy action imports

When the Bun/undici>=8 workaround is needed, limiting this side-effect import to /v1//v1beta still leaves the legacy actions route unpatched: src/app/api/actions/[...route]/route.ts imports @/actions/providers at module load, which pulls @/lib/proxy-agent and imports undici before markAsUncloneable is installed. The Docker build runs bun run build, so after /v1 is fixed it can still hit the same webidl.util.markAsUncloneable crash while evaluating /api/actions; move/import the polyfill from a shared server bootstrap or add it ahead of those action imports too.

Useful? React with 👍 / 👎.

@ding113
ding113 force-pushed the prefix-affinity-session-monitoring branch from cf80980 to e4d7030 Compare August 1, 2026 20:43
@ding113 ding113 closed this Aug 2, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Claude Code Hub Roadmap Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant