From 421f7f0600deb225f2695e173303b2769c424684 Mon Sep 17 00:00:00 2001 From: Dotta Date: Sat, 10 Oct 2026 10:59:29 -0500 Subject: [PATCH] Resolve Boat input readiness in the desktop user context Co-Authored-By: Paperclip --- server/src/modules/computers/adapters/boat.test.ts | 4 ++-- server/src/modules/computers/adapters/boat.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/modules/computers/adapters/boat.test.ts b/server/src/modules/computers/adapters/boat.test.ts index 22096cee50b..22593d9e0b3 100644 --- a/server/src/modules/computers/adapters/boat.test.ts +++ b/server/src/modules/computers/adapters/boat.test.ts @@ -397,11 +397,11 @@ describe("Boat desktop input readiness", () => { mkdirSync(runtime, { mode: 0o700 }); mkdirSync(bin); if (initiallyHealthy) writeFileSync(healthy, "ready"); - writeFileSync(join(bin, "ibus"), "#!/bin/sh\nprintf '%s\\n' 'unix:path=/test/ibus'\n", { mode: 0o700 }); + writeFileSync(join(bin, "ibus"), "#!/bin/sh\ntest \"$HOME\" = /home/user && test \"$XDG_CONFIG_HOME\" = /home/user/.config && test \"$XDG_CACHE_HOME\" = /home/user/.cache || exit 1\nprintf '%s\\n' 'unix:path=/test/ibus'\n", { mode: 0o700 }); writeFileSync(join(bin, "gdbus"), `#!/bin/sh\ntest -f '${healthy}'\n`, { mode: 0o700 }); writeFileSync(join(bin, "ibus-daemon"), `#!/bin/sh\nprintf '%s\\n' "$*" >> '${calls}'\ntouch '${healthy}'\n`, { mode: 0o700 }); const call = (program = desktopReadinessProgram) => spawnSync("python3", ["-c", program.replaceAll("/run/user/", `${temp}/`)], { - encoding: "utf8", env: { ...process.env, PATH: `${bin}:${process.env.PATH}` }, + encoding: "utf8", env: { ...process.env, HOME: join(temp, "agent-home"), XDG_CONFIG_HOME: join(temp, "agent-config"), XDG_CACHE_HOME: join(temp, "agent-cache"), PATH: `${bin}:${process.env.PATH}` }, }); return { temp, runtime, healthy, calls, call }; } diff --git a/server/src/modules/computers/adapters/boat.ts b/server/src/modules/computers/adapters/boat.ts index 9e436b56a3a..bf3af1f9b1d 100644 --- a/server/src/modules/computers/adapters/boat.ts +++ b/server/src/modules/computers/adapters/boat.ts @@ -26,7 +26,7 @@ import os,sys,json,stat,fcntl,subprocess,time uid=os.getuid();runtime='/run/user/'+str(uid) st=os.lstat(runtime) if not stat.S_ISDIR(st.st_mode) or st.st_uid!=uid:raise RuntimeError('invalid desktop runtime directory') -env={**os.environ,'DISPLAY':':0','XAUTHORITY':'/home/user/.Xauthority','DBUS_SESSION_BUS_ADDRESS':'unix:path='+runtime+'/bus','XDG_RUNTIME_DIR':runtime,'IBUS_ENABLE_SYNC_MODE':'0'} +env={**os.environ,'HOME':'/home/user','XDG_CONFIG_HOME':'/home/user/.config','XDG_CACHE_HOME':'/home/user/.cache','DISPLAY':':0','XAUTHORITY':'/home/user/.Xauthority','DBUS_SESSION_BUS_ADDRESS':'unix:path='+runtime+'/bus','XDG_RUNTIME_DIR':runtime,'IBUS_ENABLE_SYNC_MODE':'0'} env.pop('IBUS_ADDRESS',None) def healthy(): try: