GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): Claude subagents resumed after a missed launch get their… · AdEx-Partners-DE/t3code@c87221f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src/orchestration-v2
    • Adapters
      • ClaudeAdapterV2.test.ts
      • ClaudeAdapterV2.ts
    • ProviderEventIngestor.test.ts
    • ProviderEventIngestor.ts
  • packages/provider-core/src/server
    • ProviderAdapter.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11744,12 +11744,15 @@ describe("ClaudeAdapterV2 background wake turns", () => {
1174411744
threadMessages(harness.events, member?.childThreadId).map((event) => event.message.text),
1174511745
["Reply with exactly: A1"],
1174611746
);
11747-
assert.isFalse(
11748-
harness.events.some(
11749-
(event) =>
11750-
event.type === "app_thread.created" &&
11751-
event.appThread.id === coordinator?.childThreadId,
11747+
// T3 may have missed the launch, so the recovered coordinator's
11748+
// thread is created only if it does not exist yet.
11749+
assert.deepEqual(
11750+
harness.events.flatMap((event) =>
11751+
event.type === "app_thread.created" && event.appThread.id === coordinator?.childThreadId
11752+
? [event.createOnly]
11753+
: [],
1175211754
),
11755+
[true],
1175311756
);
1175411757
}).pipe(
1175511758
Effect.provide(
Collapse file

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
+10-8Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4365,7 +4365,8 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
43654365
// carry the launch call as parent_tool_use_id, which only the CLI's
43664366
// session storage still records. Registering the subagent as a
43674367
// finished run lets the resume reopen it like an in-session resume:
4368-
// same child thread, launch prompt kept, the new prompt appended.
4368+
// same child thread, launch prompt kept, the new prompt appended. The
4369+
// reopen creates the child thread if T3 missed the launch.
43694370
const recoverResumedClaudeSubagent = Effect.fnUntraced(function* (resume: {
43704371
readonly context: ActiveClaudeTurnContext;
43714372
readonly nativeThreadId: string;
@@ -5071,13 +5072,14 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
50715072
createdBy: "agent",
50725073
creationSource: "provider",
50735074
});
5074-
if (existingSubagent === undefined) {
5075-
yield* emitProviderEvent({
5076-
type: "app_thread.created",
5077-
driver: CLAUDE_PROVIDER,
5078-
appThread: childThread,
5079-
});
5080-
}
5075+
// A subagent recovered on resume may have launched while T3 was
5076+
// not listening, so its thread may not exist yet.
5077+
yield* emitProviderEvent({
5078+
type: "app_thread.created",
5079+
driver: CLAUDE_PROVIDER,
5080+
appThread: childThread,
5081+
...(existingSubagent === undefined ? {} : { createOnly: true }),
5082+
});
50815083
subagent.childThread = childThread;
50825084
}
50835085

Collapse file

‎apps/server/src/orchestration-v2/ProviderEventIngestor.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/ProviderEventIngestor.test.ts
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,6 +1670,20 @@ layer("ProviderEventIngestorV2", (it) => {
16701670
}),
16711671
[],
16721672
);
1673+
assert.deepEqual(
1674+
yield* ingestor.ingestNormalized({
1675+
providerSessionId,
1676+
providerInstanceId: modelSelection.instanceId,
1677+
threadId: rootEvent.threadId,
1678+
event: {
1679+
type: "app_thread.created",
1680+
driver: CODEX_DRIVER,
1681+
appThread: { ...offered, title: "Recovered subagent" },
1682+
createOnly: true,
1683+
},
1684+
}),
1685+
[],
1686+
);
16731687
}),
16741688
);
16751689

Collapse file

‎apps/server/src/orchestration-v2/ProviderEventIngestor.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/ProviderEventIngestor.ts
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,8 +544,9 @@ export const layer: Layer.Layer<
544544
);
545545
if (
546546
existing !== null &&
547-
existing.title === offered.title &&
548-
modelSelectionsEqual(existing.modelSelection, offered.modelSelection)
547+
(input.event.createOnly === true ||
548+
(existing.title === offered.title &&
549+
modelSelectionsEqual(existing.modelSelection, offered.modelSelection)))
549550
)
550551
return [];
551552
const now = yield* DateTime.now;
Collapse file

‎packages/provider-core/src/server/ProviderAdapter.ts‎

Copy file name to clipboardExpand all lines: packages/provider-core/src/server/ProviderAdapter.ts
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ export const ProviderAdapterV2Event = Schema.Union([
8080
type: Schema.Literal("app_thread.created"),
8181
driver: ProviderDriverKind,
8282
appThread: OrchestrationV2AppThread,
83+
// Leaves an existing thread's metadata alone.
84+
createOnly: Schema.optional(Schema.Boolean),
8385
}),
8486
Schema.Struct({
8587
type: Schema.Literal("provider_session.updated"),

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.