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): end obsolete link cards after a matching retry succeeds … · Pipyakas/t3code@77ad2eb

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src
    • orchestration-v2
      • Orchestrator.ts
    • peer
      • PeerLinkRequests.test.ts
      • PeerLinkRequests.ts
  • packages/contracts/src
    • orchestrationV2.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
+46Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,18 @@ function cancelledAppOwnedTask(
763763
};
764764
}
765765

766+
function askedForLinkedMachine(
767+
card: Extract<OrchestrationV2TurnItem, { readonly type: "link_request" }>,
768+
linked: Extract<OrchestrationV2InternalCommand, { readonly type: "link_request.record" }>,
769+
): boolean {
770+
if (card.requestedAccess !== linked.requestedAccess) return false;
771+
if (card.environmentId !== undefined) return card.environmentId === linked.linkedEnvironmentId;
772+
if (card.url !== undefined) return linked.url !== undefined && card.url === linked.url;
773+
const normalize = (text: string | undefined) => text?.trim().toLowerCase() ?? "";
774+
const hint = normalize(card.hint);
775+
return hint !== "" && hint === normalize(linked.hint) && hint === normalize(linked.linkedLabel);
776+
}
777+
766778
// A workspace change detaches the session, which can settle the calling run at once. Queuing its
767779
// follow-up in a later command would let a delegated task report its result before that exists.
768780
function metadataUpdateContinuation(
@@ -10448,6 +10460,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
1044810460
type: _type,
1044910461
commandId: _commandId,
1045010462
turnItemId: _turnItemId,
10463+
answeringTurnItemIds,
1045110464
wake,
1045210465
...fields
1045310466
} = command;
@@ -10507,6 +10520,39 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
1050710520
occurredAt: now,
1050810521
payload: turnItem,
1050910522
});
10523+
// The link answers the older cards that asked for the same machine and
10524+
// access. They end without waking anyone: the agent hears this link.
10525+
// A card still being answered stays open for its own answer to end.
10526+
if (!unchanged && command.linkStatus === "linked") {
10527+
for (const item of projection.turnItems) {
10528+
if (
10529+
item.type !== "link_request" ||
10530+
item.linkStatus !== "pending" ||
10531+
item.ordinal >= turnItem.ordinal ||
10532+
answeringTurnItemIds?.includes(item.id) === true ||
10533+
!askedForLinkedMachine(item, command)
10534+
) {
10535+
continue;
10536+
}
10537+
yield* emit(
10538+
events,
10539+
command,
10540+
)({
10541+
type: "turn-item.updated",
10542+
threadId: command.threadId,
10543+
...(item.runId === null ? {} : { runId: item.runId }),
10544+
...(item.nodeId === null ? {} : { nodeId: item.nodeId }),
10545+
occurredAt: now,
10546+
payload: {
10547+
...item,
10548+
status: "cancelled",
10549+
linkStatus: "cancelled",
10550+
completedAt: now,
10551+
updatedAt: now,
10552+
},
10553+
});
10554+
}
10555+
}
1051010556
// The agent asked without waiting, so the answer reaches it as a
1051110557
// notification: it starts a turn, or follows the one running. Only the
1051210558
// answer that closes the card wakes it, and never a closed thread.

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.