Skip to content

feat: launcher self-healing for missing extracted modules + ENABLE_TOOL_SEARCH default false (2.1.251 payload 2+3) - #347

Merged
bash0816 merged 4 commits into
mainfrom
feat/claude-code-2.1.251-launcher-selfheal-toolsearch
Aug 30, 2026
Merged

feat: launcher self-healing for missing extracted modules + ENABLE_TOOL_SEARCH default false (2.1.251 payload 2+3)#347
bash0816 merged 4 commits into
mainfrom
feat/claude-code-2.1.251-launcher-selfheal-toolsearch

Conversation

@bash0816

Copy link
Copy Markdown
Owner

2.1.251 の launcher-only 変更 (payload 2+3)。native/manifest/config/package.json は 2.1.248 のまま未変更。

payload 2: チャンク欠落 self-heal

bunfs-esm-loader.mjsrecoverMissing() を追加。抽出済みモジュールが実行時に消えていた場合 (bunfs meta-require: missing extracted module) に、BunFS モジュール表から同一 process-owned dir へ同期再展開して回復する。対象パスが実際に不存在の場合のみ発火し、MODULE_NOT_FOUND 全般は隠さない。連続失敗3回で停止・3秒スロットル。helper/bootstrap 両経路に配線。

payload 3: ENABLE_TOOL_SEARCH 既定 false

未設定時のみ false を export (ユーザーの明示指定は上書きしない)。

ゲート

G1/G2/G3/G4 すべて Go (terra)。node --test lib/bunfs-esm-loader.test.js 23/23 pass。
terra G4 注記: これは launcher-only 先行マージの Go。upstream 2.1.251 publish/promote には別 PR の payload 1 (native/manifest 監査・バンプ) を束ねる必要がある。

bash0816 and others added 4 commits August 30, 2026 23:20
…ted modules (2.1.251 payload 2+3)

## Summary

Implement self-recovery mechanism for missing extracted modules in the ESM-chunked launcher:

### Payload 2: Loader self-healing
- Add recovery state tracking (REEXTRACT, consecutive failures, throttle)
- Implement recoverMissing() function with exponential backoff
- Apply recovery to 4 critical paths:
  - tryHoistCycleBreakingImports() path existence check
  - resolve() missing module detection
  - load() readFileSync ENOENT handling
  - __bunfsMetaRequire prelude error handling (3 branches)
- Recovery is guarded: only triggers on disk absence, not on internal module errors
- Throttled to 1 attempt per 3s to prevent cascading failures
- Capped at MAX_CONSEC_FAILURES=3 to prevent infinite loops

### Payload 3: Tool search override
- Export ENABLE_TOOL_SEARCH="${ENABLE_TOOL_SEARCH:-false}" from wrapper shell
- Defaults to "false" (standard mode), disabling dynamic ToolSearch
- Respects settings.json "force" value override
- Wire up reExtract callback to both esmChunkedMain copies in .sh

### Testing
- Added 10 new unit tests covering all recovery scenarios
- All 21 bunfs-esm-loader tests pass
- No regression in existing test coverage (pass count stable)

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@bash0816
bash0816 merged commit c9eb12e into main Aug 30, 2026
4 checks passed
@bash0816
bash0816 deleted the feat/claude-code-2.1.251-launcher-selfheal-toolsearch branch August 30, 2026 17:08
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