fix: Make CODESPACE_NAME deterministic in the codespace agent worker (no-changelog) (#36231)

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Declan Carroll 2026-08-13 16:03:27 +01:00 committed by GitHub
parent 30aff5d740
commit c567279606
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View File

@ -51,6 +51,10 @@ for (const [k, v] of Object.entries({
}
}
// Not fatal, but box pinning needs it: without a box id every turn routes by
// owner, so a thread cannot follow the box holding its session.
if (!BOX_ID) console.error('CODESPACE_NAME is not set — box pinning disabled; turns route by githubUser only.');
function runClaude({ message, sessionId, cwd }) {
const safeCwd = resolvePath(typeof cwd === 'string' && cwd ? cwd : `${ROOT}/n8n`);
if (safeCwd !== ROOT && !safeCwd.startsWith(ROOT + sep))

View File

@ -28,3 +28,6 @@ services:
DB_POSTGRESDB_PASSWORD: password
# Prompt-cache TTL in seconds. 1 hour keeps the cache warm between turns.
ANTHROPIC_PROMPT_CACHE_TTL: "3600"
# Compose does not inherit the codespace env. Pass the box name through so
# the worker can stamp boxId and dev:up can print the forwarded URL.
CODESPACE_NAME: ${CODESPACE_NAME:-}