[FEATURE] Mods API: a queryable record per background task, with event order, exit code and progress
Status Open
Reported on v2.1.296
Maintainer reply None cached
Activity 0 comments · opened Oct 11, 2026
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Downrange (github.com/dot-agi/downrange) is a mod that shows each background task's state, progress and ETA. It builds them from task notifications, Stop snapshots and output files.
Claude Code 2.1.296 (macOS) declares a task as:
type BackgroundTaskSummary = { id: string; type: string; status: string; description: string;
command?: string; agent_type?: string; server?: string; tool?: string; name?: string; };
Gaps:
- No input carries an engine sequence or time. A late Monitor event can revive a finished row.
$.agent.list()is the only on-demand list. Shells, Monitors and workflows have none.PromptOrigin { kind: 'task-notification' }has no task id. No typed field holds an exit code, so a missed notification leaves a shell row without one.- No progress field. The mod parses ratios from output, so
10/11moves the bar.
Proposed Solution
$.task.list(): Promise<TaskInfo[]>and$.task.get(id): Promise<TaskInfo | undefined>for all task types. Keep ended tasks briefly.TaskInfo = BackgroundTaskSummary & { seq: number; updatedAt: number; exitCode?: number; endedAt?: number; progress?: { done: number; total?: number; label?: string } }.seqrises per session with each lifecycle change.- Add the task
idandseqto thetask-notificationorigin and to each Stop and SubagentStopbackground_tasksentry. - Fill
progressonly from a source the producer opts into, such as OSC 9;4 or a Monitor event field. Never from free text.
Alternative Solutions
#100201 asks for a hook event when a task ends. It fixes missed ends, but not order, exit codes or progress.
Priority
Medium - Would be very helpful
Feature Category
Developer tools/SDK
Use Case Example
This closes two Downrange known limits: "Inputs that reach Downrange late" and "Progress read from output". With seq, the mod drops stale inputs exactly.
Additional Context
Related: #95742 (notifications re-fire after a task is gone), #98816 (background_tasks includes ambient tasks), #87186 and #33310 (closed, narrower).