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): defer cancelled task question cleanup reads · pingdotgg/t3code@5dcca64

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src/orchestration-v2
    • Orchestrator.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/Orchestrator.ts
+26-16Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10436,16 +10436,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
1043610436
Effect.gen(function* () {
1043710437
const childControls = yield* projectionStore.getThreadRecords(
1043810438
childThreadId,
10439-
[
10440-
"runs",
10441-
"messages",
10442-
"subagents",
10443-
"providerThreads",
10444-
"providerTurns",
10445-
"attempts",
10446-
"runtimeRequests",
10447-
"nodes",
10448-
],
10439+
["runs", "messages", "subagents", "providerThreads", "providerTurns", "attempts"],
1044910440
{ messageRoles: ["user"] },
1045010441
);
1045110442
const parentThreadId = childControls.thread.lineage.parentThreadId;
@@ -10492,15 +10483,34 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
1049210483
)
1049310484
)
1049410485
return;
10495-
// Completed or failed tasks keep async questions: answering resumes the child.
10486+
// Cancelled or interrupted tasks must not leave async questions that resume the child.
1049610487
// Callers hold the parent lock; dismiss takes the child lock, as follow-up intake does.
10497-
for (const request of childControls.runtimeRequests) {
10498-
if (
10488+
const { runtimeRequests } = yield* projectionStore.getThreadRecords(childThreadId, [
10489+
"runtimeRequests",
10490+
]);
10491+
const pendingQuestions = runtimeRequests.filter(
10492+
(request) =>
1049910493
request.status === "pending" &&
1050010494
request.kind === "user_input" &&
10501-
request.responseCapability.type === "message" &&
10502-
childControls.nodes.some(
10503-
(node) => node.id === request.nodeId && node.runId === resultRun.id,
10495+
request.responseCapability.type === "message",
10496+
);
10497+
if (pendingQuestions.length === 0) return;
10498+
const { nodes } = yield* projectionStore.getThreadRecords(childThreadId, ["nodes"]);
10499+
const resultRunIds = new Set<RunId>();
10500+
let run: OrchestrationV2Run | undefined = resultRun;
10501+
while (run !== undefined && !resultRunIds.has(run.id)) {
10502+
resultRunIds.add(run.id);
10503+
const previousRunId: RunId | undefined = run.restartContinuationOfRunId;
10504+
run =
10505+
previousRunId === undefined
10506+
? undefined
10507+
: childControls.runs.find((candidate) => candidate.id === previousRunId);
10508+
}
10509+
for (const request of pendingQuestions) {
10510+
if (
10511+
nodes.some(
10512+
(node) =>
10513+
node.id === request.nodeId && node.runId !== null && resultRunIds.has(node.runId),
1050410514
)
1050510515
) {
1050610516
yield* dispatchWithReceipt({

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.