github / github/app

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

未关闭
#2,448 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
Bugs
主要语言
没有语言数据
星标
2.1k
派生
153
PR 合并指标
30 天内没有已合并 PR

描述

### 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.

贡献指南

打开贡献指南

调研方向

在 autopilot mode 下重现已调度的 Workflow,同时观察持久化的 task_complete 事件、live-session 重建和 shutdown finalization。跟踪原始 completion listener 在何处停止,以及重建后的会话在何处处理运行,然后验证 completion 已完成协调、后续 cron ticks 继续运行,并且 shutdown 不会将该运行标记为失败。

由索引模型根据 Issue 内容生成。

评估

技术栈
github
领域
backend, desktop
Issue 类型
缺陷
难度
5/5
预计耗时
一周以上
活跃度
冷清
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。