Skip to content
Merged
8 changes: 4 additions & 4 deletions packages/core/src/services/backgroundShellRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

/**
* Tracks background shell processes spawned via the `shell` tool with
* `is_background: true`. Each entry holds the metadata the agent and the
* `/tasks` slash command need to query, observe, or terminate a running
* background shell.
* `is_background: true`. Each entry holds the metadata that the agent,
* `/tasks`, and the interactive Background tasks dialog use to query,
* observe, or terminate a running background shell.
Comment thread
wenshao marked this conversation as resolved.
Outdated
*
* State machine: register → running → { completed | failed | cancelled }.
* Transitions out of running are one-shot: complete/fail/cancel become
Expand All @@ -28,7 +28,7 @@ export type BackgroundShellStatus =
| 'cancelled';

export interface BackgroundShellEntry {
/** Stable id used by the model and the `/tasks` UI. */
/** Stable id used by the model, `/tasks`, and the Background tasks dialog. */
shellId: string;
/** The user-supplied command, after any pre-processing the tool applies. */
command: string;
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/services/monitorRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ export class MonitorRegistry {
);
// Persist the reason so the dialog's detail view can surface it
// after the monitor terminates (the chat-history notification is
// separate and not visible from /tasks dialog reopens).
// separate and not visible from later Background tasks dialog
// reopens or `/tasks` listings).
Comment thread
wenshao marked this conversation as resolved.
Outdated
entry.error = 'Max events reached';
this.settle(entry, 'completed');
entry.abortController.abort();
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/tools/shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ export class ShellToolInvocation extends BaseToolInvocation<
`id: ${shellId}\n` +
pidLine +
`output file: ${outputPath}\n` +
`Use the /tasks command to list and inspect background shells, or Read the output file directly.`,
`To inspect: /tasks (text) or the interactive Background tasks dialog (footer pill + Enter — detail view + live updates). Read the output file directly to view the captured output.`,
Comment thread
wenshao marked this conversation as resolved.
Outdated
returnDisplay: `Background shell ${shellId} started${pid !== undefined ? ` (pid ${pid})` : ''}.`,
};
}
Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/tools/task-stop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ class TaskStopInvocation extends BaseToolInvocation<
// Background shell registry (Phase B). Settles asynchronously when the
// child process exits in response to the AbortController; the registry
// entry's terminal state (`cancelled`) and final exit code/output stay
// observable via `/tasks` and the on-disk output file.
// observable via `/tasks` (text), the interactive Background tasks
// dialog (footer pill + Enter), and the on-disk output file.
const shellRegistry = this.config.getBackgroundShellRegistry();
const shellEntry = shellRegistry.get(taskId);
if (shellEntry) {
Expand All @@ -107,7 +108,7 @@ class TaskStopInvocation extends BaseToolInvocation<
return {
llmContent:
`Cancellation requested for background shell "${taskId}". ` +
`Final status will be visible via /tasks once the process drains; ` +
`Final status will be visible via /tasks (text) or the interactive Background tasks dialog (footer pill + Enter) once the process drains; ` +
Comment thread
wenshao marked this conversation as resolved.
Outdated
`captured output remains at ${shellEntry.outputPath}.\n` +
`Command: ${shellEntry.command}`,
returnDisplay: `Cancelled shell: ${shellEntry.command}`,
Expand Down
Loading