fix: disable bg-pty-host factory via native chunk source rewrite - #260
fix: disable bg-pty-host factory via native chunk source rewrite#260bash0816 wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b0603dfc16
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const stdioMapped = Array.isArray(stdioArrayRaw) | ||
| ? stdioArrayRaw.map(normalizeStdio) | ||
| : [normalizeStdio(opts.stdin), normalizeStdio(opts.stdout), normalizeStdio(opts.stderr)]; | ||
| const child = _realChild.spawn(cmdArray[0], cmdArray.slice(1), { |
There was a problem hiding this comment.
Route Bun.spawn through the update guard
When the upstream bundle uses the new Bun.spawn shim to launch an npm/pnpm/yarn/npx update path, this delegates straight to the real child_process.spawn instead of the guarded child-process wrapper that blocks official self-updates. That creates a second process-spawning API which bypasses native-update-guard.js, so the same command blocked through require('child_process') can run if reached through Bun.spawn; build the shim on the guarded child process object instead.
Useful? React with 👍 / 👎.
| child.on('exit', (code, signal) => resolveExited(code !== null ? code : (signal ? 128 : 0))); | ||
| child.on('error', () => resolveExited(1)); |
There was a problem hiding this comment.
Wait for stdio close before resolving spawned output
When a spawned command writes stdout that can still be draining after the process exits, resolving exited from the child exit event lets stdout.text() return before the stdout pipe has emitted all data. Since Node's close event is the point where stdio streams are closed, this can truncate output for Bun.spawn(...).stdout.text() callers; resolve the text reader after stdout/child close rather than just process exit.
Useful? React with 👍 / 👎.
b0603df to
5b9e025
Compare
Upstream released 2.1.222 while the 220-3 fix (bg-pty-host factory disable via native chunk source rewrite) was still awaiting G4. Rather than chase the intermediate 2.1.221, rebase the fix onto the 2.1.222 intake and republish the wrapper as 2.1.222-1. Verified the existing regex-based rewrite still matches exactly once against the real 2.1.222 native bundle (offsets 256895476/279849039) and that the patched factory function returns undefined, using the production rewriteNativeChunkSource() from both helper and bootstrap branches.
5b9e025 to
25ef6fb
Compare
Summary
dYs()(bg-pty-host用PTYファクトリ関数)のバンドルソース自体を書き換えundefinedを返すようにすることで、doSpawn()のif (!this.spawnPty)分岐を確実に発火させ、upstream既存の安全な終端経路(settle("crashed")、respawnなし)に乗せる。Test plan
claude -p非退行・background/fleet job 2種のcrashed確定・respawnなし確認(ユーザー本人実施予定)