Skip to content

fix(grok): end the turn when an auto-backgrounded shell command finishes (fork patch on nightly 2819, board #16214) - #5

Draft
MattRiddell wants to merge 1 commit into
live/v0.0.46-nightly.20261008.2819from
fix/16214-grok-call-task-ids
Draft

MattRiddell wants to merge 1 commit into
live/v0.0.46-nightly.20261008.2819from
fix/16214-grok-call-task-ids

Conversation

@MattRiddell

@MattRiddell MattRiddell commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Board pingdotgg#16214 (from pingdotgg#16211). Matt, q3442 (Telegram 2026-10-10T00:51:58Z, "q3442: 1"): patch our T3 build; controller swaps it in at the next T3 restart; re-apply on each T3 upgrade. Staged as ~/.local/lib/t3-20261008-2819-pr10m-fix16214 (on top of #4), sha256 0ab73c79308719bc; install packet on board pingdotgg#16214.

What

XAiAcpExtension.extractXAiBackgroundTaskCompletion now accepts Grok's call-id task form call-<uuid>-<n> as well as a bare UUID: in the TaskOutput Result.task_id, the === Task <id> === header and the requested task_ids. Subagent and monitor parsing keep the UUID-only match.

Why

When a foreground run_terminal_command passes Grok's 15 s auto-background limit, Grok reports BackgroundTaskStarted with the tool call id as task_id. T3 registers that id as running background work. The later get_command_or_subagent_output TaskOutput names the same id, but hydration only matched a UUID, so the tool row stayed running. hasDeferredBackgroundWork stayed true at prompt settle, no turn end was written and the thread ran until hung-turns stopped it after 45 min.

Evidence (lcr-bench 2026-10-08/09, Grok session logs): 26 of 28 grok arms with call-id background tasks hung; 0 of 13 arms with UUID or no background tasks hung. Example: fe-14222 grok-4.7, task call-586d8645-9bbb-44f9-a337-ed45d3b87124-70 (TaskOutput status failed, exit 2) never matched.

Tests

  • vp test run src/provider/acp/XAiAcpExtension.test.ts: 60 passed. New: the live call-id frames (start + TaskOutput), request-list and task-header forms, must-say-NO ids (call-get-mon, not-a-task, a non-numeric suffix), and a call-id TaskOutput that is still not a subagent.
  • Must-fail control: the 2 call-id hydration tests fail on the unpatched source.
  • tsc --noEmit (apps/server): clean. vp lint on the 2 files: 0 errors (1 pre-existing unused-function warning, line 1716). vp fmt --check: clean.

🤖 Generated with Claude Code

When Grok moves a foreground run_terminal_command to the background after
its 15s limit, it reuses the tool call id (call-<uuid>-<n>) as the task id.
T3 registered that id as running background work, but TaskOutput hydration
only accepted a bare UUID, so the completion never matched. The tool row
stayed running, hasDeferredBackgroundWork stayed true and the turn never
ended until the hung-turn timer stopped the thread.

Accept the call-id form in extractXAiBackgroundTaskCompletion (result
task_id, task header and request ids). Subagent and monitor parsing keep
the UUID-only match.

Evidence: lcr-bench 2026-10-08/09, 26 of 28 grok arms with call-id tasks
hung; 0 of 13 arms with UUID or no background tasks hung.

Board pingdotgg#16214.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S labels Oct 10, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant