From da65322f4fecaf195b9133351406712b37af2613 Mon Sep 17 00:00:00 2001 From: Alexzhu Date: Tue, 2 Jun 2026 13:01:13 +0800 Subject: [PATCH] fix(codex): compare strict preflight paths by realpath (#3060) Co-authored-by: Steven Enamakel --- scripts/codex-pr-preflight.mjs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/scripts/codex-pr-preflight.mjs b/scripts/codex-pr-preflight.mjs index 3d5a0a851..6d697c409 100755 --- a/scripts/codex-pr-preflight.mjs +++ b/scripts/codex-pr-preflight.mjs @@ -41,6 +41,22 @@ function runCheck(label, ok, details = '') { return { label, ok, details }; } +function sameFilesystemPath(left, right) { + let resolvedLeft; + let resolvedRight; + try { + resolvedLeft = fs.realpathSync(left); + } catch { + resolvedLeft = path.resolve(left); + } + try { + resolvedRight = fs.realpathSync(right); + } catch { + resolvedRight = path.resolve(right); + } + return resolvedLeft === resolvedRight; +} + function summarize(checks) { const failed = checks.filter((check) => !check.ok); for (const check of checks) { @@ -75,7 +91,7 @@ function main() { checks.push(runCheck('working directory exists', fs.existsSync(repoRoot), repoRoot)); if (options.strictPath) { - checks.push(runCheck('expected repo path', path.resolve(repoRoot) === path.resolve(options.expectedPath), `expected ${options.expectedPath}, got ${repoRoot}`)); + checks.push(runCheck('expected repo path', sameFilesystemPath(repoRoot, options.expectedPath), `expected ${options.expectedPath}, got ${repoRoot}`)); } for (const file of REQUIRED_FILES) {