Context
Follow-up from the review of #631 (subagentId trace attribution, issue #612). Non-blocking test-coverage finding — severity: low.
AnthropicDirectQuery threads its subagentId from constructor options into each per-turn RunTurnInput:
// src/agent/providers/anthropic-direct/query.ts
subagentId?: string; // :152 (option)
private readonly subagentId?: string; // :243
if (opts.subagentId !== undefined) this.subagentId = opts.subagentId; // :293
...(this.subagentId !== undefined ? { subagentId: this.subagentId } : {}), // :427 (into RunTurnInput)
Gap
There is no dedicated src/agent/providers/anthropic-direct/query.test.ts asserting this class-level opts.subagentId → RunTurnInput.subagentId threading. Evidence (at PR merge commit 40167768): the directory holds only query-auth-retry.test.ts and a query/ subtree — no query.test.ts.
git ls-tree 40167768 src/agent/providers/anthropic-direct/ | grep query
# → query-auth-retry.test.ts, query.ts, query/ (tree) — no query.test.ts
Mitigation (why it's low, not medium)
The loop-level end of the same thread is covered — src/agent/providers/anthropic-direct/loop.trace.test.ts:281 ("tags tool_call started+completed with subagentId when the loop runs inside a fork") drives RunTurnInput.subagentId → emitted event. What's untested is specifically the AnthropicDirectQuery option → RunTurnInput hop. The openai-compatible side already has an equivalent class-level test (src/agent/providers/openai-compatible/query.test.ts — "tags tool_call events with config.subagentId when running inside a fork"), so this is a parity gap on the anthropic side.
Suggested approach / acceptance criteria
Refs: #631 · #612 · sibling of #633
Context
Follow-up from the review of #631 (subagentId trace attribution, issue #612). Non-blocking test-coverage finding — severity: low.
AnthropicDirectQuerythreads itssubagentIdfrom constructor options into each per-turnRunTurnInput:Gap
There is no dedicated
src/agent/providers/anthropic-direct/query.test.tsasserting this class-levelopts.subagentId → RunTurnInput.subagentIdthreading. Evidence (at PR merge commit40167768): the directory holds onlyquery-auth-retry.test.tsand aquery/subtree — noquery.test.ts.Mitigation (why it's low, not medium)
The loop-level end of the same thread is covered —
src/agent/providers/anthropic-direct/loop.trace.test.ts:281("tags tool_call started+completed with subagentId when the loop runs inside a fork") drivesRunTurnInput.subagentId → emitted event. What's untested is specifically theAnthropicDirectQueryoption →RunTurnInputhop. The openai-compatible side already has an equivalent class-level test (src/agent/providers/openai-compatible/query.test.ts— "tags tool_call events with config.subagentId when running inside a fork"), so this is a parity gap on the anthropic side.Suggested approach / acceptance criteria
src/agent/providers/anthropic-direct/query.test.ts(or extend a query-level test) that constructs anAnthropicDirectQuerywithsubagentIdset and asserts the emittedtool_callevents carry it.subagentIdyields'subagentId' in payload === false(matches the absent-key-on-root-session contract).Refs: #631 · #612 · sibling of #633