You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Keep reporting a hosted agent refused for its connection - #2903
A hosted agent whose re-registration the server refused with not_a_daemon or connection_vanished was silenced for the rest of the daemon's life. The next DaemonConnect left it out, and the server failed it as "agent no longer running" while it kept working. Both refusals are about the connection rather than the agent, so the re-registration pass now skips such an agent for that pass and leaves it reported, forwarder and cloud mirror included. The registration that follows the slot's recovery sends it again. A refusal about the agent still silences it
Where to look
A connection refusal also leaves ResumeAnswered unset. The server returns it before reading the registration, so a resumed agent's next announcement must still carry the first-announce flag, or the session is not reopened. The launch path's RegisterAgentAsync keeps its refusal rule
Verification
The new tests fail before the fix (agent missing from the live list, second re-announcement never sent, mirror stopped) and pass after it
The resume flag stays unanswered too: the server returns both refusals
before it reads anything the registration carries
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No actionable comments were generated in the recent review.
Walkthrough
The daemon now treats not_a_daemon and connection_vanished re-registration refusals as connection-specific. It leaves the agent live and does not stop its ACP work or cloud sink, allowing a later registration pass to retry.
Changes: Re-registration refusal handling
Layer / File(s)
Summary
Classify and handle connection-specific refusals src/Capacitor.Cli.Core/AgentRegisteredResponse.cs, src/Capacitor.Cli.Daemon/Services/AgentOrchestrator.cs
AgentRegisteredResponse exposes RefusesConnection for unregistered responses with NotADaemon or ConnectionVanished. ReRegisterAgentsAsync logs these refusals and stops retrying for that agent during the current pass without marking it refused or stopping its work.
Tests check that the agent remains live, its mirror continues sending output, and re-announcements retain the first-announcement flag. They also check that a later pass registers the agent and sends its status.
Assessment against linked issues
Objective
Addressed
Explanation
Keep agents live after not_a_daemon or connection_vanished re-registration refusals, and register them on a later pass [#2901]
✅
Possibly related PRs
kurrent-io/kcap#2314: Adds the resume first-announcement behavior exercised by the new re-announcement test.
Severity of issue fixed: High
Merge Risk: Minimal · up to e772d
Hosted agents refused re-registration only because of their connection now stay live and reported, and are registered again on a later pass. Refusals about the agent itself still silence it. No merge-blocking risk is identified.
Security architecture risk: Minimal · up to e772d
The change preserves running work during connection recovery while retaining rejection handling for work the server actually refuses. The inspected change establishes no new security or failure-containment regression.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
observed — The changed loop operates on this daemon's in-memory Starting or Running agents that are not server-silent. Preserved terminal output uses the existing agent ID and server connection; the new branch introduces no alternative destination or credential input.
Trust Boundaries and Controls
observed — The server response remains the classification input. Refusal reasons outside the two connection-specific values still set RegistrationRefused and suppress future registration and forwarding. The existing regression test checks that an agent-level refusal is not retried on a subsequent pass.
Resilience and Maintainability Implications
observed — The preserved mirror still checks connection readiness before sending, honors cancellation, and bounds repeated send failures before marking itself desynchronized. These are client-side containment controls, not proof of server-side ownership enforcement after a connection refusal.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: ec40c7f8-63c4-45a4-b38f-a536c2fecb3a
Commits
Reviewing files that changed from the base of the PR and between 185229d and e772dff.
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 9 remain after this review.
Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.
Exercise mirror replay after the connection recovers.
CaptureServerConnection stays ready in this test. The test catches a stopped pump, but it would still pass if the accepted re-registration failed to replay output retained during the refusal. Set Ready to false before the refused pass and emit after; while it is false. Run an accepted pass, restore readiness, and assert one reset followed by before;after;, as in the neighboring replay test. (raw.githubusercontent.com)
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: 491e94c1-0295-4fc4-8804-a9740d7db403
Commits
Reviewing files that changed from the base of the PR and between 9361605 and 185229d.
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2901 — AI-5819
What & why
A hosted agent whose re-registration the server refused with
not_a_daemonorconnection_vanishedwas silenced for the rest of the daemon's life. The nextDaemonConnectleft it out, and the server failed it as "agent no longer running" while it kept working. Both refusals are about the connection rather than the agent, so the re-registration pass now skips such an agent for that pass and leaves it reported, forwarder and cloud mirror included. The registration that follows the slot's recovery sends it again. A refusal about the agent still silences itWhere to look
A connection refusal also leaves
ResumeAnsweredunset. The server returns it before reading the registration, so a resumed agent's next announcement must still carry the first-announce flag, or the session is not reopened. The launch path'sRegisterAgentAsynckeeps its refusal ruleVerification
Capacitor.Cli.Daemon.Tests.Unit: 6416 total, 0 failed, 78 skippeddotnet publish src/Capacitor.Cli/Capacitor.Cli.csproj -c Release: no IL2026/IL3050 warnings🤖 Generated with Claude Code