Skip to content

Commit 66366df

Browse files
revert(web): drop runless-work Stop helper; runless children have no composer
Runless background work only appears on provider-native subagent threads: derivePendingBackgroundWork returns only PR watches when latestRun is null, and a provider-native child replaces the composer and its background strip with ProviderSubagentBar, so no Stop is ever rendered for it. The foregroundRunOwnsStop helper guarded an unreachable state. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent f1ff6c1 commit 66366df

3 files changed

Lines changed: 2 additions & 50 deletions

File tree

‎apps/web/src/components/ChatView.logic.test.ts‎

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
withMessageContext,
88
deriveAvailableRevertTurnCounts,
99
deriveThreadPendingBackgroundTasks,
10-
foregroundRunOwnsStop,
1110
deriveWorkspaceMutationId,
1211
} from "./ChatView.logic";
1312
import { recallCheckoutIsRepo, rememberCheckoutIsRepo } from "./ChatView.logic";
@@ -1366,29 +1365,3 @@ describe("deriveThreadPendingBackgroundTasks", () => {
13661365
).toEqual([{ taskId: "child-1", description: "child 1", kind: "subagent" }]);
13671366
});
13681367
});
1369-
1370-
describe("foregroundRunOwnsStop", () => {
1371-
it.each([
1372-
// Runless provider-subagent work has no run for the composer to stop first.
1373-
{ status: null, localRunWork: false, expected: false },
1374-
{ status: "idle", localRunWork: false, expected: false },
1375-
// A send this client just made owns Stop before the server reports a run.
1376-
{ status: null, localRunWork: true, expected: true },
1377-
{ status: "queued", localRunWork: false, expected: true },
1378-
{ status: "running", localRunWork: false, expected: true },
1379-
// Checkpoint drain: Stop reaches the background work directly.
1380-
{ status: "waiting", localRunWork: true, expected: false },
1381-
] as const)("status $status with local work $localRunWork -> $expected", (row) => {
1382-
const runtime =
1383-
row.status === null
1384-
? null
1385-
: {
1386-
status: row.status,
1387-
activeRunId: null,
1388-
providerInstanceId: ProviderInstanceId.make("codex"),
1389-
providerName: null,
1390-
lastError: null,
1391-
};
1392-
expect(foregroundRunOwnsStop({ runtime, localRunWork: row.localRunWork })).toBe(row.expected);
1393-
});
1394-
});

‎apps/web/src/components/ChatView.logic.ts‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { sanitizeThreadErrorMessage } from "~/rpc/transportError";
1616
import type {
1717
EnvironmentThread,
1818
ThreadStructure,
19-
ThreadStructureRuntime,
2019
EnvironmentThreadShell,
2120
} from "@t3tools/client-runtime/state/shell";
2221
import {
@@ -1685,23 +1684,6 @@ export function presentThreadShellFromProjection(
16851684
};
16861685
}
16871686

1688-
/**
1689-
* Whether a run owns Stop, so background-work Stop must wait for the composer's.
1690-
* Runless provider-subagent work has no run to stop first, and a waiting run is
1691-
* checkpoint drain, where Stop reaches its background work.
1692-
*/
1693-
export function foregroundRunOwnsStop(input: {
1694-
readonly runtime: ThreadStructureRuntime | null;
1695-
/** A local send, connect, or compaction this client started. */
1696-
readonly localRunWork: boolean;
1697-
}): boolean {
1698-
const phase = derivePhase(input.runtime);
1699-
return (
1700-
((phase === "running" || input.localRunWork) && input.runtime?.status !== "waiting") ||
1701-
phase === "connecting"
1702-
);
1703-
}
1704-
17051687
// Excludes `waiting`: that is post-terminal checkpoint drain, so its agent turn is over.
17061688
const LIVE_RUN_STATUSES = new Set(["queued", "preparing", "starting", "running"]);
17071689

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { announcedRun, isDetailBehindShell } from "./chat/threadActivityAnnounce
44
import {
55
deriveAvailableRevertTurnCounts,
66
deriveThreadPendingBackgroundTasks,
7-
foregroundRunOwnsStop,
87
deriveWorkspaceMutationId,
98
presentThreadShellFromProjection,
109
} from "./ChatView.logic";
@@ -2467,10 +2466,8 @@ export default function ChatView(props: ChatViewProps) {
24672466
serverConfig,
24682467
runtimeMode,
24692468
isWorking,
2470-
runIsLive: foregroundRunOwnsStop({
2471-
runtime: activeRuntime,
2472-
localRunWork: isSendBusy || isConnecting || isCompacting,
2473-
}),
2469+
// A waiting run is checkpoint drain; Stop there reaches its background work.
2470+
runIsLive: (isWorking && activeRuntime?.status !== "waiting") || phase === "connecting",
24742471
pendingBackgroundTasks,
24752472
activePendingApproval,
24762473
activePendingUserInput,

0 commit comments

Comments
 (0)