Fill OpenCode subagent info: task, type, model, and tokens (#2909)
* feat(opencode): fill subagent descriptor with task, type, model, and tokens OpenCode subagent rows rendered with no information: the initial upsert carried only the child session title and status, so the track showed a bare title with an empty second line and the pane tab fell back to "Subagent". Fill the same provider-agnostic descriptor fields Claude populates since #2498, from data OpenCode already emits: - description <- the task tool call's description input (fallback: the child session title), so the task names the row - title <- subagent_type from the task call, else the session's agent - toolCallId <- the parent task tool call id - subtitle <- "agent · model · Variant · Nk tokens", folded from the child's own session record and assistant frames, deduped per child Facts are never inherited from the parent; absent facts render as nothing. Presentation upserts omit status so a late subtitle update cannot revert a finished child (the store's sticky contract). Both task-link orderings are handled, and the hydration path derives the same facts for historical children so restored sessions match live. Server-side only; no protocol or app changes. * fix(opencode): emit subagent type as descriptor title from assistant frames * feat(app): show subagent info line in the provider subagent pane * polish: address subagent presentation review nits * fix(opencode): link subagents from task metadata Current OpenCode task results identify their child session in tool metadata rather than the legacy textual output. Preserve that boundary field so parallel task calls retain the correct description, type, and tool-call association. --------- Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
This commit is contained in:
co-authored by
Mohamed Boudra
parent
e1b4058b77
commit
5465d66edd
@@ -15,6 +15,8 @@ interface ProviderSubagentCase {
|
||||
provider: RewindFlowProvider;
|
||||
sentinel: string;
|
||||
expectedName: string;
|
||||
expectedSubtitle?: RegExp;
|
||||
expectsUserMessage?: boolean;
|
||||
prompt: string;
|
||||
providerConfig?: Parameters<typeof launchAgent>[0]["providerConfig"];
|
||||
}
|
||||
@@ -39,9 +41,12 @@ const cases: ProviderSubagentCase[] = [
|
||||
{
|
||||
provider: "opencode",
|
||||
sentinel: "OPENCODE_CHILD_SENTINEL",
|
||||
expectedName: "Explore",
|
||||
expectedName: "Verify OpenCode descriptor",
|
||||
expectedSubtitle: /explore · gpt-5\.4(?: · [^\n·]+)? · \d+(?:\.\d+)?k? tokens/i,
|
||||
expectsUserMessage: false,
|
||||
providerConfig: { model: "openai/gpt-5.4" },
|
||||
prompt:
|
||||
"Use the task tool exactly once with the explore subagent. Ask it to reply with exactly OPENCODE_CHILD_SENTINEL and do nothing else. Wait for it, then reply ROOT_DONE.",
|
||||
'Use the task tool exactly once with description "Verify OpenCode descriptor" and the explore subagent. Ask it to reply with exactly OPENCODE_CHILD_SENTINEL and do nothing else. Wait for it, then reply ROOT_DONE.',
|
||||
},
|
||||
];
|
||||
|
||||
@@ -51,7 +56,7 @@ test.describe("real provider subagent timelines", () => {
|
||||
for (const scenario of cases) {
|
||||
test(`${scenario.provider} exposes native child output from the subagent track`, async ({
|
||||
page,
|
||||
}) => {
|
||||
}, testInfo) => {
|
||||
const cwd = realpathSync(
|
||||
mkdtempSync(path.join(tmpdir(), `paseo-provider-subagent-${scenario.provider}-`)),
|
||||
);
|
||||
@@ -71,13 +76,52 @@ test.describe("real provider subagent timelines", () => {
|
||||
const rows = page.locator('[data-testid^="subagents-track-row-"]');
|
||||
await expect(rows).toHaveCount(1, { timeout: 60_000 });
|
||||
await expect(rows.first()).toContainText(scenario.expectedName);
|
||||
if (scenario.expectedSubtitle) {
|
||||
await expect(rows.first()).toContainText(scenario.expectedSubtitle);
|
||||
const desktopTrackScreenshot = testInfo.outputPath(
|
||||
`${scenario.provider}-subagent-track-desktop.png`,
|
||||
);
|
||||
await page.screenshot({ path: desktopTrackScreenshot });
|
||||
await testInfo.attach(`${scenario.provider} subagent track desktop`, {
|
||||
path: desktopTrackScreenshot,
|
||||
contentType: "image/png",
|
||||
});
|
||||
}
|
||||
await rows.first().click();
|
||||
|
||||
const panel = page.getByTestId("provider-subagent-panel");
|
||||
await expect(panel).toBeVisible({ timeout: 30_000 });
|
||||
await expect(
|
||||
panel.getByTestId("user-message").filter({ hasText: scenario.sentinel }),
|
||||
).toBeVisible({ timeout: 30_000 });
|
||||
if (scenario.expectedSubtitle) {
|
||||
await expect(page.getByTestId("provider-subagent-pane-subtitle")).toHaveText(
|
||||
scenario.expectedSubtitle,
|
||||
);
|
||||
const desktopScreenshot = testInfo.outputPath(
|
||||
`${scenario.provider}-subagent-desktop.png`,
|
||||
);
|
||||
await page.screenshot({ path: desktopScreenshot });
|
||||
await testInfo.attach(`${scenario.provider} subagent desktop`, {
|
||||
path: desktopScreenshot,
|
||||
contentType: "image/png",
|
||||
});
|
||||
await page.setViewportSize({ width: 494, height: 862 });
|
||||
await expect(page.getByTestId("provider-subagent-pane-subtitle")).toHaveText(
|
||||
scenario.expectedSubtitle,
|
||||
);
|
||||
const compactScreenshot = testInfo.outputPath(
|
||||
`${scenario.provider}-subagent-compact.png`,
|
||||
);
|
||||
await page.screenshot({ path: compactScreenshot });
|
||||
await testInfo.attach(`${scenario.provider} subagent compact`, {
|
||||
path: compactScreenshot,
|
||||
contentType: "image/png",
|
||||
});
|
||||
await page.setViewportSize({ width: 1280, height: 720 });
|
||||
}
|
||||
if (scenario.expectsUserMessage !== false) {
|
||||
await expect(
|
||||
panel.getByTestId("user-message").filter({ hasText: scenario.sentinel }),
|
||||
).toBeVisible({ timeout: 30_000 });
|
||||
}
|
||||
await expect(
|
||||
panel.getByTestId("assistant-message").filter({ hasText: scenario.sentinel }),
|
||||
).toBeVisible({ timeout: 30_000 });
|
||||
|
||||
Reference in New Issue
Block a user