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.

fix(grok): key the subagent card on the measured instance id, and fix the CI stub

Xavi Guardiacb43ac6166dc
diff --git a/src/server/headless-node-factory.test.ts b/src/server/headless-node-factory.test.ts
index c8b3f8a0d..08311f36b 100644
--- a/src/server/headless-node-factory.test.ts
+++ b/src/server/headless-node-factory.test.ts
@@ -155,8 +155,10 @@ describe('HeadlessNodeFactory', () => {
fullscreenTui: false,
sessionIdFlag: false
}),
- // Stated, not defaulted — the required field is what stops a probe being forgotten.
- grokCaps: async () => ({ sessionIdFlag: false }),
+ // Stated, not defaulted — the required fields are what stop a probe being forgotten.
+ // `models: []` is grok's own "no catalogue" answer (a failed/absent `grok models`), which is
+ // the pre-feature behaviour: no model switching offered, never a partial list.
+ grokCaps: async () => ({ sessionIdFlag: false, models: [] }),
codexSharedIdentity: async () => codexSharedIdentity,
ownership,
stateOf: (id) => states[id],
diff --git a/src/shared/agents/normalize.grok.test.ts b/src/shared/agents/normalize.grok.test.ts
index f2c734a1f..53e683593 100644
--- a/src/shared/agents/normalize.grok.test.ts
+++ b/src/shared/agents/normalize.grok.test.ts
@@ -150,25 +150,20 @@ describe('normalizeGrok — published 1.0.13 events', () => {
expect(normalizeGrok(env({ hookEventName: 'stop_cancelled', reason: 'future_reason' }))).toBeNull()
})
- it('normalizes SubagentStart and SubagentStop without inventing an instance id', () => {
+ // REPLACED after measuring. This case used to build payloads with NO `subagentId` and assert that
+ // the result carried `sessionId` — "without inventing an instance id". Both halves are wrong
+ // against the wire: all four captured subagent payloads (1.0.13) carry `subagentId`, so the
+ // id-less shape does not occur; and passing `sessionId` through is the trap, because on the STOP
+ // that id is the CHILD's own. The measured behaviour is pinned in the `normalizeGrok — subagents`
+ // block at the end of this file. What survives here is the id-less input, which must map to
+ // NOTHING rather than to a card no store can key.
+ it('returns null for a subagent event with no instance id, rather than an unkeyable card', () => {
expect(
normalizeGrok(env({ hookEventName: 'subagent_start', sessionId: 's1', subagentType: 'explore' }))
- ).toEqual({
- nodeId: 'n1',
- agentId: 'grok',
- sessionId: 's1',
- kind: 'subagent-start',
- subagentType: 'explore'
- })
+ ).toBeNull()
expect(
normalizeGrok(env({ hook_event_name: 'subagent_stop', session_id: 's1', subagent_type: 'explore' }))
- ).toEqual({
- nodeId: 'n1',
- agentId: 'grok',
- sessionId: 's1',
- kind: 'subagent-end',
- subagentType: 'explore'
- })
+ ).toBeNull()
})
it('carries the closed compaction phase while leaving the current badge untouched', () => {
diff --git a/src/shared/agents/normalize.ts b/src/shared/agents/normalize.ts
index 7de0d45f1..fe5aed99c 100644
--- a/src/shared/agents/normalize.ts
+++ b/src/shared/agents/normalize.ts
@@ -622,9 +622,6 @@ interface GrokPayload {
* which carried `trigger`, kept it green. */
source?: string
trigger?: string
- /** Events fired inside a subagent use its type as identity; there is no measured instance id. */
- subagentType?: string
- subagent_type?: string
prompt?: string
}