Repository navigation
fix(desktop): let remote agents be redeployed after shutdown or inactivity - #8386
Open
anthony-tarantini wants to merge 4 commits into
Open
anthony-tarantini wants to merge 4 commits into
anthony-tarantini wants to merge 4 commits into
Conversation
🔐 Codex Security Review
|
added 4 commits
October 21, 2026 18:47
A provider agent's `deployed` status is a retained deploy receipt the desktop never clears, so after `!shutdown` or an inactivity reap the UI kept showing it as running: the primary action stayed "Shutdown" (aimed at a body that no longer exists), the card never offered Start, and mentioning the agent never redeployed it. Established offline relay presence now overrides the receipt for lifecycle routing (`isManagedAgentActive`). Unknown presence keeps the receipt, so a failed or disconnected read never invents an offline agent. Deploy re-converges the provider, which replaces a completed pod. - Agent cards, profile panel and members sidebar route Deploy/Shutdown and their status badges through the presence-aware helper. - Mentioning a deployed provider agent reads presence once at send time (no composer subscription) and queues a redeploy when it is offline, for both channel members and agents attached by the mention. - The agent-availability E2E spec pinned "offline deployment keeps Shutdown, no inferred redeploy"; it now expects Deploy. Nothing redeploys without a user action beyond the mention path, which already deployed never-deployed provider agents. Signed-off-by: Tony <tony@tarantini.io>
The remaining places that read a provider's `deployed` receipt as "running" now consult relay presence too, so a shut-down or reaped remote agent is no longer shown, ranked, or skipped as if it were live. - Adding an offline remote agent to a huddle redeploys it; before, the add left it undeployed and it never joined. - Choosing which instance to reuse when adding a persona to a channel reads presence once for deployed candidates, so a reaped deployment no longer outranks a running sibling. Persona cards pick their representative instance the same way. - "Stop running agents" no longer counts offline remote agents. - Pulse's fallback status for managed agents missing from the relay directory follows presence instead of the receipt. - @mention ranking takes a remote agent's activity from the relay directory rather than the receipt. - Changing the model of an offline remote agent no longer asks for a restart. Signed-off-by: Tony <tony@tarantini.io>
Keep `isManagedAgentActive` as control-plane bookkeeping (a provider's `deployed` receipt counts) and move the presence-aware check to a separate `isManagedAgentLive(agent, availability)`, matching I3 in docs/remote-agents.md (presence is the status; the deployment axis is bookkeeping) and the vocabulary proposed in block#5138. Behavior is unchanged: every caller that passed presence now calls the live check. Signed-off-by: Tony <tony@tarantini.io>
…presence Trim this PR to the reported bug: the lifecycle controls and badges, and redeploying an offline remote agent wherever a start happens. Instance reuse ranking, persona-card selection, Pulse, mention ranking, the model picker prompt and the stop-all count move to a follow-up. `attachManagedAgentToChannel` now reads presence itself for a deployed agent, so every attach path (mention, add to channel, persona provisioning in a regular channel) redeploys an offline remote agent without each caller threading presence in. The mention path re-checks cancellation after its presence read so a cancelled send queues no wake. Signed-off-by: Tony <tony@tarantini.io>
anthony-tarantini
force-pushed
the
fix/remote-agent-restart
branch
from
October 21, 2026 23:51
81f6416 to
fcf1239
Compare
Author
|
@buzz-security-review fcf1239 |
anthony-tarantini
marked this pull request as ready for review
October 22, 2026 00:32
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
A remote agent (for example on Kubernetes) could not be restarted from the desktop once it stopped. After
!shutdown, or after its pod exited for inactivity, the app kept showing it as running: the button stayed "Shutdown", the card never offered Start, and mentioning or re-adding the agent did nothing.A provider agent's status becomes
deployedon its first deploy and is never cleared (there is no undeploy in v1), and every "is it running?" check read that receipt. Per I3 indocs/remote-agents.md, presence is the status and the deployment axis is bookkeeping.This adds
isManagedAgentLive(agent, availability). Adeployedagent counts as live until relay presence shows it offline. Unknown presence (relay disconnected, failed read) keeps the receipt, so the app never invents an offline agent.isManagedAgentActivekeeps its bookkeeping meaning, the split proposed in #5138. Starting an offline agent deploys it again with its saved settings; the provider already replaces a finished pod.attachManagedAgentToChannelreads presence once itself, so every attach path is covered. The mention path re-checks cancellation after its read, and the composer gets no presence subscription.This reverses a behavior
agent-availability.spec.tspinned on purpose ("an offline deployment keeps Shutdown; no inferred redeploy"). Nothing redeploys without a user action; a mention or huddle add already deployed agents that had never been deployed.The UI updates live only once the agent's
offlinepresence reaches the relay, which #8385 fixes. Without it, this PR still works but updates on the next presence fetch.Related issue
Fixes #4730. Fixes #7724.
Overlaps three open PRs: #5138 (same liveness split, which this PR adopts and extends to the start paths), and #7072 and #7485 (profile panel only).
Testing
managedAgentControlActions.test.mjs: table tests over every status × presence combination forisManagedAgentLive,isManagedAgentActiveand the displayed status, plus the Deploy label.channelAgents.attach.test.mjs: an offline agent is redeployed through the real presence read; an online agent, a failed read, or a disconnected relay are not.useEnsureAgentMentionsReady.test.mjs: an offline member is woken; a send cancelled during the presence read queues nothing.pnpm build:e2eand theagent-availabilityintegration test also passed.Manual test: deploy a remote agent and wait until it's online, then Shutdown. The card should show Start, and the profile should show Deploy and Stopped. Deploy it again; a new pod should start. Shut it down and @mention it, and it should redeploy.
Not in this PR
provider_config.imagecannot be changed after creation #7723 (image can't be edited) are separate.Screenshots
Profile panel for a deployed remote agent whose presence is offline.
buzz-review-completed