Skip to content

End a subagent row on a stopped task notification - #1876

Merged
alexeyzimarev merged 1 commit into
mainfrom
capacitor/agent-bc380f58c51f47
Oct 23, 2026
Merged

alexeyzimarev merged 1 commit into
mainfrom
capacitor/agent-bc380f58c51f47

Conversation

@alexeyzimarev

Copy link
Copy Markdown
Member

Closes #1875 — AI-4311

What & why

When a daemon restart kills a Claude process while a background subagent is running, the resumed Claude Code reports that agent with <status>stopped</status>, the task id and no <tool-use-id>. The rules mapped only completed, failed and killed to an end, so the desktop app kept the row running for the rest of the session. stopped now ends the row as Stopped, the same as killed.

Verification

  • Reproduced on session e5aa584e: of its 42 subagents, only a9202cd3d93195cce lacks "finished":true in its meta, and its only end record is this stopped notification
  • The new ClaudeChatRulesTests case, built on that line's shape, failed before the fix; the class now passes 54/54

🤖 Generated with Claude Code

A resumed Claude Code reports a background agent the killed process left
running with status stopped and no tool-use id; ignoring it kept the row
running in the desktop app for the rest of the session.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 31 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 445cef89-301b-44ed-b7a8-dad37a525c15
📥 Commits

Reviewing files that changed from the base of the PR and between 0744328 and e90609a.

📒 Files selected for processing: 2
  • src/Capacitor.Cli.Core/Harness/Claude/ClaudeChatRules.cs
  • test/Capacitor.Cli.Core.Tests.Unit/Harness/Claude/ClaudeChatRulesTests.cs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-23T11:28:43.610359Z e90609a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Finish subagent rows on stopped task notifications

🐞 Bug fix 🧪 Tests 🕐 Less than 10 minutes

Grey Divider

AI Description

• Treat stopped task notifications as an end to background subagent runs.
• Cover resumed-session notifications that identify an agent without a tool-use ID.
Diagram

graph TD
  A["Stopped notification"] --> B["Claude chat rules"] --> C["Finished signal"] --> D["Subagent row"]
Loading
High-Level Assessment

Extending the existing notification-status mapping is the appropriate approach: stopped has the same run outcome as killed, and the existing finished signal already supports an agent ID without a call ID. No new lifecycle mechanism is needed.

Files changed (2) +12 / -0

Bug fix (1) +1 / -0
ClaudeChatRules.csMap stopped notifications to a Stopped finish +1/-0

Map stopped notifications to a Stopped finish

• Recognizes 'stopped' as a terminal task-notification status and emits a 'RunSignal.Finished' with the Stopped outcome. This lets notifications keyed only by agent ID end a background run.

src/Capacitor.Cli.Core/Harness/Claude/ClaudeChatRules.cs

Tests (1) +11 / -0
ClaudeChatRulesTests.csCover a stopped notification without a tool-use ID +11/-0

Cover a stopped notification without a tool-use ID

• Adds a resumed-session notification fixture and asserts that it produces a finished signal with a null call ID, the expected agent ID, and a Stopped outcome.

test/Capacitor.Cli.Core.Tests.Unit/Harness/Claude/ClaudeChatRulesTests.cs

@qodo-code-review

qodo-code-review Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Test comment records old process history ✗ Dismissed
Description
The added test comment describes the fixture as an agent the previous process left running instead
of stating the current compatibility scenario. That historical wording can become false as the
notification format or test setup changes, misleading maintainers about why the parser must accept
the record.
Code

test/Capacitor.Cli.Core.Tests.Unit/Harness/Claude/ClaudeChatRulesTests.cs[R557-558]

+    /// A resumed Claude Code reports a background agent the previous process left running this way:
+    /// keyed by the agent id alone, with a status of its own.
Relevance

●●● Strong

Recent precedents accept replacing historical process narration with behavior-focused test comments.

PR-#1756
PR-#1592
PR-#947

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed test comment refers to an agent that the 'previous process left running', which is
historical change narration and process-reference metadata rather than a current invariant or
behavior.

Rule 2897915: Avoid time-sensitive or process-reference metadata in code comments
test/Capacitor.Cli.Core.Tests.Unit/Harness/Claude/ClaudeChatRulesTests.cs[557-558]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The added comment relies on historical process wording by describing an agent as one the previous process left running. This violates the comment convention that comments should describe current behavior or intent rather than change history.

## Fix Focus Areas
- test/Capacitor.Cli.Core.Tests.Unit/Harness/Claude/ClaudeChatRulesTests.cs[557-558]

## Recommended Fix
Rewrite the comment to describe the current notification shape and compatibility requirement without referring to a previous process or historical state, such as noting that resumed Claude sessions can report an agent ID with a standalone stopped status.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
✅ Compliance rules (platform): 59 rules
✅ Cross-repo context — repo relationships
Review mode: Auto: 🚀 Fast: Localized status mapping with focused regression coverage and minimal blast radius.

Grey Divider

Tip of the day
💡 Did you know, you can reply 'qodo' on any finding to push back, ask questions, or dig deeper

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@alexeyzimarev
alexeyzimarev merged commit eb417ce into main Oct 23, 2026
12 checks passed
@alexeyzimarev
alexeyzimarev deleted the capacitor/agent-bc380f58c51f47 branch October 23, 2026 14:10
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.

Desktop app shows a killed background subagent as running for the rest of the session

1 participant