The best way to control Claude Code, Codex and more from any computer or phone
fix(server): foreground Claude forks no longer show as finished the moment they start (#26459)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Henry Chu committed
Nov 1, 2026 at 16:00 UTC
4f8b6eef5b7ee0d73f02c60539401ef2d82115ff
2 files changed
+63
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
+61
@@ -12946,6 +12946,67 @@ describe("ClaudeAdapterV2 background wake turns", () => {
12946
),
12947
);
12948
12949
+ it.effect("keeps a foreground fork running past the placeholder result for its own launch", () =>
12950
+ Effect.scoped(
12951
+ Effect.gen(function* () {
12952
+ const harness = yield* makeWakeHarness;
12953
+ yield* harness.runtime.startTurn(
12954
+ makeClaudeTestTurnInput({
12955
+ threadId: harness.threadId,
12956
+ providerThread: harness.providerThread,
12957
+ now: yield* DateTime.now,
12958
+ attemptId: RunAttemptId.make("attempt-claude-foreground-fork"),
12959
+ text: "Fork this.",
12960
+ attachments: [],
12961
+ }),
12962
+ );
12963
+ yield* harness.offerAndWait(
12964
+ makeSubagentTaskStartedFrame({
12965
+ taskId: "agent-fork",
12966
+ toolUseId: "toolu-fork",
12967
+ uuid: "00000000-0000-4000-8000-000000000901",
12968
+ }),
12969
+ );
12970
+ // Claude Code opens a foreground fork's own stream with a placeholder result for its launch.
12971
+ yield* harness.offerAndWait(
12972
+ claudeSdkFrame({
12973
+ type: "user",
12974
+ message: {
12975
+ role: "user",
12976
+ content: [
12977
+ {
12978
+ type: "tool_result",
12979
+ tool_use_id: "toolu-fork",
12980
+ content: "Fork started — that fork is you.",
12981
+ },
12982
+ ],
12983
+ },
12984
+ parent_tool_use_id: "toolu-fork",
12985
+ uuid: "00000000-0000-4000-8000-000000000902",
12986
+ session_id: WAKE_NATIVE_SESSION,
12987
+ }),
12988
+ );
12989
+ yield* harness.offerAndWait(
12990
+ makeSubagentNotificationFrame({
12991
+ taskId: "agent-fork",
12992
+ toolUseId: "toolu-fork",
12993
+ summary: "FORK-DONE",
12994
+ uuid: "00000000-0000-4000-8000-000000000903",
12995
+ }),
12996
+ );
12997
+ let settled = yield* Queue.take(harness.subagentReceipts);
12998
+ while (settled.subagent.status === "running") {
12999
+ settled = yield* Queue.take(harness.subagentReceipts);
13000
+ }
13001
+ assert.equal(settled.subagent.result, "FORK-DONE");
13002
+ }).pipe(
13003
+ Effect.provide(
13004
+ Layer.mergeAll(IdAllocator.layer, McpProviderSessions.layer, NodeServices.layer),
13005
+ ),
13006
+ ),
13007
+ ),
13008
+ );
13009
+
13010
it.effect("releases the idle pin when a post-settle subagent stops without completing", () =>
13011
Effect.scoped(
13012
Effect.gen(function* () {
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
+2
@@ -9094,6 +9094,8 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
9094
}
9095
9096
for (const { toolResult, output } of claudeToolResultEntriesFromMessage(message)) {
9097
+ // A foreground fork's stream opens with a placeholder result for its own launch call.
9098
+ if (parentToolUseIdFromSdkMessage(message) === toolResult.tool_use_id) continue;
9099
const subagent = yield* resolveSubagentByToolUseId(context, toolResult.tool_use_id);
9100
const runHandles = parseClaudeWorkflowRunHandles(claudeNativeToolOutputValue(output));
9101
if (subagent !== undefined && runHandles !== undefined) {