[GH-ISSUE #159] fix(native): retry failed Xcrun tool resolution instead of caching permanent failures #106

Closed
opened 2026-10-15 18:21:13 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @morluto on GitHub (Jul 14, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/159

Symptom

XcrunCommandRunner caches resolution attempts in #resolved before the result is known to have succeeded.
If the first resolution attempt for a tool fails (e.g. transient xcrun failure, temporary IO error, or tool path not yet available), that rejected result is memoized and reused for the same tool on later calls.

Evidence

  • src/native/CommandRunner.ts:100-104 stores resolveTool(tool) in this.#resolved immediately and returns cached promise on subsequent calls.
  • resolveTool can return err(new NativeCommandFailure(...)) for transient failures (captureProcess failure, non-absolute path, realpath/hash failure).
  • Cached map entries are never evicted or refreshed in failure paths.

Impact

A temporary outage, path race, or transient xcrun issue can permanently downgrade native inspections for that tool until process restart, even after conditions recover.

Suggested fix

Cache only successful resolutions (and maybe successful tool metadata), or remove failed cache entries and allow controlled retries/backoff for later calls.

Originally created by @morluto on GitHub (Jul 14, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/159 ## Symptom `XcrunCommandRunner` caches resolution attempts in `#resolved` before the result is known to have succeeded. If the first resolution attempt for a tool fails (e.g. transient `xcrun` failure, temporary IO error, or tool path not yet available), that rejected result is memoized and reused for the same tool on later calls. ## Evidence - `src/native/CommandRunner.ts:100-104` stores `resolveTool(tool)` in `this.#resolved` immediately and returns cached promise on subsequent calls. - `resolveTool` can return `err(new NativeCommandFailure(...))` for transient failures (`captureProcess` failure, non-absolute path, `realpath/hash` failure). - Cached map entries are never evicted or refreshed in failure paths. ## Impact A temporary outage, path race, or transient xcrun issue can permanently downgrade native inspections for that tool until process restart, even after conditions recover. ## Suggested fix Cache only successful resolutions (and maybe successful tool metadata), or remove failed cache entries and allow controlled retries/backoff for later calls.
bsakaguchi 2026-10-15 18:21:13 +00:00
  • closed this issue
  • added the
    bug
    label
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#106
No description provided.