fix(work): wire inline macOS keychain hint into dispatch + decompose error paths

The dispatch.mjs + decompose.mjs error handlers grew an image-not-
found hint in cd0a332 but the macOS keychain hint that the earlier
commit's message claimed wasn't actually applied (the Edit tool
required re-reading those files post-commit).

This commit applies the keychain hint to both error handlers: when
the sandcastle error matches /Not logged in|Please run \/login/ AND
process.platform === "darwin", the dispatcher prints the
`security find-generic-password ... > ~/.claude/.credentials.json`
one-liner + chmod 600 + the API-key fallback inline above the
generic "See runbook" line.

Now future agents hitting this on macOS see the fix at the failure
site, not just in docs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-13 18:03:13 +02:00
parent 7737358509
commit 9d4b801909
2 changed files with 35 additions and 0 deletions

View File

@@ -163,6 +163,26 @@ export async function executeDecompose(prdId, prdPath, prdText) {
});
} catch (e) {
console.error("✗ Decomposer dispatch failed:", e.message);
if (/Image '.+' not found locally/.test(e.message ?? "")) {
console.error(
" One-time setup: pnpm exec sandcastle docker build-image",
);
}
if (
/Not logged in|Please run \/login/.test(e.message ?? "") &&
process.platform === "darwin"
) {
console.error(
" macOS users: Claude Code stores credentials in the Keychain, not in ~/.claude/. Extract once:",
);
console.error(
` security find-generic-password -s "Claude Code-credentials" -a "$USER" -w > ~/.claude/.credentials.json`,
);
console.error(" chmod 600 ~/.claude/.credentials.json");
console.error(
" OR fall back to API key: export ANTHROPIC_API_KEY=sk-ant-...",
);
}
console.error(
" See docs/guides/runbook.md → 'Using Sandcastle' for setup.",
);

View File

@@ -239,6 +239,21 @@ async function executeDispatch() {
" One-time setup: pnpm exec sandcastle docker build-image",
);
}
if (
/Not logged in|Please run \/login/.test(e.message ?? "") &&
process.platform === "darwin"
) {
console.error(
" macOS users: Claude Code stores credentials in the Keychain, not in ~/.claude/. Extract once:",
);
console.error(
` security find-generic-password -s "Claude Code-credentials" -a "$USER" -w > ~/.claude/.credentials.json`,
);
console.error(" chmod 600 ~/.claude/.credentials.json");
console.error(
" OR fall back to API key: export ANTHROPIC_API_KEY=sk-ant-...",
);
}
console.error(
" See docs/guides/runbook.md → 'Using Sandcastle' for setup.",
);