Repository navigation
fix(setup): recognize plugin hooks reported through a symlinked CODEX_HOME - #134
behruznassre wants to merge 1 commit into
Conversation
…_HOME pathIsInsideRoot compared ROOT_DIR with path.resolve(sourcePath), which does not follow symlinks. When a second Codex profile links its plugins dir to the shared cache, hooks/list reports the alias path, every cc hook fails the containment check, and setup reports found=0 and asks the user to trust hooks that are already trusted. Canonicalize both sides with the existing canonicalPath helper from codex-paths.mjs. Hooks from real files outside the plugin root stay rejected. Fixes sendbird#133 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 00c75583ca
ℹ️ 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".
| // An alternate CODEX_HOME whose plugins dir symlinks to the shared cache: | ||
| // hooks/list reports the alias path, the companion runs from the real path. | ||
| const aliasRoot = path.join(testEnv.rootDir, "alias-plugin-root"); | ||
| fs.symlinkSync(PROJECT_ROOT, aliasRoot, "dir"); |
There was a problem hiding this comment.
Use a junction for the Windows directory alias
On native Windows without Developer Mode or CreateSymbolicLink privilege, fs.symlinkSync(..., "dir") throws EPERM before this test enters its try/finally, so the repository-required npm run check now fails on an otherwise supported platform and leaves the temporary test environment behind. Use a junction on win32, as the existing cross-platform symlink tests do.
AGENTS.md reference: AGENTS.md:L3-L3
Useful? React with 👍 / 👎.
Summary
pathIsInsideRoot()resolves symlinks on bothROOT_DIRand the hook'ssourcePathbefore the containment check, so setup now counts hooks that Codex reports through a symlinkedCODEX_HOMEcanonicalPathfromscripts/lib/codex-paths.mjs(now exported), the samerealpathSync.native-with-fallback thatresolvePluginCacheInstallInfoalready usesRoot cause
path.resolvedoes not follow symlinks. When a second profile'spluginsdir links to the shared cache,hooks/listreports<alt CODEX_HOME>/plugins/cache/sendbird/cc/<ver>/hooks/hooks.jsonwhile the companion runs from the canonical cache path. The lexicalpath.relativecheck fails for every cc hook,foundis 0, and setup tells the user to trust hooks that/hooksalready shows as trusted.Validation
setup recognizes trusted plugin hooks reported through a symlinked plugin root: the fakehooks/listreports three trusted cc hooks through a symlink toPROJECT_ROOT, plus one untrustedcc@sendbirdhook from a real file outside itmain(19e5651) it fails withfound: 0, the same output as the real installationfound: 3("already trusted (3)"), and nohooks.statewrite happens, so the outside-root hook is not trustednpm run check: unit 514 passed, integration 46 passed, Codex E2E 23 passed; lint, typecheck, version-sync and changelog OKFixes #133
🤖 Generated with Claude Code