Skip to content

fix(update): guard config-read children without import.meta.url queries and transport results without fd 3 - #158451

Merged
steipete merged 1 commit into
mainfrom
upd/bun-config-read-recursion
Sep 26, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/bun-config-read-recursion

Conversation

@steipete

@steipete steipete commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes recursive config-reader spawning during managed updates launched from a Bun Gateway, and synchronous config reads losing their result under Bun.

Closes #158339

User Impact

Node and Bun updates can read the candidate configuration in one fresh child per handoff, including after rollback. No configuration change or new CLI option is needed. Optional read failures retain the existing warning and service-definition preservation behavior.

Why This Change Was Made

Bun drops the import URL query used to identify reader children, and Bun 1.4.2 omits extra pipe descriptors from spawnSync().output. The generated stable config alias now sets a child-only environment marker and rejects nested launches with candidate-config-read-recursion. Both synchronous and asynchronous readers use one byte-length-prefixed JSON frame on stdout, with ordinary console/stdout diagnostics redirected to stderr. The URL-query and fd-3 paths are deleted; there is no runtime branch.

Thanks @hannesrudolph for the report and bounded reproduction.

Evidence

  • The query-stripping regression fails before the guard fix and passes afterward: one runtime import, zero child spawns.
  • Official Bun 1.4.2, verified against the release checksum: synchronous and asynchronous handoffs pass with one child and one runtime import each, zero grandchildren, no marker leakage into the parent, diagnostic stdout, and Unicode result data. The same test failed on the former fd-3 transport.
  • Node owner suites, including candidate dependency replacement and rollback: 138 tests pass three times (Vitest wall 4.13 / 3.83 / 3.91 seconds). The focused config-runtime file takes 0.289–0.302 seconds of remote test time on the measured repeated runs; its local single-file wrapper proof took 6.33 seconds wall / 2.075 seconds test time.
  • Full Bun-enabled launcher suite: all 132 tests pass three times, with 19.654 / 20.384 / 19.644 seconds of test time and 21.28 / 22.10 / 21.55 seconds of command wall time.
  • node scripts/check-changed.mjs -- <four changed paths> passes all selected checks, including script/test-root typechecks and lint (307.12 seconds wall time).
  • Remaining eight importer/compatibility suites: 367 tests pass, one existing macOS-only plist scan skipped on Linux; 53.60 seconds command wall time. Together with the three owner/launcher files, this covers all 11 identified test importers/siblings in the recorded order.
  • Blacksmith Testbox tbx_01m3dedg53d5rkgsm79sb3r1pa, prepared runner, Node 24.19.0 and official Bun 1.4.2. Exact-head CI is attached and running; CI duration is pending completion.

Production/tooling: +24/−13 LOC (net +11). Tests: +160 LOC. Docs: +4 LOC.

Known gaps

Fresh Codex autoreview was attempted once and exited with codex engine failed (1) before producing a verdict. The helper truncated the diagnostic before its underlying error detail. Maintainer re-review is pending; no successful fresh review is claimed for the result-transport change.

Proof exercises the generated config handoff in isolated synthetic state; it does not claim a full managed-service update or live Gateway restart.

Replace the URL-query child guard with a child-scoped environment marker and
reject nested reader launches with candidate-config-read-recursion.

Use one byte-length-framed stdout result transport for synchronous and
asynchronous reads. Route ordinary stdout diagnostics to stderr and remove fd 3,
which Bun 1.4.2 omits from spawnSync output.

Preserve fresh candidate dependencies, rollback reads, and existing fail-soft
service-definition behavior. Fixes #158339; thanks @hannesrudolph for the report.
@clawsweeper

clawsweeper Bot commented Sep 25, 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 size: S labels Sep 25, 2026
@steipete
steipete marked this pull request as ready for review September 25, 2026 23:54
@clawsweeper clawsweeper Bot added P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 26, 2026
@clawsweeper

clawsweeper Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 25, 2026, 8:03 PM ET / September 26, 2026, 00:03 UTC.

ClawSweeper review

What this changes

The branch changes the updater’s generated config reader to prevent recursive Bun child launches and return synchronous and asynchronous results through framed stdout, with tests and update documentation.

Regression provenance

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

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep this PR open. Current main and the latest release retain the reported Bun-sensitive guard, and no merged fix supersedes this active repair.

Priority: P0
Reviewed head: c64442574d5b62f8c36661ca9ae1588bc4f3be31

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The repair is focused and has strong Bun boundary checks, but its shipped-updater compatibility remains unproven.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 7 items Current main still has the reported mechanism: The pinned main version identifies reader children through an import URL query and reads synchronous results from fd 3.
Latest release retains the guard: The v2026.9.6 source still checks the URL query and uses fd 3 for synchronous results.
Introduced repair: The introduced hunk replaces the query guard with a child environment marker and moves the response from fd 3 to framed stdout. The verified test merge applies these same four changed paths to pinned main.
Findings None None.
Security None None.

How this fits together

During an update, the installed updater reads configuration from the candidate package through a stable alias. That read informs later service verification and reconciliation.

flowchart LR
  A[Update request] --> B[Installed updater]
  B --> C[Candidate config alias]
  C --> D{Reader child?}
  D -->|No| E[Fresh Node or Bun child]
  D -->|Yes| F[Candidate config read]
  E --> F
  F --> G[Result or warning]
Loading

