Skip to content

Show a bot's sub agent as a normal coding chat page (851-4478) - #1481

Merged
pondorasti merged 7 commits into
mainfrom
alexandru/851-4478-bot-sub-agents-parent-row-doesnt-go-back
Nov 26, 2026
Merged

pondorasti merged 7 commits into
mainfrom
alexandru/851-4478-bot-sub-agents-parent-row-doesnt-go-back

Conversation

@pondorasti

@pondorasti pondorasti commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Fixes 851-4478

Cause

A coding agent that a bot started was drawn inside the bot's own conversation page: a second, bot-only screen (BotAgentScreen) swapped into the bot's pane, in the bot's workspace. Everything keyed on "this is the bot's workspace" then applied to the agent:

  • the slim bot composer (round + and a plain pill, no model picker),
  • the hidden window title, replaced by a centred bot-style pill,
  • the transparent bot titlebar with no divider.

The Parent row in the inspector set the selection to the bot. The bot was already the selection (the agent page is separate state on top of it), so nothing happened.

Change

One decision, read everywhere: BotPages (CodevisorCore) says what a bot's page shows: its conversation, a thread, or one of its agents.

  • The bot's open agent goes through the same chat pane code as any coding chat, so it gets the normal composer, attachment drop and session updates. BotAgentScreen and its pill header are deleted.
  • While an agent is shown, the page uses the coding chrome: the normal window title (renamable, like a main chat), the titlebar divider, an opaque titlebar. The back button stays.
  • selectChat now also opens a bot's own conversation, closing whatever page is over it. The inspector's Parent row, notification clicks and "open chat" all go through it, so they all return to the bot.
  • Keyboard focus, the unread "focused chat", the inspector's tasks and the debug transcript row follow the agent while its page is open.

iOS: checked, none of the three exist there. A bot's sub agent opens as its own pushed screen (AgentChatScreen) with the normal composer, the navigation title and the system back button, and iOS has no Parent row.

Tests

BotPagesTests (new, CodevisorCore): an agent opens in place of the conversation, opening the bot's own conversation closes that page (the Parent row bug), only the bot's agents open in it, an archived or unloaded agent gives the page back. The bot fixture shared with ChatHostsTests moved to BotWorld.swift.

Code review (medium)

Six findings, all fixed in the last commit:

  1. An agent the bot started on another machine was paired with the bot's machine for unread focus and the inspector's tool call reveal. Both now use the agent's own machine (new test: the page keeps the agent's machine).
  2. selectChat on a sub agent also moved the window's navigation to the bot's workspace, even for callers that keep their own selection. It only records the bot's page again, as before.
  3. The agent's title and rename took over the titlebar whatever pane was active. Now only when the bot's conversation pane is the active one.
  4. A hidden bot page asked for focus when its agent page changed. It checks that it is visible first.
  5. A bot notification clicked before the window was ready fell back to a plain session route. It opens the bot again.
  6. An untitled agent had a blank titlebar. It reads "Agent".

Review round two

From the owner's review of 920b0d7:

  1. Focus is requested by selectChat and the back button only. A change of the open agent that the user didn't make (archive, reload, another window) no longer moves typing into the composer.
  2. Opening a bot's own chat closes only its agent page. An open thread stays, as before this PR.
  3. The chat pane draws exactly what BotPages says: the agent whenever it is the page, a thread only while the bot's own chat is loaded. Titlebar, focus and the inspector can't name an agent the pane isn't showing.
  4. Open-chat before the window is ready falls back to the bot, like notifications.
  5. The page is worked out once per bot page (container, bot chrome, inspector) and handed down, instead of in each view.
  6. An open agent that gets archived is forgotten while the bot's page is on screen, so it doesn't take the page back if it is restored. Only that case: two more review passes showed that also forgetting deleted or not-yet-loaded agents can drop an agent on another machine, or one that hasn't finished syncing.

Not done:

  • The rest of the "page flips back on its own" problem (an agent deleted, or unloaded and loaded again, or archived while the bot's page isn't on screen). It needs the model to hear about chat list changes and to remember the agent's machine; not a small change.
  • The inspector's Media, Links, images and file preview still use the bot workspace's machine when the agent runs on another one. Media and links are listed per workspace and the agent has none, so it needs a decision on what they should show for an agent, not a one-line change.

New tests in BotPagesTests for 2, 3 and 6 (19 tests across the four related suites pass).

Tophat

macOS dev app, Bots mode, bot "supply" with one sub agent, light and dark:

  • Sub agent page: normal coding composer with the model picker, normal left-aligned title, back button, Parent row in the inspector. Composer takes focus when the page opens.
  • Parent row click: lands on the bot's conversation (slim composer, "1 Agent" pill, New Bot button back in the toolbar).
  • Back button: same.

