Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(server): launch Codex with shared node identity
freshjuicezc105fb99b203
diff --git a/docs/SERVER.md b/docs/SERVER.mdindex 30f52ef3a..622aaf4b0 100644--- a/docs/SERVER.md+++ b/docs/SERVER.md@@ -568,8 +568,9 @@ account-management IPC — that surface is desktop-driven over SSH.`setCodexThreadIdentityAuthSecret(...)` with it, so a managed Codex account's thread→node→accountownership records can **sign and verify on a headless host**. Headless Linux has no OS keychain, sothe secret is 32 **raw bytes** at `node-auth-key.bin`, mode `0600` — the same both-shells channel the- desktop seals via `safeStorage`. This only makes the record layer *able to sign*; it is orthogonal to- the shared-app-server degrade (Codex nodes still launch bare here, exactly as before).+ desktop seals via `safeStorage`. When the managed runtime and launcher are available, headless+ canvas-control launches route through `nodeterm-codex` and claim that signed node identity; an+ unavailable capability still degrades to the bare `codex` command.- **Does NOT host the account-management verbs.** `initCodexAccounts` registers its IPC over Electron's`ipcMain` with WebContents-owner authorization, which the headless bridge does not provide, so`startServer` never calls it. This is **not** a silent gap: managed Codex logins **on an SSH host**diff --git a/src/server/canvas-control.test.ts b/src/server/canvas-control.test.tsindex 0027ddccb..38d721285 100644--- a/src/server/canvas-control.test.ts+++ b/src/server/canvas-control.test.ts@@ -95,9 +95,10 @@ describe('initServerCanvasControl', () => {} as unknown as WorkspaceStoreconst paneOwner = vi.fn(async () => null)const sendEnvelope = vi.fn(async () => true)+ const sendText = vi.fn(async (_nodeId: string, _text: string) => true)const pty = {createHeadless: vi.fn(async () => ({ sessionId: 'unused', fresh: true })),- sendText: vi.fn(async () => true),+ sendText,destroySession: vi.fn(async () => undefined),paneOwner,sendEnvelope,@@ -116,6 +117,7 @@ describe('initServerCanvasControl', () => {fullscreenTui: false,sessionIdFlag: false}),+ codexSharedIdentity: async () => true,installAgentIntegrations: false})@@ -131,6 +133,17 @@ describe('initServerCanvasControl', () => {fs.readFileSync(path.join(accountDir, 'skills', 'manage-nodeterm-canvas', 'SKILL.md'), 'utf8')).toContain(shim)+ const opened = await runtime.handler({+ verb: 'open-agent',+ nodeId: 'source',+ args: { agent: 'codex', prompt: 'identity proof' },+ verified: true+ })+ expect(opened).toMatchObject({ ok: true })+ expect(sendText.mock.calls.at(-1)?.[1]).toBe(+ "nodeterm-codex 'identity proof' --ask-for-approval on-request"+ )+// Prove ownership so the next gate reached is specifically the per-project capability switch.recordFreshSpawnOwner('target', 'p1')const reply = await runtime.handler({diff --git a/src/server/canvas-control.ts b/src/server/canvas-control.tsindex dba6b884a..79218cef4 100644--- a/src/server/canvas-control.ts+++ b/src/server/canvas-control.ts@@ -21,6 +21,7 @@ import {buildCanvasSkillBody,mergeCanvasControlBlock} from '../core/canvas-control-core'+import { codexIdentityCaps } from '../core/codex-identity-caps'import { codexThreadIdentityRoot } from '../core/codex-identity-proxy'import { claudeCliCaps, type ClaudeCliCaps } from '../core/claude-cli'import { installHooksIntoLocalAccounts } from '../core/claude-accounts-service'@@ -43,6 +44,8 @@ export interface ServerCanvasControlDeps {settings(): SettingsboardLog: BoardLogHandlerscliCaps?: () => Promise<ClaudeCliCaps>+ /** Test seam for the boot-populated shared Codex capability answer. */+ codexSharedIdentity?: () => Promise<boolean>/** The server's installHooks gate. False keeps every real agent config directory untouched. */installAgentIntegrations?: boolean}@@ -140,6 +143,8 @@ export async function initServerCanvasControl(ptyManager: deps.ptyManager,settings: deps.settings,cliCaps: deps.cliCaps ?? claudeCliCaps,+ codexSharedIdentity:+ deps.codexSharedIdentity ?? (() => codexIdentityCaps().then((caps) => caps.shared)),stateOf: nodeState,agentIdOf: (nodeId) => mirrorEntry(nodeId)?.agentId,publishProject: (project: Project) => platform().broadcast(IPC.workspaceExternalChange, project)diff --git a/src/server/headless-node-factory.test.ts b/src/server/headless-node-factory.test.tsindex 68591612b..3ac7c1f1c 100644--- a/src/server/headless-node-factory.test.ts+++ b/src/server/headless-node-factory.test.ts@@ -84,6 +84,7 @@ describe('HeadlessNodeFactory', () => {let removed: string[]let publishedProjects: Workspace['projects']let factory: HeadlessNodeFactory+ let codexSharedIdentity: booleanconst settings = (): Settings => ({...DEFAULT_SETTINGS,@@ -103,6 +104,7 @@ describe('HeadlessNodeFactory', () => {published = []removed = []publishedProjects = []+ codexSharedIdentity = falseconst initial: Workspace = {version: 2,activeProjectId: 'project-1',@@ -130,6 +132,7 @@ describe('HeadlessNodeFactory', () => {fullscreenTui: false,sessionIdFlag: false}),+ codexSharedIdentity: async () => codexSharedIdentity,stateOf: (id) => states[id],publishNode: (_projectId, node) => published.push(node),publishRemoval: (_projectId, nodeId) => removed.push(nodeId),@@ -708,6 +711,23 @@ describe('HeadlessNodeFactory', () => {expect(pty.sends.at(-1)).toEqual({ nodeId: id, text: command })})+ it('routes a Codex launch through the managed launcher when Server shared identity is ready', async () => {+ codexSharedIdentity = true++ const reply = await factory.openAgent(+ 'term-source',+ { agent: 'codex', prompt: 'do work' },+ true+ )++ expect(reply.ok).toBe(true)+ const id = (reply.result as { id: string }).id+ expect(pty.sends.at(-1)).toEqual({+ nodeId: id,+ text: "nodeterm-codex 'do work' --ask-for-approval untrusted"+ })+ })+it('persists --after without launching, then flushes exactly once on the idle state', async () => {states['term-upstream'] = 'working'const reply = await factory.openAgent(diff --git a/src/server/headless-node-factory.ts b/src/server/headless-node-factory.tsindex 37a57ed7e..7292c4c19 100644--- a/src/server/headless-node-factory.ts+++ b/src/server/headless-node-factory.ts@@ -62,6 +62,8 @@ export interface HeadlessNodeFactoryDeps {ptyManager: HeadlessPtysettings(): SettingscliCaps(): Promise<ClaudeCliCaps>+ /** Whether this host's Codex launcher + shared app-server identity spine are ready. */+ codexSharedIdentity(): Promise<boolean>/** Hook-mirror lookups. A stored agentId wins; these cover a plain terminal running an agent. */stateOf(nodeId: string): AgentState | undefinedagentIdOf?(nodeId: string): string | undefined@@ -899,6 +901,13 @@ export class HeadlessNodeFactory {error: 'open-agent: Server Edition v1 supports --agent claude|codex|gemini'}}+ // The Server shell owns the same shared Codex app-server spine as desktop. Ask its boot-time+ // capability probe at the launch boundary: true routes through `nodeterm-codex`; every+ // unavailable/failed case stays on the safe bare command supplied by the shared assembler.+ const codexSharedIdentity =+ verb === 'open-agent' && agentId === 'codex'+ ? await this.deps.codexSharedIdentity().catch(() => false)+ : falseconst count = parseCount(args.count, verb === 'open-terminal' ? TERMINAL_LIMIT : AGENT_LIMIT)const created: CanvasNodeState[] = []@@ -948,7 +957,7 @@ export class HeadlessNodeFactory {sessionId: mintedSessionId,sessionIdFlagSupported,launchCmdOverride: settings.agentLaunchCommands?.[agentId as BuiltinAgentId],- sharedIdentity: false,+ sharedIdentity: codexSharedIdentity,model: args.model},this.deps.env ?? process.envdiff --git a/src/server/node-identity-arm.ts b/src/server/node-identity-arm.tsindex 87993f2d0..2a5b91c8e 100644--- a/src/server/node-identity-arm.ts+++ b/src/server/node-identity-arm.ts@@ -23,8 +23,8 @@ export async function armServerNodeIdentity(const nodeAuthSecret = await loadOrCreateNodeAuthSecret()hookServer.setNodeAuthSecret(nodeAuthSecret)// Managed Codex accounts on a headless host can then sign/verify their ownership records instead- // of throwing "identity authentication is unavailable". Orthogonal to the shared-app-server- // degrade (Codex nodes still launch bare here); this only makes the record layer able to sign.+ // of throwing "identity authentication is unavailable". The server's shared-app-server wiring+ // and headless launch factory consume this same identity spine after boot.setCodexThreadIdentityAuthSecret(nodeAuthSecret)// Already-running sessions become verified at their next hook event with no restart. No-ops into// legacy mode without a secret.