Before merge

  • Resolve merge risk (P1) - The real Bun tests exercise a synthetic candidate alias, but the PR does not yet show a published updater driving this candidate through package replacement and rollback. That upgrade handoff remains unverified.
  • Complete next step (P2) - Add a redacted terminal trace or recording of a published updater driving this candidate through Bun config reads and rollback, then update the PR body for re-review; if review does not restart, ask a maintainer to comment @clawsweeper re-review.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Tests +160, Docs +4, Other +11. Total +175 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 160 0 +160
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 1 24 13 +11
Total 4 188 13 +175

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: scripts/lib/update-config-runtime-compat.mts, unknown-data-model-change: scripts/lib/update-config-runtime-compat.mts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #158339
Summary: This PR is the open candidate repair for the linked Bun updater report.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Prove the shipped update handoff (recommended)
    Capture a published updater reading this candidate under Bun after replacement and after rollback, including the observed result or warning.

Technical review

Best possible solution:

Keep one generated alias responsible for bounded candidate config reads and diagnostic-safe results, while verifying its behavior when a shipped updater drives the upgrade.

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

Yes. The linked report provides a bounded Node/Bun query-marker probe and an observed managed-update failure, while current main retains the matching guard; this read-only review did not run the full update.

Is this the best way to solve the issue?

Yes, repairing the generated alias addresses the shared handoff boundary without a runtime-specific mode. Its published-updater upgrade behavior still needs proof.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b74bd07a2fb0.

Labels

Label changes:

  • add P0: The linked report observed thousands of recursive reader processes during a managed update and required operator service recovery.
  • add merge-risk: 🚨 compatibility: Shipped updaters consume the generated candidate alias, so changing its child guard and result channel needs an upgrade compatibility check.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp 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: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Label justifications:

  • P0: The linked report observed thousands of recursive reader processes during a managed update and required operator service recovery.
  • merge-risk: 🚨 compatibility: Shipped updaters consume the generated candidate alias, so changing its child guard and result channel needs an upgrade compatibility check.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Evidence

What I checked:

  • Current main still has the reported mechanism: The pinned main version identifies reader children through an import URL query and reads synchronous results from fd 3. (scripts/lib/update-config-runtime-compat.mts:68, b74bd07a2fb0)
  • Latest release retains the guard: The v2026.9.6 source still checks the URL query and uses fd 3 for synchronous results. (scripts/lib/update-config-runtime-compat.mts:68, eb377ac59e6c)
  • Introduced repair: The introduced hunk replaces the query guard with a child environment marker and moves the response from fd 3 to framed stdout. The verified test merge applies these same four changed paths to pinned main. (scripts/lib/update-config-runtime-compat.mts:73, c64442574d5b)
  • Boundary tests: The tests exercise query stripping, candidate dependency replacement, rollback, diagnostic output, and Unicode results; the Bun launcher test uses the generated alias in a synthetic package. (test/scripts/update-config-runtime-compat.test.ts:15, c64442574d5b)
  • Update proof policy: Repository policy requires a published-driver × candidate proof cell because the installed updater runs before candidate-side fixes can act. (AGENTS.md:83, c64442574d5b)
  • Proof scope: The PR body reports successful real Bun 1.4.2 handoffs through the generated alias and explicitly says it did not exercise a full managed-service update. The linked prepared Testbox run was cancelled; the exact-head Bun launcher CI job succeeded. (c64442574d5b)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rank-up moves

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

  • Add a published-driver × candidate upgrade trace covering Bun config reads after replacement and rollback.

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.

@steipete
steipete enabled auto-merge (squash) September 26, 2026 00:56
@steipete
steipete merged commit 5836021 into main Sep 26, 2026
171 of 172 checks passed
@steipete
steipete deleted the upd/bun-config-read-recursion branch September 26, 2026 00:56
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 26, 2026
…aw#158451)

Replace the URL-query child guard with a child-scoped environment marker and
reject nested reader launches with candidate-config-read-recursion.

Use one byte-length-framed stdout result transport for synchronous and
asynchronous reads. Route ordinary stdout diagnostics to stderr and remove fd 3,
which Bun 1.4.2 omits from spawnSync output.

Preserve fresh candidate dependencies, rollback reads, and existing fail-soft
service-definition behavior. Fixes openclaw#158339; thanks @hannesrudolph for the report.
roboclaw-bot added a commit that referenced this pull request Sep 27, 2026
Backport #158451 from 5836021.
Backport #158422 from 6ee9eb3.
Backport #158338 from 8c29090.

Use child-only config-reader admission and byte-framed stdout without changing
the frozen TypeScript generator contract. Preserve fresh dependencies,
operation-selected environments, diagnostics and rollback reads.

Compare Windows tasks using omitted-default semantics without inventing missing
triggers/principals or weakening explicit disable/deletion controls. Preserve
all existing CI list entries and add the new Windows regression once.

Exclude only incidental UUID-v4 Git transaction directories from plugin
inventory. Keep explicit dependencies, transaction bytes and existing promotion
rollback ordering intact; do not import newer streaming/lookup architecture.

All 13 integrated postimages match the independently reviewed worker tree.
Original failures reproduced; 42 focused tests and owning lint/ratchets pass.
Real Bun and Windows qualification remain open. The Bun E2E preflight did not
enter because the host's runtime-publication guard refused; no bypass occurred.
Publication remains held by the prepared PR size-policy decision.

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Josh Lehman <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vyctorbrzezowski <[email protected]>
Co-authored-by: steipete <[email protected]>
Co-authored-by: jalehman <[email protected]>
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 merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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.

[Bug]: Bun updater recursively spawns config readers when import.meta.url loses query marker

1 participant