fix: resolve tsconfig.json via realpath to avoid bun fd mismatch#1239
Open
richkuo wants to merge 1 commit intoanthropics:mainfrom
Open
fix: resolve tsconfig.json via realpath to avoid bun fd mismatch#1239richkuo wants to merge 1 commit intoanthropics:mainfrom
richkuo wants to merge 1 commit intoanthropics:mainfrom
Conversation
GitHub-hosted runners place actions at symlinked paths under _actions/<owner>/<action>/<ref>/. When GITHUB_ACTION_PATH is passed directly to --tsconfig-override, bun's internal file descriptor tracking reports "Internal error: directory mismatch for directory .../tsconfig.json, fd N" because the path bun re-resolves after opening the fd differs from the original path (due to the symlink). Resolving the tsconfig path with realpath before passing it to bun gives bun a canonical path from the start, eliminating the mismatch. Closes anthropics#1234
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.
Summary
Fixes the Bun
Internal error: directory mismatch for directory ".../tsconfig.json", fd Nreported in #1234 by resolving the tsconfig path withrealpathbefore passing it to--tsconfig-override.Root cause
GitHub-hosted runners place actions at paths like
/home/runner/work/_actions/<owner>/<action>/<ref>/, where<ref>(e.g.v1) is typically a symlink to the actual SHA-named directory. When${GITHUB_ACTION_PATH}/tsconfig.jsonis passed to bun as-is, bun opens the file via the symlinked path but stores fd metadata keyed by the canonicalized path. On subsequent lookups bun sees a path mismatch and logs the internal error.Pre-resolving with
realpathgives bun a canonical path up front, so the fd's stored path and the lookup path agree.Changes
action.yml: wrap each of the 3 occurrences of--tsconfig-override="${GITHUB_ACTION_PATH}/tsconfig.json"with$(realpath ...).realpathis part of coreutils and is always available onubuntu-latestrunners.Test plan
@claudeon a PR with the patched action ref and confirm the bun internal error no longer appears in logs.Closes #1234
Generated with: Claude Opus 4.7 (1M) | Effort: medium