diff --git a/apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts b/apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts index a514a2883b..4c41dad10a 100644 --- a/apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts +++ b/apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts @@ -1298,6 +1298,7 @@ describe("ClaudeAdapterV2 background wake turns", () => { const makeWakeHarnessWithOptions = (options?: { readonly close?: (sdkMessages: Queue.Queue) => Effect.Effect; readonly interrupt?: Effect.Effect; + readonly stopTask?: (taskId: string) => Effect.Effect; }) => Effect.gen(function* () { const fileSystem = yield* FileSystem.FileSystem; @@ -1332,7 +1333,7 @@ describe("ClaudeAdapterV2 background wake turns", () => { }), setModel: () => Effect.void, interrupt: options?.interrupt ?? Effect.void, - stopTask: () => Effect.void, + stopTask: options?.stopTask ?? (() => Effect.void), close: options?.close?.(sdkMessages) ?? Effect.void, }), forkSession: () => Effect.die("unused forkSession"), @@ -1386,11 +1387,29 @@ describe("ClaudeAdapterV2 background wake turns", () => { it.effect("treats a stop after query release as already complete", () => Effect.scoped( Effect.gen(function* () { - const harness = yield* makeWakeHarness; + const stoppedTaskIds = yield* Ref.make>([]); + const harness = yield* makeWakeHarnessWithOptions({ + stopTask: (taskId) => Ref.update(stoppedTaskIds, (current) => [...current, taskId]), + }); if (harness.runtime.stopTask === undefined) { return yield* Effect.die("Claude adapter runtime must expose stopTask."); } + const now = yield* DateTime.now; + yield* harness.runtime.startTurn( + makeClaudeTestTurnInput({ + threadId: harness.threadId, + providerThread: harness.providerThread, + now, + attemptId: RunAttemptId.make("attempt-claude-stop-after-release"), + text: "Start a query that will be released.", + attachments: [], + }), + ); + yield* Queue.shutdown(harness.sdkMessages); + yield* awaitUntil(() => harness.terminalEvents().length === 1, "released query terminal"); + yield* harness.runtime.stopTask({ nativeTaskId: WAKE_TASK_ID }); + assert.deepEqual(yield* Ref.get(stoppedTaskIds), []); }).pipe(Effect.provide(Layer.merge(idAllocatorLayer, NodeServices.layer))), ), ); diff --git a/apps/server/src/orchestration-v2/SubagentObservability.test.ts b/apps/server/src/orchestration-v2/SubagentObservability.test.ts index b18141b7ea..268b49b8d4 100644 --- a/apps/server/src/orchestration-v2/SubagentObservability.test.ts +++ b/apps/server/src/orchestration-v2/SubagentObservability.test.ts @@ -63,11 +63,14 @@ describe("subagent observability", () => { it("bounds recent activity and deduplicates adjacent updates", () => { const now = DateTime.makeUnsafe("2026-07-26T00:00:00.000Z"); - const activity = Array.from({ length: 8 }, (_, index) => `step ${index}`).reduce( + const first = appendSubagentActivity([], "step 0", now); + const deduplicated = appendSubagentActivity(first, "step 0", now); + const activity = Array.from({ length: 7 }, (_, index) => `step ${index + 1}`).reduce( (current, summary) => appendSubagentActivity(current, summary, now), - appendSubagentActivity([], "step 0", now), + deduplicated, ); + expect(deduplicated).toBe(first); expect(activity).toHaveLength(6); expect(activity.map((entry) => entry.summary)).toEqual([ "step 2", diff --git a/apps/web/src/components/chat/MessagesTimeline.test.tsx b/apps/web/src/components/chat/MessagesTimeline.test.tsx index 6b1629205a..a3e29c1bd8 100644 --- a/apps/web/src/components/chat/MessagesTimeline.test.tsx +++ b/apps/web/src/components/chat/MessagesTimeline.test.tsx @@ -1219,7 +1219,7 @@ describe("MessagesTimeline", () => { expect(markup).not.toContain("Work Log"); }); - it("keeps completed subagent detail in the Agents panel", async () => { + it("omits completed subagent detail from the timeline CTA", async () => { const { MessagesTimeline } = await import("./MessagesTimeline"); const markup = renderToStaticMarkup(