github / github/copilot-cli

Expose queued and active processing state for project sessions

未关闭
#4,158 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area:agents area:sessions
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

### Describe the feature or problem you'd like to solve

Project-session coordination APIs do not expose whether a child session is actively processing or still has queued user messages. A parent can receive a completion handoff and see static branch/diff metadata from `get_session`, yet remain unable to prove the child is drained before merging its pull request.

This creates a cross-session merge race: if the parent previously sent a follow-up that is still queued, the child can wake after the parent merges, process that message, and push a trailing commit to the already-merged branch.

### Proposed solution

Expose explicit processing and queue state in `get_session` and `list_sessions_and_chats`, for example:

- `is_processing: boolean`
- `queued_messages_count: number`
- the current/last processed message identifier or a monotonic drain generation

Provide a native way for a coordinator to establish a merge barrier: wait until the child reports no active turn and no queued messages, then send a final stop/ready request and verify its acknowledgment belongs to the latest queue generation.

This would make project-session orchestration safe without relying only on conversational conventions or guessing from `updated_at`.

### Example prompts or workflows

1. A parent asks a child to implement a PR, sends two review fixes, then checks `is_processing == false` and `queued_messages_count == 0` before merging.
2. A parent sends “Make no further changes; reply READY_FOR_MERGE,” then verifies the reply drained the latest queue generation before running `gh pr merge`.
3. An orchestration dashboard shows which child sessions are idle, actively processing, or waiting on queued input.
4. A parent avoids archiving a child that still has pending messages even though its latest task handoff is complete.

### Additional context

Observed workflow: a child reported a validated PR head; the parent independently reviewed and merged it. A previously queued follow-up then woke the child, which produced and pushed a test-only commit after merge. The child detected the race and stopped, but the parent had no API field that could have prevented it.

Related queue/session-state reports do not expose a coordinator merge barrier:

- [Messages submitted while background subagents are running get stranded in the Queued UI region](https://github.com/github/copilot-cli/issues/3344)
- [Queued user messages and system notifications delivered out of send order](https://github.com/github/copilot-cli/issues/3517)
- [Project sessions hide context-exhausted and interrupted turn causes](https://github.com/github/copilot-cli/issues/4144)
- [Plan approval in autopilot+fleet mode triggers a dispatch ordering mismatch](https://github.com/github/copilot-cli/issues/2833)

贡献指南

打开贡献指南

调研方向

首先跟踪 get_session 和 list_sessions_and_chats API 路径,然后阅读 issue 中链接的相关队列和会话状态报告。定义 coordinator 所需的状态和生成语义,以便在合并前验证 child 没有活动中的工作或排队中的工作,并记录哪种 acknowledgment 会使 barrier 完成。

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

评估

领域
api, backend-api-design, cli
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
冷清
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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