@@ -3686,6 +3686,78 @@ describe("ClaudeAdapterV2 background wake turns", () => {
36863686 ),
36873687 );
36883688
3689+ it.effect("shows a hook-dropped Claude prompt once and skips info-level lines", () =>
3690+ Effect.gen(function* () {
3691+ const harness = yield* makeWakeHarness;
3692+ const now = yield* DateTime.now;
3693+ yield* harness.runtime.startTurn(
3694+ makeClaudeTestTurnInput({
3695+ threadId: harness.threadId,
3696+ providerThread: harness.providerThread,
3697+ now,
3698+ attemptId: RunAttemptId.make("claude-hook-dropped-prompt-attempt"),
3699+ text: "Deploy to production",
3700+ attachments: [],
3701+ }),
3702+ );
3703+ const notice = "Prompt dropped by a hook: Deploys are frozen until Monday.";
3704+ const uuid = "00000000-0000-4000-8000-000000000305";
3705+ yield* Queue.offer(
3706+ harness.sdkMessages,
3707+ claudeSdkFrame({
3708+ type: "system",
3709+ subtype: "informational",
3710+ content: "Started in the background: agent-1",
3711+ level: "info",
3712+ session_id: WAKE_NATIVE_SESSION,
3713+ uuid: "00000000-0000-4000-8000-000000000307",
3714+ }),
3715+ );
3716+ yield* Queue.offer(
3717+ harness.sdkMessages,
3718+ claudeSdkFrame({
3719+ type: "system",
3720+ subtype: "informational",
3721+ content: notice,
3722+ level: "warning",
3723+ prevent_continuation: true,
3724+ session_id: WAKE_NATIVE_SESSION,
3725+ uuid,
3726+ }),
3727+ );
3728+ yield* Queue.offer(
3729+ harness.sdkMessages,
3730+ makeResultFrame({
3731+ uuid: "00000000-0000-4000-8000-000000000306",
3732+ result: notice,
3733+ numTurns: 0,
3734+ terminalReason: null,
3735+ }),
3736+ );
3737+ yield* Queue.take(harness.terminalReceipts);
3738+ const notices = harness.events.flatMap((event) =>
3739+ event.type === "turn_item.updated" && event.turnItem.type === "system_notice"
3740+ ? [event.turnItem]
3741+ : [],
3742+ );
3743+ assert.lengthOf(notices, 1);
3744+ assert.equal(notices[0]?.message, notice);
3745+ assert.equal(notices[0]?.status, "completed");
3746+ assert.equal(notices[0]?.nativeItemRef?.nativeId, uuid);
3747+ assert.equal(harness.terminalEvents()[0]?.status, "completed");
3748+ assert.isFalse(
3749+ harness.events.some(
3750+ (event) => event.type === "message.updated" && event.message.role === "assistant",
3751+ ),
3752+ );
3753+ }).pipe(
3754+ Effect.scoped,
3755+ Effect.provide(
3756+ Layer.mergeAll(NodeServices.layer, IdAllocator.layer, McpProviderSessions.layer),
3757+ ),
3758+ ),
3759+ );
3760+
36893761 it.effect(
36903762 "runs native compaction and keeps its context watermark separate from billed usage",
36913763 () =>
0 commit comments