镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Commit 54f9223

Browse files
only21milalanjdsclaude
committed
test(server): cover whole replayed ACP thoughts as reasoning
A replayed agent_thought (not only agent_thought_chunk) is now covered by the snapshot test. The reasoning id set is copied only when a new thought starts, and the import event id reuses the turn item id. Co-authored-by: Alan Justino da Silva <155623+alanjds@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 061f6e9 commit 54f9223

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2627,13 +2627,24 @@ describe("AcpAdapterV2", () => {
26272627
content: { type: "text", text: "weighing it" },
26282628
},
26292629
});
2630+
yield* sessionUpdateHandler!({
2631+
sessionId: "mock-session-1",
2632+
update: {
2633+
sessionUpdate: "agent_thought",
2634+
messageId: "whole-thought",
2635+
content: [{ type: "text", text: "settled on it" }],
2636+
},
2637+
});
26302638

26312639
const snapshot = yield* runtime.readThreadSnapshot({ providerThread });
26322640
assert.deepEqual(
26332641
snapshot.messages.map((message) => message.text),
2634-
["before plan", "after plan", "weighing it"],
2642+
["before plan", "after plan", "weighing it", "settled on it"],
2643+
);
2644+
assert.deepEqual(
2645+
snapshot.reasoningMessageIds,
2646+
snapshot.messages.slice(2).map((message) => message.id),
26352647
);
2636-
assert.deepEqual(snapshot.reasoningMessageIds, [snapshot.messages[2]!.id]);
26372648
}).pipe(Effect.provide(layerTest), Effect.scoped),
26382649
);
26392650

‎apps/server/src/project/AgentSessionImporter.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ function messageEvents(input: {
140140
updatedAt: at,
141141
};
142142
const turnItemEvent = (payload: OrchestrationV2TurnItem): OrchestrationV2DomainEvent => ({
143-
id: EventId.make(`${IMPORT_EVENT_PREFIX}:turn-item:${input.threadId}:${suffix}`),
143+
id: EventId.make(turnItemId),
144144
type: "turn-item.updated",
145145
threadId: input.threadId,
146146
occurredAt: at,

‎packages/provider-acp/src/server/adapter.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4554,7 +4554,7 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
45544554
order: current.order.includes(key) ? current.order : [...current.order, key],
45554555
messages,
45564556
reasoningIds:
4557-
role === "thought"
4557+
role === "thought" && !current.reasoningIds.has(messageId)
45584558
? new Set(current.reasoningIds).add(messageId)
45594559
: current.reasoningIds,
45604560
loadingRole: role,

0 commit comments

Comments
 (0)