Round two, on the final build: the three flows above again, plus the focus case. With the command palette's field focused on the agent page, the agent was archived through the server. The page went back to the bot's conversation and focus stayed in the palette. Nothing visible changed, so the screenshots are from the previous round.

No harness in the dev instance was signed in (Claude Code signed out, Codex expired, Cursor credentials expired, OpenCode without a provider), so the bot could not run a turn. The sub agent was started through the server's own POST /v1/agents as the bot; its turn stops at "OpenCode isn't signed in". The page, composer, title and navigation are the real app. Screenshots are on the Linear ticket.

🤖 Generated with Claude Code

@pondorasti
pondorasti force-pushed the alexandru/851-4478-bot-sub-agents-parent-row-doesnt-go-back branch from 092e3dd to 920b0d7 Compare November 26, 2026 01:44
pondorasti and others added 5 commits November 25, 2026 18:40
A coding agent a bot started was drawn inside the bot's own conversation
page: a second, bot-only screen in the bot's pane, in the bot's workspace.
Everything keyed on "this is the bot's workspace" then applied to it: the
slim bot composer, the hidden window title with a bot-style pill instead,
and the transparent bot titlebar. The Parent row in the inspector set the
selection to the bot, which was already selected, so nothing happened.

- BotPages (CodevisorCore) decides once what a bot's page shows: its
  conversation, a thread, or one of its agents. It also owns opening a chat
  inside its bot: a sub agent opens as the bot's page, and the bot's own
  conversation closes whatever page is over it.
- The bot's open agent now goes through the same chat pane code as any
  coding chat (composer, attachments drop, session updates), and the page
  uses the coding chrome: normal composer, the window title (renamable),
  the titlebar divider. BotAgentScreen and its pill header are gone.
- selectChat opens a bot's own conversation too, so the inspector's Parent
  row, notification clicks and every other caller return to the bot.
- The inspector's tasks, focus for unread, and the debug transcript row
  follow the agent while its page is open.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…4478)

Composer focus and the focused-chat report were still routed to the bot's
own chat while one of its agents was shown in its place, so the agent's
composer never took focus when the page opened.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Review fixes:
- Focus, unread and the inspector's tool call reveal use the agent's own
  machine when the bot started it on another one.
- selectChat on a sub agent only records the bot's page again; it no longer
  moves the window's navigation to the bot's workspace for callers that
  keep their own selection.
- The agent's title and rename only take over the titlebar when the bot's
  conversation pane is the active one.
- A hidden bot page no longer asks for focus when its agent page changes.
- A bot notification clicked before the window is ready still opens the bot.
- An untitled agent's titlebar reads "Agent".

Co-Authored-By: Claude Fable 5.2 <[email protected]>
… user navigates (851-4478)

Review round two:
- Focus is requested by selectChat and the back button, not by every change
  of the open agent, so an agent archived or reloaded in the background no
  longer pulls typing out of the inspector, palette or a rename field.
- Opening a bot's own chat closes only its agent page. An open thread stays,
  as it did before.
- The chat pane draws exactly what BotPages says: the agent whenever it is
  the page, and a thread only while the bot's own chat is loaded. Titlebar,
  focus and the inspector can no longer name an agent the pane isn't showing.
- The page is worked out once per bot page and handed down, instead of being
  recomputed in each view.
- An open agent that stops resolving is forgotten, so the page doesn't flip
  back to it on its own later.
- Open-chat before the window is ready falls back to the bot, like
  notifications do.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
An agent whose project has not loaded yet, or whose machine cannot be
reached, keeps its place, so a click on an agent that is still syncing
opens it once it loads. Archived and deleted agents are forgotten, so the
page does not flip back to them on its own.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@pondorasti
pondorasti force-pushed the alexandru/851-4478-bot-sub-agents-parent-row-doesnt-go-back branch from 6ef97a9 to 8097471 Compare November 26, 2026 02:41
pondorasti and others added 2 commits November 25, 2026 18:56
…851-4478)

- A deleted or not yet loaded agent is no longer inferred from the chat
  list, which could drop an agent on another machine or one still syncing.
- A pane takes the bot page only when its chat belongs to the workspace's
  own bot, not any bot's chat shown there.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…archived (851-4478)

- The back button shows whenever an agent or thread is recorded as open,
  even while it cannot be drawn yet, so it can be dismissed. Sending a
  message in the bot's conversation drops a pending agent, so it can't
  take the page mid-typing once its project loads.
- After the bot's shown agent is archived, the conversation's composer
  takes focus when focus was in the centre pane or nowhere. Focus held
  outside the centre pane (inspector, palette, a rename field) is left
  alone.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@pondorasti
pondorasti merged commit a0ac5c6 into main Nov 26, 2026
@pondorasti
pondorasti deleted the alexandru/851-4478-bot-sub-agents-parent-row-doesnt-go-back branch November 26, 2026 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant