From 2683209c22a5c57a3a65d6e824b1906e2477522a Mon Sep 17 00:00:00 2001 From: liuyi Date: Fri, 20 Nov 2026 10:36:56 +0800 Subject: [PATCH 1/2] fix(runtime): forward XDG_* into detached Pi workers Pi worker spawn used a minimal env that dropped XDG_CONFIG_HOME, so wrangler OAuth under ~/.config was invisible inside Runs even when the beacon serve wrapper had set it (Leaf publish / whoami not authenticated). --- .../daemon/src/runtime/pi-worker-lifecycle.ts | 34 +++++++++++++++---- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/services/daemon/src/runtime/pi-worker-lifecycle.ts b/services/daemon/src/runtime/pi-worker-lifecycle.ts index dbd655d..da7557d 100644 --- a/services/daemon/src/runtime/pi-worker-lifecycle.ts +++ b/services/daemon/src/runtime/pi-worker-lifecycle.ts @@ -397,16 +397,36 @@ export async function spawnDetachedPiWorker( ); } + // Forward XDG_* (and peer allowlisted keys) into detached Pi workers. + // buildPiEnvironment already inherits these from process.env for the Pi child, + // but only if the worker process itself still has them — the previous minimal + // env strip dropped XDG_CONFIG_HOME, so wrangler OAuth under ~/.config failed + // inside Runs while `beacon` serve (wrapper) still looked fine. + const workerEnv: NodeJS.ProcessEnv = { + PATH: process.env.PATH, + HOME: process.env.HOME, + USER: process.env.USER, + TMPDIR: process.env.TMPDIR, + LANG: process.env.LANG, + }; + for (const key of [ + "LOGNAME", + "SHELL", + "LC_ALL", + "TERM", + "COLORTERM", + "SSH_AUTH_SOCK", + "XDG_CONFIG_HOME", + "XDG_CACHE_HOME", + "GH_CONFIG_DIR", + ] as const) { + const value = process.env[key]; + if (value !== undefined) workerEnv[key] = value; + } const child = spawn(process.execPath, [workerMainPath, lifecycleDirectory], { detached: true, stdio: "ignore", - env: { - PATH: process.env.PATH, - HOME: process.env.HOME, - USER: process.env.USER, - TMPDIR: process.env.TMPDIR, - LANG: process.env.LANG, - }, + env: workerEnv, }); if (child.pid === undefined) { throw new Error("Failed to spawn detached Pi worker (no pid)"); From 0305e1fcde9ae12df3195d1d268db7fa737f43e1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 20 Nov 2026 02:37:17 +0000 Subject: [PATCH 2/2] ci: auto bump patch version --- apps/cli/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/cli/package.json b/apps/cli/package.json index 4be7d0b..17e1d31 100644 --- a/apps/cli/package.json +++ b/apps/cli/package.json @@ -1,6 +1,6 @@ { "name": "@nettee/beacon", - "version": "0.8.18", + "version": "0.8.19", "description": "A single-host bridge from messaging and schedules to isolated agent runs", "license": "Apache-2.0", "repository": {