Skip to content

fix(worker): keep shared environment deletes out of property caches - #52

Merged
steipete merged 1 commit into
mainfrom
claude/fix-shared-env-delete-cache
Oct 1, 2026
Merged

steipete merged 1 commit into
mainfrom
claude/fix-shared-env-delete-cache

Conversation

@steipete

@steipete steipete commented Oct 1, 2026 •

Copy link
Copy Markdown

Hot delete process.env[key] and Reflect.deleteProperty(process.env, key) calls could return true after SHARE_ENV promotion while leaving the variable visible to other workers. This regressed in #42: promotion retained JSEnvironmentVariableMap, whose structure lacked the property-cache prohibition already used by JSSharedEnvMap.

Add that guard to the retained environment class, preserving cached process.env/Bun.env identity and routing optimized deletes through the shared store. The guard adapts the same change in the open upstream PR oven-sh#38871; thanks @robobun. New direct/Reflect tests warm absent-key deletion and verify the result from an independent worker, the cached parent reference, own-property lookup, and enumeration. No OpenClaw test expectations or service/migration guards change.

Native Linux x64 proof: the three standalone owner-key repros pass Node 24.21.0, fail a fresh 6ea7ca5a2c build, pass with only #42 reverted, and pass with this patch on fork main. Both new regression modes pass Node 24 and fail unpatched Bun on macOS arm64 and Linux x64. The patched modes pass on Linux. Surrounding worker, transfer-list, process, Windows-environment proxy, and CLI environment suites pass 387 tests with 6 platform skips. The first process-suite invocation lacked test dependencies; installing the repository's test dependencies resolved its import error. Formatting, JS lint, and independent Codex review at P2 pass.

Each OpenClaw file ran alone against the same frozen source, with Node 24 orchestration, one Bun worker, and private HOME/state/temp directories:

Consumer file Unpatched Patched
src/gateway/test-helpers.server-env.test.ts 14 pass / 1 fail 15 pass
src/infra/state-migrations.caller-mode.storage.test.ts 8 pass / 4 fail 12 pass
src/cli/update-cli/update-command-post-update.test.ts 77 pass / 11 fail 88 pass

The exact CI merge binary for sync PR #51 at head 66f26177e8 still fails all three standalone repros. Its affected environment sources are unchanged. The newer #51 head 65512c7aa3 only adjusts literal-hash module keys; its environment implementation and WebKit pin are unchanged relative to the tested head. This PR does not modify #51 and is not merged.

The native build-and-test lane is green on head 37719a2637: all 22 selected files passed, including the new worker regressions. Format, JS lint and source lints are green. The separate Claude automation check fails before review because its required authentication is absent.

Preserve the in-place SHARE_ENV identity fix while ensuring optimized delete sites still remove entries from the shared environment store. Cover direct and Reflect deletion with an independent observing worker.

Adapts the property-cache guard from oven-sh#38871; thanks @robobun.
@steipete
steipete merged commit a73f7f5 into main Oct 1, 2026
6 of 7 checks passed
@steipete
steipete deleted the claude/fix-shared-env-delete-cache branch October 1, 2026 14:46
steipete added a commit to steipete/bun that referenced this pull request Oct 12, 2026
Keep JIT-warmed direct and Reflect deletes connected to the SHARE_ENV
backing store while preserving cached process.env and Bun.env references.
Port the regression coverage from openclaw#52; the property-cache
guard also appears in oven-sh#38871 by robobun.

Merge current upstream main to resolve the existing branch conflict,
retaining inherited-receiver writes. Both new modes fail at the prior
PR head and pass Node 24.21.0 and the candidate. The Windows proxy
inspector also follows the shared store after promotion, with coverage
for subsequent writes and deletes. Linux worker, environment, and
process coverage passes 352 tests with 6 existing skips.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant