The best way to control Claude Code, Codex and more from any computer or phone
fix(server): hide passive Claude Stop-hook summaries (#22964)
Julius Marminge committed
Nov 10, 2026 at 23:17 UTC
5badea5b454c8e39e15e95be5e0e096b25b7b577
2 files changed
+75
-1
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
+64
@@ -8431,6 +8431,70 @@ describe("ClaudeAdapterV2 background wake turns", () => {
8431
),
8432
);
8433
8434
+ // The passive row is the frame Claude 2.1.303 emits for a Stop hook returning a systemMessage.
8435
+ it.effect.each([
8436
+ { name: "hides a passive summary", level: "notice", visible: false },
8437
+ { name: "shows a blocking notice", level: "notice", preventContinuation: true, visible: true },
8438
+ { name: "shows a warning", level: "warning", visible: true },
8439
+ ])("Claude Stop-hook notices: $name", ({ level, preventContinuation, visible }) =>
8440
+ Effect.gen(function* () {
8441
+ const harness = yield* makeWakeHarness;
8442
+ yield* harness.runtime.startTurn(
8443
+ makeClaudeTestTurnInput({
8444
+ threadId: harness.threadId,
8445
+ providerThread: harness.providerThread,
8446
+ now: yield* DateTime.now,
8447
+ attemptId: RunAttemptId.make("claude-stop-hook-notice-attempt"),
8448
+ text: "Continue.",
8449
+ attachments: [],
8450
+ }),
8451
+ );
8452
+ const content = "Stop says: 40 scans, 0 findings";
8453
+ yield* Queue.offer(
8454
+ harness.sdkMessages,
8455
+ claudeSdkFrame({
8456
+ type: "system",
8457
+ subtype: "informational",
8458
+ content,
8459
+ level,
8460
+ ...(preventContinuation === undefined
8461
+ ? {}
8462
+ : { prevent_continuation: preventContinuation }),
8463
+ session_id: WAKE_NATIVE_SESSION,
8464
+ uuid: "00000000-0000-4000-8000-000000000820",
8465
+ }),
8466
+ );
8467
+ yield* Queue.offer(
8468
+ harness.sdkMessages,
8469
+ makeResultFrame({ uuid: "00000000-0000-4000-8000-000000000821", result: content }),
8470
+ );
8471
+ assert.equal((yield* Queue.take(harness.terminalReceipts)).status, "completed");
8472
+ assert.deepEqual(
8473
+ harness.events.flatMap((event) =>
8474
+ event.type === "turn_item.updated" && event.turnItem.type === "system_notice"
8475
+ ? [event.turnItem.message]
8476
+ : [],
8477
+ ),
8478
+ visible ? [content] : [],
8479
+ );
8480
+ assert.isFalse(
8481
+ harness.events.some(
8482
+ (event) => event.type === "message.updated" && event.message.role === "assistant",
8483
+ ),
8484
+ );
8485
+ }).pipe(
8486
+ Effect.scoped,
8487
+ Effect.provide(
8488
+ Layer.mergeAll(
8489
+ NodeServices.layer,
8490
+ NodeCrypto.layer,
8491
+ IdAllocator.layer,
8492
+ McpProviderSessions.layer,
8493
+ ),
8494
+ ),
8495
+ ),
8496
+ );
8497
+
8498
it.effect("shows a hook-dropped Claude prompt once and skips info-level lines", () =>
8499
Effect.gen(function* () {
8500
const harness = yield* makeWakeHarness;
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
+11
-1
@@ -9361,9 +9361,19 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
9361
(message.subtype === "model_refusal_fallback" ||
9362
(message.subtype === "informational" && message.level !== "info"))
9363
) {
9364
+ context.assistant.noticeTexts.add(message.content);
9365
+ // A Stop hook's systemMessage arrives as a passive notice after every turn.
9366
+ // Warnings and notices that prevent continuation explain a blocked turn.
9367
+ if (
9368
+ message.subtype === "informational" &&
9369
+ message.level === "notice" &&
9370
+ message.content.startsWith("Stop says: ") &&
9371
+ message.prevent_continuation !== true
9372
+ ) {
9373
+ return;
9374
+ }
9375
const now = yield* DateTime.now;
9376
const nativeItemId = message.uuid;
9366
- context.assistant.noticeTexts.add(message.content);
9377
yield* emitProviderEvent({
9378
type: "turn_item.updated",
9379
driver: CLAUDE_PROVIDER,