Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions apps/server/src/relay/AgentAwarenessRelay.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,26 @@ describe("AgentAwarenessRelay", () => {
}),
);

it.effect("never publishes tombstones for subagent threads", () =>
Effect.gen(function* () {
const { relay, currentShell, publications } = yield* makeTestRelay();
yield* Ref.set(
currentShell,
shell({
lineage: {
rootThreadId: THREAD_ID,
parentThreadId: THREAD_ID,
relationshipToParent: "subagent",
},
}),
);
yield* relay.publishThread(THREAD_ID);
yield* TestClock.adjust("5 seconds");
yield* relay.drain;
assert.equal(publications.length, 0);
}),
);

it.effect("confirms a first completed state and respects disabling during confirmation", () =>
Effect.gen(function* () {
const { relay, secrets, currentShell, publications } = yield* makeTestRelay();
Expand Down
10 changes: 10 additions & 0 deletions apps/server/src/relay/AgentAwarenessRelay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,16 @@ export const make = Effect.gen(function* () {
});
const publishIdentity = agentAwarenessPublishIdentity(snapshot.state);
const publishedStateByThread = yield* Ref.get(publishedStateByThreadRef);
if (
Comment thread
macroscopeapp[bot] marked this conversation as resolved.
Outdated
Option.isSome(thread) &&
thread.value.lineage.relationshipToParent === "subagent" &&
!publishedStateByThread.has(threadId)
) {
// Subagents never project activity, so the relay holds no row to clear.
// Their events would otherwise publish a tombstone each, and every
// publish re-delivers the user's aggregate.
return;
}
if (
(snapshot.state?.phase === "completed" || snapshot.state?.phase === "failed") &&
!publishedStateByThread.has(threadId)
Expand Down
Loading