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
test: pin the clock past the strict node-identity cutoff
review98974037b130
diff --git a/src/core/agents/hook-server.request-id.test.ts b/src/core/agents/hook-server.request-id.test.tsindex 4d1e201ba..dedfd1ba6 100644--- a/src/core/agents/hook-server.request-id.test.ts+++ b/src/core/agents/hook-server.request-id.test.ts@@ -11,6 +11,19 @@ import { fakePlatform } from '../platform-fake'import { hookServer } from './hook-server'import { nodeAuthToken } from './node-auth-token'import { REQUEST_ID_HINT_LEAD, REQUEST_ID_REPLAYED_LEAD } from '../control-request-ledger'+import { NODE_IDENTITY_STRICT_AFTER } from './node-identity-policy'++/**+ * An UNVERIFIED caller only reaches the ledger inside the dated warning window — past+ * `NODE_IDENTITY_STRICT_AFTER` the route refuses it (403) before the ledger or the handler run.+ * The unverified-ledger tests below are about request-id handling, not about the date, so they+ * stand one millisecond before the cutoff through the hook server's clock seam instead of reading+ * the machine's clock (which turned them red on 2026-10-13).+ */+const inWarningWindow = (): void =>+ hookServer.setIdentityClockForTests(() => new Date(NODE_IDENTITY_STRICT_AFTER.getTime() - 1))+const pastCutoff = (): void =>+ hookServer.setIdentityClockForTests(() => new Date(NODE_IDENTITY_STRICT_AFTER.getTime()))const secret = Buffer.alloc(32, 7)let dir: string@@ -39,12 +52,14 @@ beforeAll(async () => {})})beforeEach(() => {+ hookServer.setIdentityClockForTests(() => new Date())handled = []lateOffered = []let n = 0next = async (cmd) => ({ ok: true, message: `opened n${++n}`, result: { ids: [`n${n}`], verb: cmd.verb } })})afterAll(() => {+ hookServer.setIdentityClockForTests(() => new Date())hookServer.setIdentityStrictOverride(() => undefined)hookServer.clearNodeAuthSecretForTests()hookServer.stop()@@ -182,6 +197,7 @@ describe('control route: --request-id makes a retried open idempotent', () => {})it('an unverified caller gets NO dedupe (never a shared bucket) and an explicit id says so', async () => {+ inWarningWindow()const node = freshNode()const args = { 'request-id': 'legacy-1' }const a = await post('open-terminal', { node, args, verified: false })@@ -194,6 +210,18 @@ describe('control route: --request-id makes a retried open idempotent', () => {expect(c.body).not.toMatch(/request id ignored/i)})+ it('past the cutoff an unverified caller is refused before the ledger and the handler', async () => {+ pastCutoff()+ const node = freshNode()+ const args = { 'request-id': 'legacy-2' }+ const a = await post('open-terminal', { node, args, verified: false })+ const b = await post('open-terminal', { node, args, verified: false })+ expect(a.status).toBe(403)+ expect(b.status).toBe(403)+ // Refused before the ledger: nothing ran, so there is no outcome for it to hold or replay.+ expect(handled).toHaveLength(0)+ })+it('a dry run bypasses the ledger: the real call with the same id still runs', async () => {const node = freshNode()await post('open-agent', { node, args: { agent: 'claude', 'dry-run': '', 'request-id': 'd1' } })@@ -255,12 +283,15 @@ describe('control route: --request-id makes a retried open idempotent', () => {})it('with no claim there is no id to name, and the handler is offered no late-answer path', async () => {+ inWarningWindow()next = async () => ({ ok: false, error: 'no answer within 120s — check the canvas', indeterminate: true })const unverified = await post('open-worktree', {node: freshNode(),args: { branch: 'b', 'request-id': 'mine' },verified: false})+ // Reached the handler (the warning window), so the missing hint is a real answer, not a 403.+ expect(unverified.status).toBe(400)expect(unverified.body).not.toContain(REQUEST_ID_HINT_LEAD)const noId = await post('open-worktree', { node: freshNode(), args: { branch: 'b' } })expect(noId.body).not.toContain(REQUEST_ID_HINT_LEAD)diff --git a/src/server/control-unsupported.test.ts b/src/server/control-unsupported.test.tsindex 6e48335e3..bf8344ae1 100644--- a/src/server/control-unsupported.test.ts+++ b/src/server/control-unsupported.test.ts@@ -14,7 +14,7 @@ import { initPlatform, resetPlatformForTests } from '../core/platform'import { fakePlatform } from '../core/platform-fake'import { hookServer, MESSAGING_CONTROL_REFUSAL } from '../core/agents/hook-server'import { nodeAuthToken } from '../core/agents/node-auth-token'-import { STRICT_CONTROL_REFUSAL } from '../core/agents/node-identity-policy'+import { NODE_IDENTITY_STRICT_AFTER, STRICT_CONTROL_REFUSAL } from '../core/agents/node-identity-policy'import {BROWSER_UNSUPPORTED_CLAUSE,CONTROL_UNSUPPORTED_ERROR,@@ -60,8 +60,10 @@ afterAll(() => {describe('the Server Edition refuses canvas control by name', () => {it('answers every verb with the same machine-readable error, in JSON', async () => {+ // Verified, so what is measured is the EDITION's answer on either side of the identity cutoff+ // (an unverified mutation is refused by identity from 2026-10-13 — covered separately below).for (const verb of ['list', 'open-terminal', 'write']) {- const res = await control(verb, 'n-1', 'application/json')+ const res = await control(verb, 'n-1', 'application/json', nodeAuthToken(SECRET, 'n-1'))expect(res.status, verb).toBe(400)const body = (await res.json()) as { ok: boolean; error: string; message: string }expect(body.ok, verb).toBe(false)@@ -71,6 +73,34 @@ describe('the Server Edition refuses canvas control by name', () => {}})+ it('an unverified caller hears the edition answer inside the warning window, and identity past the cutoff', async () => {+ try {+ // One millisecond before the cutoff: an unverified mutation still reaches the handler, so the+ // Server Edition's named refusal is what it hears — the pre-2026-10-13 behaviour.+ hookServer.setIdentityClockForTests(() => new Date(NODE_IDENTITY_STRICT_AFTER.getTime() - 1))+ for (const verb of ['list', 'open-terminal', 'write']) {+ const res = await control(verb, 'n-window', 'application/json')+ expect(res.status, verb).toBe(400)+ const body = (await res.json()) as { ok: boolean; error: string }+ expect(body.error, verb).toBe(CONTROL_UNSUPPORTED_ERROR)+ }+ // At the cutoff the identity gate answers first for a mutation (403, never the edition's+ // 400); the tolerant `list` is untouched by the date.+ hookServer.setIdentityClockForTests(() => new Date(NODE_IDENTITY_STRICT_AFTER.getTime()))+ for (const verb of ['open-terminal', 'write']) {+ const res = await control(verb, 'n-strict', 'application/json')+ expect(res.status, verb).toBe(403)+ const body = (await res.json()) as { error?: string }+ expect(body.error, verb).not.toBe(CONTROL_UNSUPPORTED_ERROR)+ }+ const list = await control('list', 'n-strict', 'application/json')+ expect(list.status).toBe(400)+ expect(((await list.json()) as { error: string }).error).toBe(CONTROL_UNSUPPORTED_ERROR)+ } finally {+ hookServer.setIdentityClockForTests(() => new Date())+ }+ })+it('tells a text/plain caller, in words, not to retry', async () => {// Verified, so the reply is the refusal alone: an unverified caller inside the warning window// gets the identity note prefixed on top, which is existing behaviour and not what is measured