Skip to content

Commit 419592a

Browse files
test(server): build the SendMessage resume ACK as the CLI sends it
The resume test's ACK text dropped the short agent id and the pin object the recorded frame carries, and omitted tool_use_result. Build both from one object shaped like the claude_background_subagent_lifecycle recording. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent 8a12b6c commit 419592a

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,6 +1717,8 @@ describe("ClaudeAdapterV2 native session identity", () => {
17171717
);
17181718
});
17191719

1720+
const encodeJsonString = Schema.encodeSync(Schema.fromJsonString(Schema.Unknown));
1721+
17201722
describe("ClaudeAdapterV2 background wake turns", () => {
17211723
const WAKE_NATIVE_SESSION = "native-thread-claude-wake";
17221724
// Background Bash ids and texts follow the claude_background_task_wake
@@ -4947,6 +4949,15 @@ describe("ClaudeAdapterV2 background wake turns", () => {
49474949
}),
49484950
);
49494951
yield* Queue.offer(harness.sdkMessages, resumeTaskStarted);
4952+
// Shaped like the recorded SendMessage ACK in
4953+
// claude_background_subagent_lifecycle: the text block is the JSON of
4954+
// tool_use_result, and "message" names the agent's short id.
4955+
const resumeAck = {
4956+
success: true,
4957+
message: `Resuming agent ${SUBAGENT_TASK_ID.slice(0, 7)}`,
4958+
resumedAgentId: SUBAGENT_TASK_ID,
4959+
pin: { id: SUBAGENT_TASK_ID, name: SUBAGENT_TASK_ID, ref: "42ab31" },
4960+
};
49504961
yield* Queue.offer(
49514962
harness.sdkMessages,
49524963
claudeSdkFrame({
@@ -4955,12 +4966,12 @@ describe("ClaudeAdapterV2 background wake turns", () => {
49554966
role: "user",
49564967
content: [
49574968
{
4958-
type: "tool_result",
49594969
tool_use_id: RESUME_TOOL_USE_ID,
4970+
type: "tool_result",
49604971
content: [
49614972
{
49624973
type: "text",
4963-
text: `{"success":true,"message":"Resuming agent","resumedAgentId":"${SUBAGENT_TASK_ID}"}`,
4974+
text: encodeJsonString(resumeAck),
49644975
},
49654976
],
49664977
},
@@ -4969,6 +4980,7 @@ describe("ClaudeAdapterV2 background wake turns", () => {
49694980
parent_tool_use_id: null,
49704981
uuid: "00000000-0000-4000-8000-000000000509",
49714982
session_id: WAKE_NATIVE_SESSION,
4983+
tool_use_result: resumeAck,
49724984
}),
49734985
);
49744986
yield* Queue.offer(harness.sdkMessages, secondNotification);

0 commit comments

Comments
 (0)