Skip to content

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.

test(relay): pin that held pendingLaunch text never reaches non-editor peers

review6d731263d4e7
diff --git a/src/core/relay/access-policy.test.ts b/src/core/relay/access-policy.test.ts
index c591ae604..36f869b0c 100644
--- a/src/core/relay/access-policy.test.ts
+++ b/src/core/relay/access-policy.test.ts
@@ -385,7 +385,7 @@ describe('wrapSinkForRole — project documents lose their exec fields for non-e
const doc = JSON.stringify({
t: 'ev',
channel: IPC.workspaceServerChange,
- args: [{ id: 'P', nodes: [{ id: 'n1', kind: 'terminal', position: { x: 0, y: 0 }, shell: '/usr/bin/evil' }] }]
+ args: [{ id: 'P', nodes: [{ id: 'n1', kind: 'terminal', position: { x: 0, y: 0 }, shell: '/usr/bin/evil', pendingLaunch: { after: [], command: 'claude "held prompt text"' } }] }]
})
const run = (role: AccessContext['role']) => {
const text: string[] = []
@@ -396,13 +396,16 @@ describe('wrapSinkForRole — project documents lose their exec fields for non-e
const v = run('viewer')
expect(v).toHaveLength(1)
expect(JSON.parse(v[0]).args[0].nodes[0].shell).toBeUndefined()
+ expect(JSON.parse(v[0]).args[0].nodes[0].pendingLaunch).toBeUndefined()
+ expect(v[0]).not.toContain('held prompt text')
expect(run('editor')).toEqual([doc])
})
it('a viewer\'s workspace:load is stripped too', () => {
const out = narrowResponseForRole(IPC.workspaceLoad, { projects: [JSON.parse(doc).args[0]] }, ctx('viewer')) as {
- projects: Array<{ nodes: Array<{ shell?: string }> }>
+ projects: Array<{ nodes: Array<{ shell?: string; pendingLaunch?: unknown }> }>
}
expect(out.projects[0].nodes[0].shell).toBeUndefined()
+ expect(out.projects[0].nodes[0].pendingLaunch).toBeUndefined()
})
})
diff --git a/src/core/relay/scoped-guest-policy.test.ts b/src/core/relay/scoped-guest-policy.test.ts
index 430f725dd..d7f5ee2ba 100644
--- a/src/core/relay/scoped-guest-policy.test.ts
+++ b/src/core/relay/scoped-guest-policy.test.ts
@@ -260,12 +260,12 @@ describe('relay host — host-only channels refused to every peer', () => {
})
describe('project documents reach peers without exec fields', () => {
- // `shell` is an exec field stripSharedNodeExec removes today; a held `pendingLaunch` joins it with
- // the held-launch work (#1038), through the same helper, with no change here.
+ // `shell` and a held `pendingLaunch` (its command text included) are exec fields
+ // stripSharedNodeExec removes.
const project = (id: string) => ({
id,
name: id,
- nodes: [{ id: 'a1', kind: 'terminal', position: { x: 0, y: 0 }, shell: '/usr/bin/evil' }]
+ nodes: [{ id: 'a1', kind: 'terminal', position: { x: 0, y: 0 }, shell: '/usr/bin/evil', pendingLaunch: { after: [], command: 'claude "held prompt text"' } }]
})
const ev = (channel: string, ...args: unknown[]) => JSON.stringify({ t: 'ev', channel, args })
@@ -281,14 +281,17 @@ describe('project documents reach peers without exec fields', () => {
const node = JSON.parse(j).args[0].nodes[0]
expect(node.id).toBe('a1')
expect(node.shell).toBeUndefined()
+ expect(node.pendingLaunch).toBeUndefined()
+ expect(j).not.toContain('held prompt text')
}
})
it('scoped guest: workspace:load response is stripped', () => {
const hooks = scopedGuestHooks('alpha', deps())
const out = hooks.narrowResponse!(null as never, IPC.workspaceLoad, { projects: [project('alpha')] }) as {
- projects: Array<{ nodes: Array<{ shell?: string }> }>
+ projects: Array<{ nodes: Array<{ shell?: string; pendingLaunch?: unknown }> }>
}
expect(out.projects[0].nodes[0].shell).toBeUndefined()
+ expect(out.projects[0].nodes[0].pendingLaunch).toBeUndefined()
})
})