Skip to content

Keep review agent Working (red dot) while background agents run#116

Open
0101 wants to merge 1 commit into
mainfrom
background-agent-red-dot
Open

Keep review agent Working (red dot) while background agents run#116
0101 wants to merge 1 commit into
mainfrom
background-agent-red-dot

Conversation

@0101

@0101 0101 commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Problem

A session running the review skill launches background review-runner agents, then ends its turn to wait for them. Ending the turn freezes the events-file mtime, and the forward fold treated assistant.turn_end as Done. Past the 15s grace window the worktree showed a blue Done dot and dropped out of the Overview band's Reviewing group — even though the review agent was still actively working.

Fix

Track outstanding background agents during the session scan in CopilotDetector.fs:

  • A task call with mode: background adds its agent id to the outstanding set.
  • A system.notification of kind agent_idle removes it.
  • turn_end now yields Done only when no background agents are still running; otherwise it yields Working (depth-0 gated, same as skill detection).

This keeps the red Working dot lit while background agents run, so the worktree stays in the Reviewing group.

Changes

  • src/Server/CopilotDetector.fs — track outstanding background agents; gate turn_end Done/Working on whether any remain.
  • src/Tests/CopilotDetectorTests.fs — coverage for background-agent tracking and the turn_end Working/Done transitions.
  • docs/spec/worktree-monitor.md — document the behavior.

Tests

Added tests in CopilotDetectorTests.fs covering the new tracking logic and turn_end gating.

A session running the `review` skill launches background review-runner agents,
then ends its turn to wait for them, which freezes the events-file mtime. The
forward fold treated `assistant.turn_end` as Done, so past the 15s grace window
the worktree showed a blue Done dot and dropped out of the Overview band's
Reviewing group even though the agent was still working.

Track outstanding background agents in the session scan: a `task` call with
`mode: background` adds its agent id, a `system.notification` of kind
`agent_idle` removes it. `turn_end` now yields Done only when none are still
running, otherwise Working (depth-0 gated like skill detection).
Copilot AI review requested due to automatic review settings July 15, 2026 14:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Keeps Copilot review sessions marked Working while background review agents remain active.

Changes:

  • Tracks outstanding background-agent launches and idle notifications.
  • Gates turn_end status on outstanding agents.
  • Adds regression tests and documentation.
Show a summary per file
File Description
src/Server/CopilotDetector.fs Adds background-agent state and status handling.
src/Tests/CopilotDetectorTests.fs Tests launch, completion, nesting, freshness, and incremental folding.
docs/spec/worktree-monitor.md Documents background-agent status detection.

Review details

  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Medium

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants