Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

Merge branch 'pr-157' into integration/v0.4.5

Chaitanya Giriba477bc56113
diff --cc src/main/pty.ts
index 55d90214,c48fbf54..b5e6c4fb
--- a/src/main/pty.ts
+++ b/src/main/pty.ts
@@@ -614,26 -326,35 +614,67 @@@ export class PtyManager
spawnArgs = needsCmd
? buildCmdCommandLine(resolved, opts.args ?? [])
: (opts.args ?? []);
+ // The cmd.exe fallback is LOSSY and was previously SILENT, which is how a
+ // Windows agent could look perfectly healthy while never having received
+ // the hive protocol: cmd.exe cuts a multi-line argument at its first
+ // newline, and the whole protocol block rides on one such argument.
+ // resolveWindowsShimSpawn returns null for any shim shape it does not
+ // fully understand, so this path is reachable on a real machine while
+ // every unit test passes. Say so, loudly, with the two facts needed to
+ // diagnose it: which target refused to decode, and whether a multi-line
+ // argument is actually at risk in THIS spawn.
+ if (needsCmd) {
+ const multiline = (opts.args ?? []).some((a) => a.includes('\n'));
+ console.warn(
+ `[pty] Windows: "${resolved}" could not be decoded as an npm shim — falling back to cmd.exe.` +
+ (multiline
+ ? ' A MULTI-LINE ARGUMENT IS PRESENT AND WILL BE TRUNCATED AT ITS FIRST NEWLINE.' +
+ ' The agent will start and look healthy without ever receiving the hive protocol.'
+ : ' No multi-line argument in this spawn, so nothing is lost here.')
+ );
+ }
}
+ const childEnv = {
+ ...process.env,
+ PATH: userPath,
+ TERM: 'xterm-256color',
+ COLORTERM: 'truecolor',
+ // Help apps that look for a real interactive shell
+ FORCE_COLOR: '1',
++ // A Finder/Dock-launched Electron app inherits NO locale from launchd
++ // (`launchctl getenv LANG` is empty), so without this every child runs in
++ // the C/POSIX locale — where macOS's CoreFoundation default text encoding
++ // is Mac OS Roman (__CF_USER_TEXT_ENCODING=<uid>:0:0). Any locale-sensitive
++ // tool an agent runs then decodes UTF-8 as MacRoman and paints mojibake
++ // into the grid ("—" → "‚Äî"), which copy faithfully reproduces. This
++ // terminal IS UTF-8 (xterm.js + Unicode11), so say so.
++ //
++ // LC_CTYPE only, deliberately: it is the character-encoding category. Using
++ // LC_ALL would also override collation and date formatting for every user
++ // who never exported a locale. A locale the user really did export wins.
++ ...(process.platform === 'win32'
++ ? {}
++ : { LANG: process.env.LANG ?? 'en_US.UTF-8',
++ LC_CTYPE: process.env.LC_ALL ?? process.env.LC_CTYPE ?? process.env.LANG ?? 'en_US.UTF-8' }),
+ // Per-agent hive identity (AGENT_ID, HIVE_ROOT, …) when provided.
+ ...(opts.env ?? {})
+ } as Record<string, string>;
+ // The app itself is often launched from INSIDE a Claude Code session
+ // (`npm run dev` typed into a claude terminal), so that session's
+ // identity markers arrive via process.env and would flow into every
+ // agent CLI. CLAUDE_CODE_CHILD_SESSION makes the agent believe it is a
- // child session and silently DISABLES transcript saving ("Transcript
- // saving is off — inherited CLAUDE_CODE_CHILD_SESSION marker"), which
- // breaks --resume for every agent of that run: their sessions never
- // reach disk (bit us live 2026-08-16/17 — no worker transcript ever
- // existed). The session id / messaging socket+token likewise belong to
- // the PARENT session, never to a fresh agent. Agents are top-level
++ // child session and silently DISABLES transcript saving, which breaks
++ // --resume for every agent of that run: their sessions never reach
++ // disk. The session id / messaging socket+token likewise belong to the
++ // PARENT session, never to a fresh agent. Agents are top-level
+ // sessions regardless of how the app was launched.
+ for (const k of [
+ 'CLAUDE_CODE_CHILD_SESSION',
+ 'CLAUDE_CODE_SESSION_ID',
+ 'CLAUDE_PID',
+ 'CLAUDE_CODE_MESSAGING_SOCKET',
+ 'CLAUDE_CODE_MESSAGING_TOKEN'
+ ]) delete childEnv[k];
const proc = pty.spawn(file, spawnArgs, {
name: 'xterm-256color',
cols: opts.cols ?? 100,