Skip to content

Commit ea588b6

Browse files
committed
fix(mothership): Go-parity gaps from the wire audit — sim side
Live CLI rows read "Running CLI command" for their whole run: the worker's partial frame names them sim_cli (args unknowable mid-stream) and the browser only filled EMPTY names. upsertToolNode now replaces exactly that placeholder with the finalized frame's verb — scoped so the gateway rebind's model-authored branding is never clobbered. isValidRunPayload accepts run/steering_applied: the worker emits it per the loss-free-ack contract and the validator's rejection escalated to FatalSseEventError — the ack would have killed the live turn the moment steering shipped. Claude-Session: https://claude.ai/code/session_01CgaxNAaeD3taGdghbXn17w
1 parent 30539cd commit ea588b6

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

apps/sim/app/workspace/[workspaceId]/home/hooks/stream/turn-model.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,14 @@ function upsertToolNode(
363363
): ToolNode {
364364
const existing = model.nodes.get(id)
365365
if (existing && existing.kind === 'tool') {
366-
if (name && !existing.name) existing.name = name
366+
// Fill blanks, and replace exactly the CLI placeholder: the worker's partial frame
367+
// names CLI rows `sim_cli` (args unknowable mid-stream) and the finalized frame
368+
// carries the real verb (`cli_workflows_list`) — without this every live CLI row
369+
// read "Running CLI command" until reload. Scoped to the placeholder so the gateway
370+
// rebind's model-authored branding is never clobbered by a later frame.
371+
if (name && (!existing.name || (existing.name === 'sim_cli' && name !== 'sim_cli'))) {
372+
existing.name = name
373+
}
367374
return existing
368375
}
369376
const node: ToolNode = {

apps/sim/lib/mothership/request/session/contract.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,11 @@ function isValidRunPayload(payload: JsonRecord): boolean {
289289
kind === MothershipStreamV1RunKind.checkpoint_pause ||
290290
kind === MothershipStreamV1RunKind.resumed ||
291291
kind === MothershipStreamV1RunKind.compaction_start ||
292-
kind === MothershipStreamV1RunKind.compaction_done
292+
kind === MothershipStreamV1RunKind.compaction_done ||
293+
// The worker's loss-free steering ack. Rejecting an unknown-but-contracted kind
294+
// escalated to FatalSseEventError and would have killed the live turn the moment
295+
// steering shipped (found by the Go-parity audit before any user hit it).
296+
kind === MothershipStreamV1RunKind.steering_applied
293297
)
294298
}
295299

0 commit comments

Comments
 (0)