github / github/copilot-cli

Project sessions hide terminal reasons for startup and turn failures

未關閉
#4,144 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
area:agents area:sessions
主要語言
Shell
星號
11.2k
分支
1.9k
平均合併
14 小時 16 分鐘
30 天內合併 PR
6

描述

## Describe the bug

A coordinated local worktree project session can surface only a generic `error` or `idle` state to its parent when startup, the first kickoff turn, or a later active turn fails. The metadata does not explain the cause or say whether the intact session can be resumed, so the parent may abandon recoverable work or replace an empty session without preserving the diagnostic cause.

## Affected version

`1.0.71-2`

## Steps to reproduce the behavior

### Startup or first-turn failure

1. Create a fresh local worktree project session with a valid autopilot kickoff.
2. Let branch and worktree creation succeed, but have the session reach terminal `error` before producing a diff.
3. Read the parent-facing session metadata. It shows a real branch and worktree path with zero changed files, but exposes neither a structured terminal reason nor a last error.
4. Send a simple follow-up message asking the session to report its error. The session immediately reaches `error` again without returning a cross-session explanation.

Verified reproduction metadata:

```text
session_id: 3b50dbcd-3543-43a3-ac03-d78e648cf1f4
state: error
changed_files: 0
terminal_reason: not exposed
last_error: not exposed
```

A sibling session created at the same time from the same base branch ran normally, so this signature was not a general failure of that base branch. The safe recovery was to archive the empty session and recreate it, which discarded the diagnostic cause.

### Later active-turn failure

1. Start a coordinated project session with a long task that performs substantial review and validation work.
2. Let the turn reach its context limit after it has committed work but before it reports completion, or send a new parent message while a resumed turn is active.
3. Observe the parent-facing session status and metadata.
4. Inspect the child directly and confirm its worktree and commit are intact and that the actual cause was context exhaustion or interruption.

The parent receives a generic failure state without the actionable cause. In one reproduction, transient model `408` errors also appeared around the interrupted turn, further obscuring the primary cause.

## Expected behavior

Parent-facing project-session metadata and tool responses should preserve a safe, structured reason for failures during startup, the first kickoff turn, and later active turns. They should also make the recovery path explicit instead of requiring the parent to infer whether to resume or replace the session.

## Acceptance criteria

- Startup, first-turn, and kickoff failures for local worktree sessions expose a structured terminal reason or last error through parent-facing session metadata.
- The create or kickoff caller receives a useful failure response instead of learning only from a later bare `error` state.
- Sending a message to a terminally errored session returns a structured cannot-wake reason instead of silently ending in `error` again.
- Metadata states whether the intact worktree and session are resumable or whether replacement is required.

## Additional context

- macOS / Apple Silicon
- In the later-turn reproductions, the committed code was not corrupted or lost.
- A fresh session could recover an intact commit, but that workaround consumes a new worktree and requires manual diagnosis.
- Please route this to the app or orchestration owner if the status translation is outside the CLI process.

貢獻指南

開啟貢獻指南

研究方向

先追蹤 CLI 程序中的本機 worktree project-session 流程,包括提供給 parent 的工作階段中繼資料、工具回應,以及 create 或 kickoff caller。檢查啟動、第一次 turn、後續 turn 和 terminal-session 失敗是如何轉換的,然後驗證結構化原因、cannot-wake 回應,以及 resumable-versus-replacement 狀態是否依規格公開。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
shell
領域
cli
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
冷清
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。