Skip to content

Commit 8e33fdc

Browse files
test(server): reproduce #27004, agent launch in a linked environment keeps delegatedFrom
An agent's t3_thread_launch forwarded to a linked environment passes its own delegatedFrom through, so the thread there is stamped as a delegated child no parent lists. The launch the box receives must carry none. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 37fbefd commit 8e33fdc

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

‎apps/server/src/peer/PeerForwarding.test.ts‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,38 @@ it.effect("launches in a linked environment with the caller's modes, retry-safe"
530530
).pipe(Effect.provide(NodeHttpServer.layerTest)),
531531
);
532532

533+
it.effect("an agent's launch in a linked environment is top-level, whatever it claims", () =>
534+
Effect.scoped(
535+
Effect.gen(function* () {
536+
const seen = yield* Ref.make<Seen>(nothingSeen);
537+
const linkSession = yield* Ref.make("");
538+
const b = yield* serveBox(seen, linkSession);
539+
const a = yield* makeLaptop;
540+
yield* linkTo(a.links, b, "full-access");
541+
yield* Ref.set(linkSession, (yield* b.linkedSessions)[0]!.sessionId);
542+
543+
// Only delegate_task records the parent's side of a delegation, so a
544+
// child claimed here would be hidden there with no parent listing it.
545+
const launched = yield* a.call("thread:laptop-full", "t3_thread_launch", {
546+
environmentId: box.environmentId,
547+
projectId: boxProject,
548+
title: "Run the suite there",
549+
modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5" },
550+
message: "Run the suite.",
551+
clientRequestId: "launch-claimed-child",
552+
delegatedFrom: {
553+
environmentId: laptop.environmentId,
554+
threadId: "thread:laptop-full",
555+
title: "Laptop thread",
556+
},
557+
});
558+
expect(failureOf(launched)).toBeUndefined();
559+
const [received] = (yield* Ref.get(seen)).launches;
560+
expect(received?.delegatedFrom).toBeUndefined();
561+
}),
562+
).pipe(Effect.provide(NodeHttpServer.layerTest)),
563+
);
564+
533565
it.effect("brings a repository to a linked environment, only through full access", () =>
534566
Effect.scoped(
535567
Effect.gen(function* () {

0 commit comments

Comments
 (0)