fix(desktop): use live presence, not control-plane status, for a provider agent's status/action - #7078
Open
renatobardi wants to merge 3 commits into
Open
fix(desktop): use live presence, not control-plane status, for a provider agent's status/action#7078renatobardi wants to merge 3 commits into
renatobardi wants to merge 3 commits into
Conversation
The profile panel's Restart affordance was gated to `backend.type === "local"`, but a provider agent's `status` is a control-plane fact (runtime.rs's two-axis model: "the provider was invoked") that stays "deployed" forever once set — there is no v1 undeploy. It never reverts after `!shutdown` takes the harness offline, so once a provider agent went offline it had no way back: the primary action stayed permanently wired to resend `!shutdown`, never `start`. respawnManagedAgentWithRules already handles provider backends correctly (skips the stop step, calls start directly), so the local-only gate was just an unnecessary restriction — isManagedAgentActive is already backend-agnostic. Drop the extra check and use it directly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Renato Bardi <renato.bardi@outlook.com>
…er-shutdown fix(desktop): let a provider-backed agent be restarted after shutdown
…ider agent's status/action
runtime.rs documents a two-axis model for remote agents: control-plane
status ("deployed" = the provider was invoked) stays permanent once set
— there is no v1 undeploy — while live presence (online/away/offline)
is "the real-time signal for whether the harness is connected". The
primary Shutdown/Deploy label, its click handler, the profile avatar
dot, and the members-sidebar status badge/icon all read only the
control-plane status, so a provider agent that goes offline via
`!shutdown` looks and behaves as if still running forever: the dot
stays green, the label stays "Shutdown", and clicking it just resends
`!shutdown` to an already-dead agent instead of ever reaching `start`.
Add isManagedAgentLive(agent, presenceStatus), which defers to presence
for provider backends (falling back to control-plane status only while
presence hasn't resolved yet, avoiding a flash of "offline"), and wire
it into every place that decides what a provider agent's live state
looks like: the profile panel's avatar dot, primary action label/click
decision, and their members-sidebar counterparts (badge, icon, label,
click decision).
isManagedAgentActive itself is untouched — it stays the correct,
presence-independent check for the Restart affordance (already fixed
in #1) and other control-plane-only callers (e.g. picking which
instance to show, sorting).
Out of scope, left as-is: the Agents grid (UnifiedAgentsSection.tsx)
has no presence data plumbed in at all today — wiring that in is a
separate, larger change (new query + multi-level prop threading), not
folded into this fix. Likewise the real-time observer-attachment call
sites (ManagedAgentSessionPanel, profileActivityFeedScope, AgentSessionThreadPanel)
share the same root cause but are a distinct, riskier surface (live
event streaming) left for a follow-up.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Renato Bardi <renato.bardi@outlook.com>
🔐 Codex Security 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
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
runtime.rsdocuments a two-axis model for remote agents: control-plane status ("deployed"= the provider was invoked) stays permanent once set — there is no v1 undeploy — while live presence (online/away/offline) is "the real-time signal for whether the harness is connected." The primary Shutdown/Deploy label, its click handler, the profile avatar dot, and the members-sidebar status badge/icon all read only the control-plane status, so a provider agent that goes offline via!shutdownlooks and behaves as if still running forever: the dot stays green, the label stays "Shutdown", and clicking it just resends!shutdownto an already-dead agent instead of ever reachingstart.Adds
isManagedAgentLive(agent, presenceStatus), which defers to presence for provider backends (falling back to control-plane status only while presence hasn't resolved yet, avoiding a flash of "offline"), and wires it into every place that decides what a provider agent's live state looks like: the profile panel's avatar dot, primary action label/click decision, and their members-sidebar counterparts (badge, icon, label, click decision).isManagedAgentActiveitself is untouched — it stays the correct, presence-independent check for the Restart affordance (#7072) and other control-plane-only callers (e.g. picking which instance to show, sorting).Out of scope, left as-is: the Agents grid (
UnifiedAgentsSection.tsx) has no presence data plumbed in at all today — wiring that in is a separate, larger change (new query + multi-level prop threading). Likewise the real-time observer-attachment call sites (ManagedAgentSessionPanel,profileActivityFeedScope,AgentSessionThreadPanel) share the same root cause but are a distinct, riskier surface (live event streaming) left for a follow-up.Related issue
Builds on #7072 (Restart affordance). None found for this specific issue.
Testing
isManagedAgentLive: online/away → live, offline → not live, unresolved presence falls back to control-plane status, local agents ignore presence entirely.pnpm exec tsc --noEmitclean.pnpm exec biome checkclean.agents/profile/channelsfeature test suites: 2030/2030 passing.presence set to offline) followed by a real redeploy (new process,connected to relay,presence set to online), where before this fix the same click just resent an ineffective!shutdown.Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com