diff --git a/src/supervisor/crossagentMcp/SubagentRunManager.test.ts b/src/supervisor/crossagentMcp/SubagentRunManager.test.ts index 1fb1f046..baa71a4c 100644 --- a/src/supervisor/crossagentMcp/SubagentRunManager.test.ts +++ b/src/supervisor/crossagentMcp/SubagentRunManager.test.ts @@ -78,7 +78,10 @@ interface Harness { } function makeHarness(options?: { + providerLabel?: string; models?: Array<{ id: string; label: string }>; + subProviders?: Array<{ id: string; label: string }>; + modelSubProvider?: Record; statusCapabilities?: AgentCapability | null; createFailures?: number; deferCreate?: boolean; @@ -95,9 +98,11 @@ function makeHarness(options?: { const adapter = { kind: "codex", - label: "Codex", + label: options?.providerLabel ?? "Codex", capabilities: { models: options?.models ?? [{ id: "gpt-5.5", label: "GPT-5.5" }], + ...(options?.subProviders ? { subProviders: options.subProviders } : {}), + ...(options?.modelSubProvider ? { modelSubProvider: options.modelSubProvider } : {}), efforts: ["low", "high"], fastModels: ["gpt-5.5"], approvalPolicies: [ @@ -243,6 +248,25 @@ describe("SubagentRunManager", () => { }); }); + it("includes the selected model's sub-provider in the sub-agent name", () => { + const h = makeHarness({ + providerLabel: "OpenCode", + models: [{ id: "opencode-go/qwen3.8-max", label: "Qwen3.8 Max" }], + subProviders: [{ id: "opencode-go", label: "OpenCode Go" }], + }); + h.manager.spawn(PARENT, { + agent: "codex", + prompt: "do work", + model: "opencode-go/qwen3.8-max", + effort: "high", + }); + const started = h.appended.find((a) => a.event.type === "item.started"); + const event = started?.event as Extract | undefined; + expect(event?.payload).toMatchObject({ + name: "OpenCode · OpenCode Go · Qwen3.8 Max · High", + }); + }); + it("re-tags child events: parentItemId → tile, itemIds prefixed with runId", async () => { const h = makeHarness(); const { runId } = h.manager.spawn(PARENT, { agent: "codex", prompt: "go" }); diff --git a/src/supervisor/crossagentMcp/spawnPlan.ts b/src/supervisor/crossagentMcp/spawnPlan.ts index c148bcc0..fec5d97e 100644 --- a/src/supervisor/crossagentMcp/spawnPlan.ts +++ b/src/supervisor/crossagentMcp/spawnPlan.ts @@ -92,8 +92,19 @@ function resolveAttempt( const modelLabel = capabilities.models.find((candidate) => candidate.id === model)?.label ?? model; + const subProviderLabel = capabilities.subProviders?.find((candidate) => { + const mappedId = capabilities.modelSubProvider?.[model]; + return ( + candidate.id === mappedId || + model.startsWith(`${candidate.id}/`) || + model.startsWith(`${candidate.id}:`) + ); + })?.label; const selectionLabel = [ adapter.label, + ...(subProviderLabel && subProviderLabel.toLowerCase() !== adapter.label.toLowerCase() + ? [subProviderLabel] + : []), modelLabel, ...(selection.effort ? [formatReasoningLabel(selection.effort)] : []), ...(selection.fast === true ? ["Fast"] : []),