Closed general

Place new AI thread tabs in the user's group from the extension host (plus per-tab state ah cannot see)

John Lauer · 1mo ago ·closed by John Lauer

Ask

Open a new AI thread (Claude Code, Codex, Kimi) in the group the user is already working in, from inside the extension host, so Hydrogen no longer has to move the tab back over CDP after the fact.

Why

Every AI extension asks VS Code for ViewColumn.Beside when it opens a new chat tab. On a workbench with one group that splits the editor and the user gets a second column they never asked for (John, 2026-09-05: "if a user likes just 1, its very rude to open a 2nd"). Hydrogen 1.0.217 works around it: after /ai-threads/new or a keybinding open, ai_threads_home_group() in ah picks the group that already holds AI threads (focused group first) and moves the new tab there through CDP (hydrogen-control-browser/src/hbw.rs). It works, but it is a move after a flash, it depends on the CDP census, and it cannot see extension-private state. None of the three extensions offer a setting: Claude Code has only claudeCode.preferredLocation (sidebar|panel) and addSessionTabToGroup; Codex and Kimi have nothing.

adom-vscode already owns the tab census it pushes to ah (/tabs/events), so it has vscode.window.tabGroups and onDidChangeTabs for free.

Proposal

  1. In the tab watcher, when a tab whose viewType is one of the AI chat webviews appears in a group that did not exist a moment earlier (or in a group other than the one ah asked for), and the setting adom.aiThreads.keepInGroup (default true) is on, run workbench.action.moveEditorToPreviousGroup (or ...ToNextGroup toward the target) while that tab is active. The emptied group closes itself.
  2. Accept a target group hint from ah: POST /ai-threads/new can pass group: <index> on the adom-vscode verb it already calls, and the watcher moves the tab there instead of to "previous".
  3. Report what happened in the census frame (placed: {from, to}) so /ai-threads/new can drop its own CDP move and simply relay adom-vscode's answer.

Once 1 to 3 land, ah's ai_threads_place_in_group becomes a fallback for builds without the new adom-vscode, then goes away.

Also worth exposing from the extension host (data ah cannot see today)

  • The active group index and its tab list per frame (today ah infers "home group" from AI tab counts).
  • Whether an AI webview is showing a permission prompt or a question (the needs_you state is inferred from Claude's Notification hook; Codex and Kimi have no hooks, so their run-prompt job ends at delivered with no working/done phases). Even a "composer is disabled / streaming" bit per tab would give both a working state.
  • Which tab the extension actually reused when it decided not to open a new one (the reuse honesty gate in ah diffs transcripts on disk to find out).

Filed from the Hydrogen 1.0.217/1.0.218 work on the AI picker and run-prompt job feedback (hydrogen-ai-threads-api skill, "Know where your prompt went").

2 Replies

John Lauer · 1mo ago

Shipped in adom-vscode 1.1.45 (2026-09-07): new AI thread tabs are placed in the user's group from the extension host (keepInGroup setting, default on), and /tabs/reveal focuses a tab by position so Hydrogen's run-prompt no longer depends on the webview's own focus call. Verified on ConfRoomROG and the laptop with the AI Threads timing runs that day (Codex tab found in 0.4 s from the mirror push). Leaving open for the reporter to close after their own check.

John Lauer · 8d ago

Closing: shipped in 1.1.45 and still in the current release (1.1.114): keepInGroup (default on) places new AI thread tabs in the user's group from the extension host, and /tabs/reveal focuses a tab by position. Hydrogen's AI Threads tests (ralph sweep on ConfRoomROG and arav-rog) exercise it on every release.

Log in to reply.