github / github/app

Global background-task monitor and stuck-task detection

Abierto
#2,791 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Sin datos de lenguaje
Estrellas
2.1k
Forks
153
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

## Problem

Background agents and shell tasks can continue running after I switch away from their owning session. The app provides a task list and a useful per-task detail view inside the owning session, including the command and captured output, but there is no app-level view that aggregates background work across sessions or highlights potentially stale tasks.

I recently found two tasks whose detail views showed unexpectedly long runtimes:

| Task | Status | Runtime | Detail |
| --- | --- | --- | --- |
| `Search cloned repos for route policy and PRM patterns` | Completed | 28h 46m | Started 1d ago; shell ID 10; no output captured |
| `Check Safari WebDriver readiness for browser smoke` | Completed | 6h 36m | Started 12h ago; shell ID 706; last captured output says the command was still running after 30 seconds and had produced no output; last read 12h ago |

Image

Image

These operations should normally finish quickly. I cleaned up the affected sessions before filing this issue, so I no longer have a live process to inspect.

## What the task details reveal

The detail view is useful and appears to clarify that `28h 46m` and `6h 36m` are elapsed task runtimes, rather than time since completion. However, it also exposes a lifecycle/diagnostic gap:

- The tasks are marked **Completed**, but there is no final exit status or terminal output explaining how the underlying shell ended.
- For the WebDriver task, the only captured output says the shell was still running, while the task card is now marked **Completed**.
- The UI does not indicate whether the process eventually exited, was detached, was cancelled, disappeared during an app/runtime restart, or simply stopped being polled.
- “Last read 12h” describes observation by the agent, but not necessarily the process's last activity or current health.

This makes it difficult to distinguish a legitimately long task from stale tracking, a detached child process, or a task wrapper that completed without reconciling the underlying shell.

## Current experience

1. A session starts one or more background agents or shell tasks.
2. I move to another session and continue working.
3. The owning session has a task list and per-task details, but there is no app-level indication that another session still owns running work.
4. To investigate, I must remember the owning session, reopen it, find the task, and inspect it.
5. Even in the detail view, a long-running or completed task may lack a final process result, current process state, or explanation for why it ran so long.

## Requested experience

Add a global **Background tasks** view covering every app session.

For each task, show:

- Owning session, project/repository, and branch
- Task type: background agent or shell
- Status and start/completion timestamps
- Elapsed runtime
- Last process activity/heartbeat, distinct from “last read”
- Recent output and final exit status
- Current operation
- PID and attachment/execution mode when applicable
- Whether the process still exists
- Whether the owning session or provider is still connected

Useful filters would include status, project, session, task type, and duration. The default view should emphasize currently running, failed, and potentially stuck work, while retaining optional completed/cancelled history for diagnosis.

## Actions

- Open the owning session
- View progress or logs
- Refresh/reconcile process status
- Cancel an individual task
- Cancel all tasks for a session
- Cancel all tasks identified as stale
- Prompt before archiving/deleting a session that still owns running tasks

The app should also make task lifecycle behavior explicit when quitting, closing, archiving, or deleting a session, especially for detached shell processes.

## Stuck-task detection

Flag a task as potentially stale when, for example:

- No progress, output, or heartbeat has been observed for a threshold
- Its process no longer exists but the task remains marked running
- Its provider/session disconnected without reconciling task state
- It has exceeded a configurable or task-specific expected duration
- It is waiting for user input in a session that is no longer foregrounded
- It is marked completed but its last known shell state was still running and no terminal result was captured

This does not need to auto-cancel work by default; a warning with the reason and a direct cancellation or reconciliation action would be sufficient.

## Session-level visibility

Session cards/tabs should show a running-task badge and count so background activity remains visible even when its session is not open.

Duration labels should be explicit, such as:

- `Running for 12m`
- `Ran for 28h 46m`
- `Completed 5h ago`
- `No process activity for 45m`
- `Last inspected by agent 12h ago`

## Extension/canvas consideration

A supported global task enumeration and event API would also allow this to be implemented as a custom canvas. Based on the current extension SDK surface, task listing, refresh, cancellation, and `background_tasks_changed` events are session-scoped. Sessions can be listed globally, but task listing does not accept a session ID, so a canvas cannot safely aggregate or control tasks across sessions without relying on private storage or implementation details.

## Acceptance criteria

1. I can see all currently running background tasks across all sessions in one place.
2. I can identify the owning session and navigate to it.
3. I can see when each process last made progress and why it may be considered stale.
4. Shell details include a final exit status/output, or clearly explain that the process is detached or its state is unknown.
5. A task is not presented as cleanly completed while its last known underlying process state is still running without an explanation.
6. I can cancel one task or bulk-cancel stale tasks.
7. Archiving or deleting a session warns when it still owns running tasks.
8. Runtime, time since completion, last process activity, and last agent inspection are clearly distinguished.
9. Task state is reconciled after app/runtime restarts or provider disconnections.

---
| Field | Value |
| --- | --- |
| App version | 1.1.6 |
| OS | macOS 26.6.0 |
| Theme | GitHub |
| Path | /chat |
| Tenure | Week 16 |

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Start by tracing the extension SDK entry points for global session listing, session-scoped task listing, refresh, cancellation, and the `background_tasks_changed` event. Compare the current session-level behavior with the acceptance criteria, then define how global task aggregation, process reconciliation, stale warnings, lifecycle actions, and session badges should be verified.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
shell
Área
desktop
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.