Repository navigation
fix(updater): identify the config-read child by env, not by import query - #158447
carlosjarenom wants to merge 1 commit into
Conversation
The generated io.runtime alias is both the reader spawner and its own entry, and told them apart by reading `openclaw-config-read` off its own import.meta.url. Node keeps that query across a dynamic import; Bun 1.4.2 drops it, so the child re-evaluated the update guard as the driver, re-entered the reader branch and forked the next child. One managed update from a Bun Gateway produced 8,462 descendants before the 300s verification budget expired, the update stalled, and the previous Gateway was stopped during activation with manual service recovery needed. The parent now marks the child in the env it already hands to the spawn, and the guard reads that marker. The marker is set and read within the same generated alias, so it introduces no cross-version coupling: an alias written by an older driver still works, and OPENCLAW_UPDATE_IN_PROGRESS keeps its existing role. The query can no longer be what identifies the reader, so the searchParams write that fed it is gone. The regression drives the real alias through buildUpdateConfigRuntimeAlias and drops the query at resolve time with module.registerHooks, reproducing the runtime difference Bun exhibits. A file-backed depth cap fails a regressed alias instead of forking an unbounded chain on a shared host. Without the fix it reports children=6 reads=0 candidate-config-read-failed; with it, exactly one reader subprocess. Refs openclaw#158339
|
🦞👀 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. |
|
Thanks for the context here. I did a careful shell check against current The requested Bun config-reader guard is already on current main through the merged, same-repository fix at #158451. That fix also handles Bun's synchronous result transport, and it shipped in v2026.9.7. This branch has no remaining distinct production behavior to land. I found the merged PR that appears to have closed this: #158451: fix(update): guard config-read children without import.meta.url queries and transport results without fd 3. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. So I’m closing this as already implemented rather than keeping a duplicate issue open. Review detailsBest possible solution: Retain the shipped guard and Bun result-transport repair, and close this competing branch. Do we have a high-confidence way to reproduce the issue? No failing current-main path remains: the merged guard and regression test cover the reported query-dropping mechanism. The related issue records the original Bun failure; this read-only review did not execute an update. Is this the best way to solve the issue? Yes. The merged fix keeps the child marker at the generated alias boundary, blocks nested launches, and repairs Bun's synchronous result transport. Security review: Security review cleared: The introduced patch changes an internal child marker and test harness without adding dependencies, secrets access, or a new authority path. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning medium; reviewed against db4b605b18bb; fix evidence: merged PR #158451, release v2026.9.7, commit 5836021e126c. |
| // Bun 1.4.2 drops the query of a dynamically imported module, so the reader is identified by an env | ||
| // marker its parent sets. A query-derived marker re-evaluates this guard as the driver and forks | ||
| // another reader, which is the unbounded chain behind #158339. | ||
| const updating = process.env.OPENCLAW_UPDATE_IN_PROGRESS === "1" && process.env.OPENCLAW_CONFIG_READ_CHILD !== "1"; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Cerrando como superseded. El fix de este PR quedó cubierto por el PR #158451 ( El issue #158339 está Cerrado sin más cambios: el diff no aporta comportamiento de producción distinto al que ya está en |
fix(updater): identify the config-read child by env, not by import query
Refs #158339
What Problem This Solves
A managed update started from a Bun Gateway spawns an unbounded chain of
config-read subprocesses. One report measured 8,462 descendants before the
300s verification budget expired. The update stalls, and the previous Gateway
gets stopped during activation, so the box needs manual service recovery.
Root cause
scripts/lib/update-config-runtime-compat.mtsgenerates anio.runtimealiasthat is both the reader spawner and the reader's own entry point. It
told those two roles apart by reading a query parameter off its own
import.meta.url:Node preserves that query across a dynamic
import(). Bun 1.4.2 does not.So under Bun the child re-evaluated the guard as the driver, fell into the
reader branch again, and forked the next child — which did the same. The chain
is self-sustaining, and only the outer verification budget ever stops it.
The fix
The parent already builds the child's environment in exactly one place
(
childEnv, shared byspawnSyncandspawn), so it now marks the childthere, and the guard reads that marker:
With the query no longer able to identify the reader, the
searchParams.setthat fed it is removed rather than left as dead code.
Why env and not a better query. The marker is written and read inside the
same generated alias, so this introduces no cross-version coupling — an alias
written by an older driver still works, and
OPENCLAW_UPDATE_IN_PROGRESSkeepsits existing role. No new cross-version marker is required on either side.
Regression test
test/scripts/update-config-runtime-compat.test.tsdrives the real aliasthrough
buildUpdateConfigRuntimeAlias, then reproduces the runtime differenceby stripping the query at resolve time with
module.registerHooks— the samedivergence Bun exhibits. That is the whole point of the test: it fails for the
reason the product fails, not because a mock was misconfigured.
The chain is bounded by a file-backed depth cap rather than a timer, so a
regressed alias fails fast instead of forking an unbounded chain on a shared
host.
The test is discriminante — verified in both directions:
candidate-config-read-failedThe control case passes in both states, which is what rules out the harness
producing a false positive.
Measured test wall time
446 ms of test time across 3 tests, ~3 s total wall. Baseline before
this change was 1 test / 295 ms. No real timers, sleeps, or polling are used.
Evidence - validation gates
check:changedlanes green, includingtsgo:scriptsNot run, stated plainly:
tsgo:test:rootwas not executed. It is the onelane I could not complete, and I am not going to imply otherwise. The change is
confined to a generated string in
scripts/plus a test file, and the lightlanes covering
scripts/did pass.What I did not verify
I have not run a real Bun Gateway update end to end, so I am not claiming
live-channel or real-device proof for this one. The test reproduces the
mechanism (query dropped across a dynamic import) directly rather than assuming
it, but a maintainer with a Bun host is in a much better position to confirm
the 8,462-descendant case is actually gone. I would rather flag that than
overstate it.
🤖 Generated with openclaw