fix(claude): consume undeclared background_tasks_changed silently

The SDK stream emits this roster snapshot but its subtype is absent from
the typed union, so it fell through to the unknown-subtype warning path
and rendered as a spurious error row ('no displayable text content') in
client work logs. The task_* lifecycle events carry the authoritative
per-agent data; the typed background_tasks control request remains the
reconciliation source.

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
Theo BrowneandClaude Fable 5 committed 2026-07-21 20:00:02 -07:00
1 parent ffd01045d0
commit 61d0c38337
1 file changed
+18
@@ -1823,6 +1823,24 @@ describe("ClaudeAdapterLive", () => {
assert.equal(statusPatch.payload.isBackgrounded, true);
assert.equal(statusPatch.payload.errorMessage, "waiting");
}
// The undeclared background_tasks_changed roster snapshot is consumed
// silently — it must not surface as an unknown-subtype warning row.
harness.query.emit({
type: "system",
subtype: "background_tasks_changed",
tasks: [{ task_id: "workflow-1", task_type: "local_workflow", description: "Run checks" }],
session_id: "session",
uuid: "roster",
} as unknown as SDKMessage);
yield* Effect.yieldNow;
const rosterWarnings = runtimeEvents.filter(
(event) =>
event.type === "runtime.warning" &&
typeof event.payload.message === "string" &&
event.payload.message.includes("background_tasks_changed"),
);
assert.equal(rosterWarnings.length, 0);
}).pipe(
Effect.provideService(Random.Random, makeDeterministicRandomService()),
Effect.provide(harness.layer),