Skip to content

Commit db398e0

Browse files
committed
Merge remote-tracking branch 'origin/main' into perf/connect-and-shell-sync
2 parents f9d0998 + 84e69da commit db398e0

37 files changed

Lines changed: 1423 additions & 195 deletions

‎apps/server/src/attachmentStore.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,21 @@ describe("threadHtmlRenderAttachmentIds", () => {
176176
).toEqual([own]);
177177
});
178178

179+
it("includes pages an OpenCode Code Mode execute script returned", () => {
180+
const own = createAttachmentId("thread-a", "html")!;
181+
expect(
182+
threadHtmlRenderAttachmentIds("thread-a", [
183+
{
184+
toolName: "execute",
185+
output: JSON.stringify({
186+
htmlRender: { attachmentId: own, title: "x", height: 300 },
187+
message: "Shown to the reader above your reply.",
188+
}),
189+
},
190+
]),
191+
).toEqual([own]);
192+
});
193+
179194
it("includes captured MCP App documents from any tool", () => {
180195
const app = createAttachmentId("thread-a", "html")!;
181196
expect(

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

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6832,6 +6832,94 @@ describe("ClaudeAdapterV2 background wake turns", () => {
68326832
),
68336833
);
68346834

6835+
// regression: #17270 root text_delta frames stream the reply before the block's snapshot
6836+
it.effect("streams Claude assistant text deltas before the completed snapshot", () =>
6837+
Effect.gen(function* () {
6838+
const harness = yield* makeWakeHarness;
6839+
yield* harness.runtime.startTurn(
6840+
makeClaudeTestTurnInput({
6841+
threadId: harness.threadId,
6842+
providerThread: harness.providerThread,
6843+
now: yield* DateTime.now,
6844+
attemptId: RunAttemptId.make("text-stream-attempt"),
6845+
text: "Write two paragraphs",
6846+
attachments: [],
6847+
}),
6848+
);
6849+
const stream = (event: unknown) =>
6850+
claudeSdkFrame({
6851+
type: "stream_event",
6852+
event,
6853+
parent_tool_use_id: null,
6854+
session_id: WAKE_NATIVE_SESSION,
6855+
uuid: "stream-frame",
6856+
});
6857+
yield* harness.offerAndWait(
6858+
stream({ type: "message_start", message: { id: "text-message" } }),
6859+
);
6860+
yield* harness.offerAndWait(
6861+
stream({
6862+
type: "content_block_start",
6863+
index: 0,
6864+
content_block: { type: "text", text: "" },
6865+
}),
6866+
);
6867+
yield* harness.offerAndWait(
6868+
stream({
6869+
type: "content_block_delta",
6870+
index: 0,
6871+
delta: { type: "text_delta", text: "First paragraph.\n\n" },
6872+
}),
6873+
);
6874+
yield* harness.offerAndWait(
6875+
stream({
6876+
type: "content_block_delta",
6877+
index: 0,
6878+
delta: { type: "text_delta", text: "Second paragraph." },
6879+
}),
6880+
);
6881+
yield* harness.offerAndWait(stream({ type: "content_block_stop", index: 0 }));
6882+
yield* Queue.offer(
6883+
harness.sdkMessages,
6884+
claudeSdkFrame({
6885+
type: "assistant",
6886+
uuid: "text-snapshot",
6887+
session_id: WAKE_NATIVE_SESSION,
6888+
parent_tool_use_id: null,
6889+
message: {
6890+
id: "text-message",
6891+
model: "claude-sonnet-4-6",
6892+
content: [{ type: "text", text: "First paragraph.\n\nSecond paragraph." }],
6893+
},
6894+
}),
6895+
);
6896+
yield* Queue.offer(harness.sdkMessages, makeResultFrame({ uuid: "text-result", result: "" }));
6897+
yield* Queue.take(harness.terminalReceipts);
6898+
const replies = harness.events.flatMap((event) =>
6899+
event.type === "turn_item.updated" && event.turnItem.type === "assistant_message"
6900+
? [event.turnItem]
6901+
: [],
6902+
);
6903+
// The stream's own item carries the reply; the block's snapshot does not repeat it.
6904+
assert.deepEqual(
6905+
[...new Set(replies.map((item) => item.nativeItemRef?.nativeId))],
6906+
["text-message:text:0"],
6907+
);
6908+
assert.equal(replies.at(-1)?.text, "First paragraph.\n\nSecond paragraph.");
6909+
assert.equal(replies.at(-1)?.status, "completed");
6910+
}).pipe(
6911+
Effect.scoped,
6912+
Effect.provide(
6913+
Layer.mergeAll(
6914+
IdAllocator.layer,
6915+
McpProviderSessions.layer,
6916+
NodeServices.layer,
6917+
NodeCrypto.layer,
6918+
),
6919+
),
6920+
),
6921+
);
6922+
68356923
// regression: #15892 non-execution metadata is carried through, not guessed from result text
68366924
it.effect.each(["cancelled", "interrupted", "denied", "permission_denied", undefined])(
68376925
"preserves native tool non-execution metadata %s without inferring a denial from text",

0 commit comments

Comments
 (0)