Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion src/supervisor/crossagentMcp/SubagentRunManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string>;
statusCapabilities?: AgentCapability | null;
createFailures?: number;
deferCreate?: boolean;
Expand All @@ -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: [
Expand Down Expand Up @@ -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<RuntimeEvent, { type: "item.started" }> | 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" });
Expand Down
11 changes: 11 additions & 0 deletions src/supervisor/crossagentMcp/spawnPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"] : []),
Expand Down