Skip to content

fix(desktop): add dismiss button for finished/timed-out subagent rows - #80705

Open
wen0531 wants to merge 1 commit into
NousResearch:mainfrom
wen0531:fix/subagent-dismiss-button
Open

wen0531 wants to merge 1 commit into
NousResearch:mainfrom
wen0531:fix/subagent-dismiss-button

Conversation

@wen0531

@wen0531 wen0531 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Problem

Subagent status rows in the composer status stack have no dismiss (X) button after completing, failing, or timing out. Only background type rows get the close affordance — subagent items always return null from the action selector, leaving finished cards permanently stuck in the UI until the app is restarted.

Root Cause

In status-row.tsx, the action variable only checks for item.type === background:

const action =
    item.type === background
      ? running
        ? onStop && { ... }
        : onDismiss && { ... }
      : null  // ← subagent always gets null

The onDismiss callback is passed from the parent for all item types, but subagent items never use it.

Fix (3 files, +23/-2 lines)

1. status-row.tsx — extend action condition

- item.type === background
+ item.type === background || item.type === subagent

2. subagents.ts — add dismissSubagent()

New function that removes a single subagent by ID from $subagentsBySession, paralleling the existing dismissBackgroundProcess for background items.

3. index.tsx — dispatch to correct store

onDismiss={sessionId
  ? id => (item.type === subagent
      ? dismissSubagent(sessionId, id)
      : dismissBackgroundProcess(sessionId, id))
  : undefined}

Behavior

Subagent state Button shown Action
running ✕ Stop Kills the process, then removes the row
completed / failed / interrupted / timeout ✕ Dismiss Removes the row from display

Verification

  • TypeScript compiles cleanly (tsc --noEmit, 0 errors)
  • Desktop builds successfully (npm run build)
  • Tested locally: finished subagent rows now show an X button that removes them

@alt-glitch alt-glitch added type/bug Something isn't working comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have labels Aug 7, 2026
@spfcraze

spfcraze commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

This was generated by AI during triage.

Summary:
Every subagent row renders with a hardcoded state: 'running' (subToItem, composer-status.ts:136), so the new Dismiss branch is unreachable and the Stop branch sends the subagent id to process.kill, which resolves against the background-process registry and returns 4044 — the row stays and an error surfaces.

Problems:

  • subToItem (composer-status.ts:136) sets state: 'running' on every subagent row, and the stack computed only pushes running/queued subagents (composer-status.ts:212), so in status-row.tsx the running ? onStop : onDismiss ternary always selects the Stop branch for subagent rows; the new dismissSubagent path wired in index.tsx never renders.
  • The Stop button that does render calls stopBackgroundProcess → process.kill with the subagent's id (composer-status.ts:412). process.kill resolves process_registry.get(proc_id) (tui_gateway/methods_tools.py:74) and returns 4044 "no such process" when the lookup misses (methods_tools.py:78); stopBackgroundProcess then notifies "Could not stop the process" and only dismisses on a confirmed kill (composer-status.ts:410-418). Net effect: error toast, row stays.
  • The premise that finished subagent rows are stuck until restart does not match main: the stack computed filters subagents to running/queued (composer-status.ts:212) and pruneFinishedSessionSubagents runs at message.start (gateway-event.ts:543). The genuinely stuck case is the timeout/error → running normalization in asStatus (subagents.ts:59), tracked in Desktop leaves timed-out subagents stuck as running #73728, with PR fix(desktop): normalise timeout/error subagent statuses to terminal (#73728) #73859 addressing it — this PR does not reference either.

Solution:
Carry the real subagent status into the row state so the Dismiss branch is reachable, and do not send subagent ids to process.kill — subagent rows are keyed by subagent id from subagent.* events, not by process.list entries; the desktop's existing stop path for subagent-bearing turns is session-level (clearSessionSubagents + session.interrupt, use-prompt-actions/index.ts:619-630). The stuck-row symptom itself is the status normalization in #73728/#73859.


Checked against aa9e551 — the tip of fix/subagent-dismiss-button when this was written — and 55505be, main at the same moment.

@wen0531
wen0531 force-pushed the fix/subagent-dismiss-button branch from 1a4860d to c4f15ab Compare September 17, 2026 05:02

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants