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
docs(agents): teach the codex-sandbox transport error in both agent-facing bodies
Claude Code0f9b63235c8c
diff --git a/src/core/context-link-core.test.ts b/src/core/context-link-core.test.tsindex 2edae4ea1..f3df00fa1 100644--- a/src/core/context-link-core.test.ts+++ b/src/core/context-link-core.test.ts@@ -1,6 +1,7 @@import { describe, it, expect } from 'vitest'import {buildLinkDoc,+ buildContextLinkSkillBody,buildLinkedContextInstructions,mergeInstructionsBlock,resolveLinkTranscript,@@ -9,6 +10,7 @@ import {CONTEXT_SHIM_SCRIPT,CONTEXT_UNREACHABLE_MSG} from './context-link-core'+import { CODEX_SANDBOX_BLOCKED_LINE } from './agents/hook-sandbox-hint-sh'describe('buildLinkDoc', () => {it('enriches each link with tmux name, injected transcript path, and cwd', () => {@@ -205,6 +207,20 @@ describe('buildLinkedContextInstructions', () => {expect(s).toContain('terminal')})+ // Issue #367 — same parity discipline as canvas-control-core.test.ts: the shim's error+ // sentences and the docs explaining them share constants, so neither can drift alone. The+ // runtime behaviour is proven against real /bin/sh in context-link.cli.test.ts.+ it('both agent-facing texts carry the codex-sandbox transport guidance (issue #367)', () => {+ for (const body of [buildContextLinkSkillBody('/x/context.sh'), buildLinkedContextInstructions('/x/context.sh')]) {+ expect(body).toContain(CONTEXT_UNREACHABLE_MSG.replace(/\.$/, ''))+ expect(body).toContain(CODEX_SANDBOX_BLOCKED_LINE)+ expect(body.toLowerCase()).toContain('escalated permissions')+ expect(body).toMatch(/never relink, reinstall or restart nodeterm/)+ expect(body).toContain('network.allow_unix_sockets')+ expect(body).toContain('~/.codex/config.toml')+ }+ })+it('the shim embeds the sandbox hint, keeping the generic sentence for the non-sandbox case', () => {expect(CONTEXT_SHIM_SCRIPT).toContain('nt_codex_sandbox_hint() {')expect(CONTEXT_SHIM_SCRIPT).toContain('nt_codex_sandbox_hint && exit 1')diff --git a/src/core/context-link-core.ts b/src/core/context-link-core.tsindex ff770d235..d7e04e2d2 100644--- a/src/core/context-link-core.ts+++ b/src/core/context-link-core.ts@@ -4,7 +4,7 @@import type { ContextLinkInfo } from '../shared/types'import { sessionName } from './tmux-naming'import { HOOK_CURL_HEADERS_SH } from './agents/hook-curl-config-sh'-import { CODEX_SANDBOX_HINT_SH } from './agents/hook-sandbox-hint-sh'+import { CODEX_SANDBOX_BLOCKED_LINE, CODEX_SANDBOX_HINT_SH } from './agents/hook-sandbox-hint-sh'/** The shim's generic transport-failure sentence — exported so the agent-facing docs below can* quote it verbatim and the parity test holds the two ends together. */@@ -90,10 +90,31 @@ export function buildLinkedContextInstructions(shimPath: string): string {'```','','Only meaningful inside nodeterm (NODETERM_NODE_ID set) with a linked edge. If the CLI',- 'says "Not a nodeterm session" or "No linked nodes", there is nothing to read — do not retry.'+ 'says "Not a nodeterm session" or "No linked nodes", there is nothing to read — do not retry.',+ '',+ ...codexSandboxGuidanceLines(CONTEXT_UNREACHABLE_MSG)].join('\n')}+/**+ * The sandboxed-Codex transport guidance (issue #367), rendered into BOTH agent-facing bodies —+ * the get-linked-context skill and the codex/gemini instructions block — quoting the shim's real+ * error sentences so the docs and the generated script cannot drift apart (the parity test in+ * context-link-core.test.ts walks the constants against both bodies).+ */+export function codexSandboxGuidanceLines(unreachableMsg: string): string[] {+ return [+ `Sandboxed Codex: if a call fails with "${unreachableMsg.replace(/\.$/, '')}" or with`,+ `"${CODEX_SANDBOX_BLOCKED_LINE}",`,+ "Codex's command sandbox is denying loopback/socket connections while nodeterm itself is",+ 'healthy. Retry the SAME command once with command-specific escalated permissions (approve the',+ 'escalation prompt) — never relink, reinstall or restart nodeterm for this error; that cannot',+ 'help. On macOS the permanent fix is adding the advertised hook socket path (the',+ '`NODETERM_HOOK_SOCK` value) to `network.allow_unix_sockets` in ~/.codex/config.toml: hook',+ 'calls then work inside the sandbox with no escalation.'+ ]+}+export interface LinkDocEntry {id: stringtitle: string@@ -265,5 +286,7 @@ since it was first linked).\`--node\` is optional when you are linked to exactly one node; otherwise pass the id or titlefrom \`list\`. If the CLI says "Not a nodeterm session" or "No linked nodes", there is nothingto read — do not retry.++${codexSandboxGuidanceLines(CONTEXT_UNREACHABLE_MSG).join('\n')}`}diff --git a/src/main/canvas-control-core.test.ts b/src/main/canvas-control-core.test.tsindex d93a9d715..9b6e88d2b 100644--- a/src/main/canvas-control-core.test.ts+++ b/src/main/canvas-control-core.test.ts@@ -228,6 +228,24 @@ describe('parseControlRequest', () => {expect(body).toMatch(/starts? with `--`/)})+ // Issue #367: the shim's transport-failure sentences and the docs that explain them are held+ // together by constants — re-typing either side in prose is how the guidance and the generated+ // script drift. The runtime behaviour itself is proven against real /bin/sh in+ // canvas-control-shim.test.ts; this pins the TEACHING of it into both agent-facing bodies.+ it('both agent-facing texts carry the codex-sandbox transport guidance (issue #367)', () => {+ for (const body of [buildCanvasSkillBody('/x/shim.sh'), buildCanvasControlInstructions('/tmp/nodeterm.sh')]) {+ // Names both exact errors the agent can see: the generic sentence and the sandbox one.+ expect(body).toContain(CONTROL_UNREACHABLE_MSG.replace(/\.$/, ''))+ expect(body).toContain(CODEX_SANDBOX_BLOCKED_LINE)+ // The one action that works everywhere, and the never-do.+ expect(body.toLowerCase()).toContain('escalated permissions')+ expect(body).toMatch(/never relink, reinstall or restart nodeterm/)+ // The macOS permanent remedy, named exactly as codex's config reads it.+ expect(body).toContain('network.allow_unix_sockets')+ expect(body).toContain('~/.codex/config.toml')+ }+ })+it('the shim embeds the sandbox hint and its call sites in both failure tails', () => {// The fragment (one definition)...expect(CONTROL_SHIM_SCRIPT).toContain('nt_codex_sandbox_hint() {')diff --git a/src/main/canvas-control-core.ts b/src/main/canvas-control-core.tsindex bb7146906..9f89bc037 100644--- a/src/main/canvas-control-core.ts+++ b/src/main/canvas-control-core.ts@@ -3,6 +3,7 @@// Electron/ipc/server wiring lives in canvas-control.ts + index.ts + hook-server.ts.import { HOOK_CURL_HEADERS_SH } from '../core/agents/hook-curl-config-sh'import { CODEX_SANDBOX_HINT_SH } from '../core/agents/hook-sandbox-hint-sh'+import { codexSandboxGuidanceLines } from '../core/context-link-core'import { AGENT_CONFIG, AGENT_HOOK_TARGETS, BUILTIN_AGENT_IDS } from '@shared/agents/config'import { RETRYABLE } from '../core/agents/agent-message-decide'import { FANOUT_PER_TURN, PAIR_MIN_INTERVAL_MS } from '../core/agents/agent-message-flow'@@ -363,6 +364,8 @@ export function buildCanvasControlInstructions(shimPath: string): string {'',...browserGuidanceLines(),'',+ ...codexSandboxGuidanceLines(CONTROL_UNREACHABLE_MSG),+ '','Orchestration ("Build with Nodeterm orchestration"): first decide what is genuinely','independent — for every "and then", ask whether the next step READS the previous step\'s','output. If not, they are separate stations, open them all at once; if it does, open the',@@ -681,6 +684,8 @@ Notes:toggle the kanban view. They need no confirmation.- If the CLI says canvas control is unavailable, you are not in a controllable nodeterm session — do not retry.+${codexSandboxGuidanceLines(CONTROL_UNREACHABLE_MSG).join('\n')}+To orchestrate a team: decide the roles + a concrete starting prompt for each, then one\`spawn-team\` call (or \`open-claude\` per role followed by \`group\` + \`arrange\`).