Repository navigation
fix(worker): preserve process.env identity when sharing environments - #42
Merged
Merged
Conversation
steipete
marked this pull request as ready for review
September 30, 2026 11:54
Coerce environment values before selecting the Windows backing store. Preserve symbol rejection and descriptor validation, including promotion during assignment or property definition. Exercise the actual Windows proxy on every platform and extend the native SHARE_ENV fixtures.
steipete
force-pushed
the
claude/fix-share-env-object-identity
branch
from
October 1, 2026 08:22
973a36c to
88cfa05
Compare
steipete
added a commit
that referenced
this pull request
Oct 1, 2026
) Regression from #42 (first bad commit; SHARE_ENV process.env identity): after SHARE_ENV promotion, JIT-cached property absence let hot delete/Reflect.deleteProperty on process.env bypass the shared store, so a worker kept seeing deleted keys. Prohibit property caching on the environment map (adapted from oven-sh#38871). Repro: test/js/node/worker_threads/fixture-share-env-delete.js (delete and reflect modes after 20k warm iterations). Fixes three OpenClaw suites that passed on 57fadf5 and failed on 6ea7ca5 (test-helpers.server-env, state-migrations.caller-mode.storage, update-command-post-update).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Preserve the original
process.envandBun.envobjects when the firstWorker({ env: SHARE_ENV })starts. Promotion previously installed a new object, leaving cached references pointed at an orphaned map and breaking shared mutations and environment cleanup.The original environment object now forwards to the shared backing store. Promotion removes its stale property slots, shared reads avoid value caching, and absent-property caching is disabled because workers can introduce keys. Windows retains its original proxy, prototype, and receiver behavior. Its common write path coerces values before choosing the backing store, so a
toString()that creates the first SHARE_ENV worker cannot lose an assignment or property definition. Symbol rejection and descriptor validation retain Node's ordering.Validation on macOS arm64, rebased onto
b02bb8a0c5:03020c996833, using private home/state/temp directories and the patched Bun explicitly. No test assertions or application guards were changed.88cfa05da7.The original before/after consumer proof found all 13 direct files passing after the identity fix. Across 78 direct/dependent files, 49 passed before and 77 after; the one unchanged failure contained three Node-executable fixture assumptions in
src/cli/node-cli/daemon.test.ts. That broader proof is historical and was not rerun for this Windows ordering follow-up.Upstream search found no exact identity-preservation fix. Related work includes oven-sh#40571 and oven-sh#39677; neither fixes this object replacement. No upstream patch was copied. All existing main changelog and compatibility-document entries were retained during the rebase.