github / github/app

Workflow remains running after session rebuild, then fails on app shutdown

Offen
#2,448 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Bugs
Vorherrschende Sprache
Keine Sprachdaten
Sterne
2.1k
Forks
153
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

### Short summary

A scheduled Workflow can successfully call `task_complete`, but a same-second live-session rebuild drops the Workflow completion listener. The run remains `pending/running`, blocks later cron ticks, and is eventually mislabeled `failed: Interrupted by app shutdown`.

### Affected version or release

GitHub Copilot App `1.0.73`

### Installation context

Windows desktop App, project Workflow attached to `cloga/Trinity-Alpha`, running in `autopilot` mode on cron `0 */4 * * *`. The affected Workflow workspace had been manually triggered and taken over in the UI.

### What happened?

The Workflow's business task completed successfully and called `task_complete`, but the App did not persist the Workflow run as completed. A UI `resume_session` immediately triggered `Rebuilding live session after enabled experiments changed`. During reconstruction, the original SDK event loop and the Workflow run's `session_handler_subscription_forwarder` were stopped. A new ordinary session listener started, but the completion observer for the original Workflow run was not restored.

The run therefore remained `pending/running`. Every later scheduler tick was skipped with `Skipping workflow tick: prior run is still pending/running`. When the App/CLI later shut down, cleanup incorrectly finalized the already-successful run as `failed` with `Interrupted by app shutdown`.

### Steps to reproduce

1. Create a project Workflow scheduled on a cron and run it in `autopilot` mode.
2. Manually trigger the Workflow and open/take over its workspace session.
3. Let the agent complete its work and invoke `task_complete`.
4. At completion, cause or observe a live-session reconstruction, for example when enabled experiments change and the UI resumes the session.
5. Observe that the agent session has a durable `task_complete` event, but the Workflow run remains `pending/running`.
6. Wait for the next cron tick and observe `Skipping workflow tick: prior run is still pending/running`.
7. Shut down/restart the App and observe the stale run becoming `failed` with `Interrupted by app shutdown`.

### Expected behavior

A terminal `task_complete` or completed agent turn should durably finalize the Workflow run before session reconstruction can replace listeners. If reconstruction occurs, the Workflow completion subscription should be rebound by `run_id` or reconciled from durable session events. App shutdown must not overwrite an already-completed run as failed, and a stale listener must not indefinitely suppress future scheduled runs.

### Additional context

- Affected run ID: `e2b06e69-17cc-4fd1-8348-2a1c44be421d`
- Affected session ID: `65fe97d1-0f1c-41d4-a2a2-305b10177946`
- `task_complete`: `2026-07-30T15:59:38.646Z`
- `agentStop` / end turn: `2026-07-30T15:59:39.716Z`
- UI session resume/rebuild: approximately `2026-07-30T15:59:40Z`
- App/CLI shutdown: approximately `2026-07-30T20:10Z`
- Secondary shutdown errors included `Hook callback invocation failed; ... connection closed`, `unknown taskRegistry handle`, and `TaskRegistryHandle has been disposed`.
- The business verifier confirmed success before the control-plane failure, so this is a false-negative Workflow status plus scheduler starvation, not a failed task.
- Related Community report: https://github.com/orgs/community/discussions/203514

Suggested safeguards: persist terminal state before rebuilding; rebind the run completion listener after reconstruction; add lease/heartbeat expiry and terminal-event reconciliation for stale active runs; reconcile durable completion events before assigning shutdown failure.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Den geplanten Workflow im autopilot mode reproduzieren und dabei das dauerhafte task_complete-Ereignis, die Rekonstruktion der live-session und die Finalisierung beim Herunterfahren beobachten. Nachverfolgen, wo der ursprüngliche completion listener gestoppt wird und wo die neu aufgebaute Sitzung den Lauf verarbeitet, anschließend überprüfen, dass der Abschluss abgeglichen wird, spätere cron ticks fortgesetzt werden und das Herunterfahren den Lauf nicht als fehlgeschlagen markiert.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
github
Bereich
backend, desktop
Issue-Typ
Bug
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.