Skip to content

Expose active background shells in chat state - #475

Closed
Anthony Kim (anthonykim1) wants to merge 1 commit into
mainfrom
anthonykim1/background-shell-ui
Closed

Anthony Kim (anthonykim1) wants to merge 1 commit into
mainfrom
anthonykim1/background-shell-ui

Conversation

@anthonykim1

Copy link
Copy Markdown
Contributor
  • Add BackgroundShellInfo for shell commands that keep running after their tool call returns: id, description, command, status, startedAt, and attachmentMode.
  • Add BackgroundShellStatus (running / idle) and BackgroundShellAttachmentMode (attached / detached), both @nonexhaustive.
  • Add optional ChatState.backgroundShells, mirrored into ChatSummary.backgroundShells through session/chatUpdated, so session subscribers can see background work without subscribing to every chat.
  • Add server-only chat/backgroundShellSet (upsert by id) and chat/backgroundShellRemoved (remove by shellId, no-op when absent), introduced in 0.9.0.
  • Keep the collection independent of turn lifetime. Turn completion, cancellation, steering, and truncation do not clear it, and hosts reconcile against the runtime after a chat is restored.
  • Distinguish a missing collection (nothing published yet) from an empty one (no active shells). The Go generator treats backgroundShells as presence-sensitive so an empty list is not dropped.
  • Keep terminal output, process controls, and turn-completion rules out of scope.
  • Regenerate the schema and every client, and add reducer fixtures for add, replace, remove, absent remove, and summary mirror and clear.

Validated with npm run generate and npm test (477 tests, 100% reducer coverage).


Inspirations from:

/** Human-readable description of what the chat is currently doing */
activity?: string;
/** Active background shells, mirrored from {@link ChatState.backgroundShells}. */
backgroundShells?: BackgroundShellInfo[];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this is the right approach, or if we should have a generic 'things that will wake up this chat' collection, which would include async subagents, possibly MCP tasks, etc. What do you think? cc Sandeep Somavarapu (@sandy081)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point,
Are we talking about something like:

export const enum BackgroundWorkKind {
  Shell = 'shell',
  Subagent = 'subagent',
  McpTask = 'mcpTask',
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR attempting above approach ---> #482

Would love to get feedback on #482 Connor Peet (@connor4312), roblourens Sandeep Somavarapu (@sandy081)

@anthonykim1

Anthony Kim (anthonykim1) commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Moving to ----> #482

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.

3 participants