fix: prefer root secret sources from tool worktrees (#732)

Co-authored-by: Codex <codex@noreply.local>
This commit is contained in:
Lyon
2026-06-23 10:56:58 +08:00
committed by GitHub
parent 09e9f10b84
commit 9a3c71ee6d
+6 -2
View File
@@ -6505,10 +6505,14 @@ function readLocalPostgresPasswordMaterial(input: { sourceRef: string; sourceKey
}
function localSecretSourcePaths(sourceRef: string): string[] {
const paths = [join(repoRoot, ".state", "secrets", sourceRef)];
const marker = "/.worktree/";
const index = repoRoot.indexOf(marker);
if (index >= 0) paths.push(join(repoRoot.slice(0, index), ".state", "secrets", sourceRef));
const paths = index >= 0
? [
join(repoRoot.slice(0, index), ".state", "secrets", sourceRef),
join(repoRoot, ".state", "secrets", sourceRef),
]
: [join(repoRoot, ".state", "secrets", sourceRef)];
return [...new Set(paths)];
}