feat: Running Agents lists external terminals and focuses their real window - #275
Open
NovakPAai wants to merge 1 commit into
Open
feat: Running Agents lists external terminals and focuses their real window#275NovakPAai wants to merge 1 commit into
NovakPAai wants to merge 1 commit into
Conversation
3 tasks
…window The Workspace "Running agents" tree now surfaces agents that actually run in external native terminals (iTerm/Terminal.app/Warp/cmux) — including the ones codbash itself launches via /api/launch — and a click raises that real window instead of opening a blank in-app terminal. Why: 7.15.0 scoped Running Agents to codbash-pty descendants only. Side effect: an agent codbash launched into iTerm descends from iTerm, not a codbash pty, so it vanished from the list — codbash opened the window yet showed "nothing running". And clicking a row with no live pane spawned an empty shell, which is not the agent. A live agent's PTY can't be mirrored into the browser terminal (OS: one controlling terminal per process), so the honest action is to focus its real window; true "resume with history" only applies to stopped sessions. - data.js: `_scopeToCodbashAgents` (filter) -> `_tagCodbashAgents` (tag). Each /api/active entry gets `local` (true=codbash-pane descendant, false=external); nothing is dropped. Pure, testable `_tagLocalAgents(active, live, ppidOf)` extracted; immutable, depth-bounded, fails open as external. - workspace.js: tree shows `!local` (external) agents; `jumpToRunningAgent` POSTs /api/focus by validated pid; removed dead `_wsPaneForCwd`; no blank terminal fallback. - server.js: LAN-bind (--host=0.0.0.0) banner notes all-user /api/active scope. - Tests: test/running-agents-external.test.js (11) + SDD/BDD artifacts. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
NovakPAai
force-pushed
the
feat/running-agents-external
branch
from
July 24, 2026 12:43
fee580e to
bc16208
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
The Workspace Running agents tree now lists agents running in external native terminals (iTerm / Terminal.app / Warp / cmux) — including the ones codbash itself launches via
/api/launch— and clicking a row raises that real terminal window instead of opening a blank in-app terminal.7.15.0 scoped Running Agents to codbash-pty descendants only (
_scopeToCodbashAgents). Two side effects this fixes:openInWorkspace(...)→ an empty shell in the folder. An empty shell is not the agent.A live agent's PTY cannot be mirrored/attached into the browser terminal (OS gives one controlling terminal per process), so the honest action is to focus its real window. True "resume with history" only applies to stopped sessions (
claude --continue), and doing that to a live agent would fork a second instance — so we never do it here.This intentionally reverses the 7.15.0 "Running Agents lists only agents launched from codbash" decision; codbash's own panes are already visible as tabs, so the tree is now for the terminals that have no other UI home.
Changes
src/data.js—_scopeToCodbashAgents(drop-filter) →_tagCodbashAgents(tag). Every/api/activeentry getslocal(true= descends from a codbash browser-pty pane,false= external); nothing is dropped. Pure_tagLocalAgents(active, live, ppidOf)extracted for unit testing — immutable ({...a, local}), depth-bounded walk, fails open as external on apserror.src/frontend/workspace.js—_wsRunningByProjectexcludeslocal===true;jumpToRunningAgent(cwd, sessionId, kind, pid)POSTs/api/focuswith a validated pid and toasts on failure; removed now-dead_wsPaneForCwd; no blank-terminal fallback.src/server.js—--host=0.0.0.0banner notes that/api/activenow lists every agent process on the host (all users), reachable over LAN in that opt-in mode.docs/design/running-agents-external.md,specs/running-agents-external.feature,test/running-agents-external.test.js(11 tests), CLAUDE.md architecture bullet updated.Review
code-reviewer + security-reviewer: no CRITICAL/HIGH/MEDIUM. LOW/INFO findings all addressed or documented in the design-doc triage table (unused-param comment,
Number.isIntegerpid parity, Windowslocallimitation accepted, LAN exposure noted in banner + accepted, pre-existing/api/focusCSRF deferred to a separate PR).Test plan
node --test test/*.test.js— 218 total, 0 fail (1 pre-existing skip); new suite 11/11/api/activereturnslocalon every entry (6 external agents surfaced that the old filter hid);/api/focus→ 400 on bad pid,{ok:false}on a valid-but-dead pidclaudein iTerm in a project → appears under Running agents → click raises the iTerm window; codbash-pane agent stays out of the tree🤖 Generated with Claude Code