diff --git a/packages/app/e2e/regression/session-timeline-notices.spec.ts b/packages/app/e2e/regression/session-timeline-notices.spec.ts
index 686b01f843d..48119a6ce6d 100644
--- a/packages/app/e2e/regression/session-timeline-notices.spec.ts
+++ b/packages/app/e2e/regression/session-timeline-notices.spec.ts
@@ -1,6 +1,6 @@
import { expect, test } from "@playwright/test"
import type { SessionMessageAssistant, SessionMessageInfo } from "@opencode-ai/client/promise"
-import { event, session, sessionID, setupTimeline } from "../performance/timeline-stability/fixture"
+import { event, session, sessionID, setupTimeline, toolPart } from "../performance/timeline-stability/fixture"
const user = { id: "msg_user", type: "user", text: "Run it", time: { created: 1 } } satisfies SessionMessageInfo
@@ -73,6 +73,30 @@ test("renders current protocol notices in CLI order", async ({ page }) => {
expect(ownerWarnings).toEqual([])
})
+test("shows a delegating row while subagent input streams", async ({ page }) => {
+ await setupTimeline(page, {
+ sessionMessages: [
+ user,
+ {
+ ...assistant(false),
+ content: [toolPart("call_subagent", "subagent", "streaming", {})],
+ },
+ ],
+ })
+
+ const delegating = page.locator('[data-component="task-tool-delegating"]')
+ await expect(delegating).toBeVisible()
+ await expect(delegating.locator('[data-component="text-shimmer"]')).toHaveAttribute(
+ "aria-label",
+ "Delegating agent...",
+ )
+ const icon = delegating.locator('[data-slot="icon-svg"]')
+ await expect(icon.locator('use[href="#opencode-v2-icon-subagent"]')).toBeVisible()
+ await expect(icon).toHaveCSS("color", "rgb(174, 174, 174)")
+ await expect(page.locator('[data-component="task-tool-card"]')).toHaveCount(0)
+ await expect(page.locator('[data-timeline-row="Thinking"]')).toHaveCount(0)
+})
+
test("moves blocking work to the background with Ctrl+B", async ({ page }) => {
await setupTimeline(page, { sessionMessages: [user, assistant(false, true)] })
const card = page.locator('[data-component="task-tool-card"]')
@@ -83,20 +107,19 @@ test("moves blocking work to the background with Ctrl+B", async ({ page }) => {
await expect(page.locator('[data-component="background-tool-control"]')).toHaveCount(0)
const hint = page.locator('[data-component="session-background-hint"]')
const hintPrefix = hint.locator('[data-slot="session-background-hint-prefix"]')
- const thinking = page.locator('[data-slot="session-turn-thinking"]')
await expect(hint).toBeVisible()
+ await expect(page.locator('[data-timeline-row="Thinking"]')).toHaveCount(0)
await expect
.poll(async () => {
- const [cardBox, hintBox, prefixBox, thinkingBox] = await Promise.all([
+ const [cardBox, hintBox, prefixBox] = await Promise.all([
card.boundingBox(),
hint.boundingBox(),
hintPrefix.boundingBox(),
- thinking.boundingBox(),
])
- if (!cardBox || !hintBox || !prefixBox || !thinkingBox) return undefined
+ if (!cardBox || !hintBox || !prefixBox) return undefined
return {
aligned: Math.abs(cardBox.x - prefixBox.x) < 2,
- ordered: cardBox.y < hintBox.y && hintBox.y < thinkingBox.y,
+ ordered: cardBox.y < hintBox.y,
}
})
.toEqual({ aligned: true, ordered: true })
diff --git a/packages/session-ui/src/timeline/projection.ts b/packages/session-ui/src/timeline/projection.ts
index 8dbf2edfa77..cfa2ed83c50 100644
--- a/packages/session-ui/src/timeline/projection.ts
+++ b/packages/session-ui/src/timeline/projection.ts
@@ -222,6 +222,12 @@ export namespace Timeline {
.filter((entry) => renderable(entry.content, showReasoning))
.map((entry) => ({ messageID: message.id, messageIndex, partID: entry.id, content: entry.content })),
)
+ const delegating = assistantPartRefs.some(
+ (entry) =>
+ entry.content.type === "tool" &&
+ entry.content.name === "subagent" &&
+ (entry.content.state.status === "streaming" || entry.content.state.status === "running"),
+ )
if (previousUserMessage) rows.push(new TimelineRow.TurnGap({ userMessageID: turnID }))
if (userMessage) rows.push(new TimelineRow.UserMessage({ userMessageID: turnID }))
@@ -273,6 +279,7 @@ export namespace Timeline {
status.type === "busy" &&
!error &&
!retry &&
+ !delegating &&
(showReasoning ? assistantPartRefs.length === 0 : true)
) {
const heading = assistantMessages
diff --git a/packages/session-ui/src/timeline/rows-current.test.ts b/packages/session-ui/src/timeline/rows-current.test.ts
index a40e603453a..0dccd416cdd 100644
--- a/packages/session-ui/src/timeline/rows-current.test.ts
+++ b/packages/session-ui/src/timeline/rows-current.test.ts
@@ -166,6 +166,38 @@ describe("current session timeline rows", () => {
])
})
+ test("suppresses thinking while a subagent is delegating or running", () => {
+ const statuses = ["streaming", "running"] as const
+ statuses.forEach((status) => {
+ const source = [
+ { id: "msg_user", type: "user", text: "delegate", time: { created: 1 } },
+ {
+ id: "msg_assistant",
+ type: "assistant",
+ agent: "build",
+ model: { id: "model", providerID: "provider" },
+ content: [
+ {
+ type: "tool",
+ id: "tool_subagent",
+ name: "subagent",
+ state:
+ status === "streaming"
+ ? { status, input: "" }
+ : { status, input: { description: "Inspect code" }, metadata: {} },
+ time: { created: 2 },
+ },
+ ],
+ time: { created: 2 },
+ },
+ ] satisfies SessionMessageInfo[]
+
+ expect(Timeline.constructSessionMessageRows(source, false, { type: "busy" }).rows.map((row) => row._tag)).toEqual(
+ ["UserMessage", "AssistantPart"],
+ )
+ })
+ })
+
test("renders retry state from the current assistant message", () => {
const source = [
{ id: "msg_user", type: "user", text: "retry", time: { created: 1 } },
diff --git a/packages/session-ui/src/tools/tool-renderer.tsx b/packages/session-ui/src/tools/tool-renderer.tsx
index a0dc5a6f21f..d8e71a19f61 100644
--- a/packages/session-ui/src/tools/tool-renderer.tsx
+++ b/packages/session-ui/src/tools/tool-renderer.tsx
@@ -1023,6 +1023,7 @@ ToolRegistry.register({
render(props) {
const data = useData()
const i18n = useI18n()
+ const delegating = () => props.status === "streaming"
const childSessionId = createMemo(() => {
const value = props.metadata.sessionID
if (typeof value === "string" && value) return value
@@ -1114,17 +1115,33 @@ ToolRegistry.register({
)
return (
-