@devries-cameron20 / t3code Mirror · read-only / commits / 0840bb209c
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 18:15 UTC

fix(provider-acp): Grok monitors show as monitors in background work (#24609)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Theo Browne committed Oct 24, 2026 at 17:13 UTC 0840bb209c8a503ba74715167e4ae04c4c0e0c19
5 files changed +24 -2
apps/server/src/orchestration-v2/RestartBackgroundNote.ts
+1 -1
@@ -51,7 +51,7 @@ export function cancelledTurnItemWork(
51 }
52 case "command_execution":
53 return {
54 - kind: "shell",
54 + kind: item.monitor === true ? "monitor" : "shell",
55 label: compactLabel(item.input) ?? compactLabel(item.title) ?? "background command",
56 id: item.id,
57 };
apps/server/src/orchestration-v2/testkit/fixtures/grok_monitor/output.ts
+16
@@ -1,7 +1,9 @@
1 import { assert } from "@effect/vitest";
2 import type { ProviderReplayTranscript } from "@t3tools/contracts";
3 +import { derivePendingBackgroundWork } from "@t3tools/shared/orchestrationV2PendingBackgroundWork";
4
5 import type { OrchestratorV2ScenarioResult } from "../../OrchestratorScenario.ts";
6 +import { cancelledTurnItemWork } from "../../../RestartBackgroundNote.ts";
7 import {
8 assertBaseProjection,
9 assertSemanticProjectionIntegrity,
@@ -54,6 +56,20 @@ export function assertGrokMonitorOutput(
56 assert.equal(monitorUpdates[tickUpdate]?.status, "running", `${tick} must show running`);
57 }
58
59 + // A persistent monitor keeps running after its run ends. Background work and
60 + // the restart note must then name it a monitor, as they do for Claude's Monitor.
61 + const runningMonitor = monitorUpdates.find((update) => update.status === "running");
62 + assert.isDefined(runningMonitor);
63 + assert.deepEqual(
64 + derivePendingBackgroundWork({
65 + latestRun: rootRun,
66 + providerThreads: [],
67 + turnItems: [runningMonitor],
68 + }).map((task) => task.kind),
69 + ["monitor"],
70 + );
71 + assert.equal(cancelledTurnItemWork(runningMonitor)?.kind, "monitor");
72 +
73 const monitorCompletedAt = result.domainEvents.findIndex(
74 (event) =>
75 event.type === "turn-item.updated" &&
packages/contracts/src/orchestrationV2.ts
+4
@@ -1477,6 +1477,8 @@ export const OrchestrationV2TurnItem = Schema.Union([
1477 outputOmitted: Schema.optional(Schema.Boolean),
1478 outputIndicatesFailure: Schema.optional(Schema.Boolean),
1479 exitCode: Schema.optional(Schema.Int),
1480 + /** Set when the command is a monitor, so background work lists it as a monitor. */
1481 + monitor: Schema.optional(Schema.Boolean),
1482 }),
1483 Schema.Struct({
1484 ...OrchestrationV2TurnItemBaseFields,
@@ -2244,6 +2246,8 @@ export const OrchestrationV2TurnItemJson = Schema.Union([
2246 outputOmitted: Schema.optional(Schema.Boolean),
2247 outputIndicatesFailure: Schema.optional(Schema.Boolean),
2248 exitCode: Schema.optional(Schema.Int),
2249 + /** Set when the command is a monitor, so background work lists it as a monitor. */
2250 + monitor: Schema.optional(Schema.Boolean),
2251 }),
2252 Schema.Struct({
2253 ...OrchestrationV2TurnItemJsonBaseFields,
packages/provider-acp/src/server/adapter.ts
+1
@@ -3916,6 +3916,7 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
3916 ? {}
3917 : { output: textFromUnknown(rawOutput) }),
3918 ...(exitCode === undefined ? {} : { exitCode }),
3919 + ...(inputVariant === "monitor" ? { monitor: true } : {}),
3920 };
3921 } else {
3922 turnItem = {
packages/shared/src/orchestrationV2PendingBackgroundWork.ts
+2 -1
@@ -132,6 +132,7 @@ type PendingBackgroundWorkTurnItem = {
132 readonly nativeId: string | null;
133 } | null;
134 readonly input?: unknown;
135 + readonly monitor?: boolean | undefined;
136 readonly prompt?: string | undefined;
137 readonly childThreadId?: ThreadId | null;
138 };
@@ -190,7 +191,7 @@ function pendingTaskFromTurnItem(
191 ...(item.childThreadId == null ? {} : { childThreadId: item.childThreadId }),
192 };
193 case "command_execution":
193 - return { ...named, kind: "command" };
194 + return { ...named, kind: item.monitor === true ? "monitor" : "command" };
195 default:
196 return { ...named, kind: "background_task" };
197 }