Skip to content

fix(desktop): use relay presence for remote agent Deploy control - #5967

Draft
olympusbuildz wants to merge 2 commits into
block:mainfrom
olympusbuildz:fix/desktop-remote-agent-presence-actions-5938
Draft

fix(desktop): use relay presence for remote agent Deploy control#5967
olympusbuildz wants to merge 2 commits into
block:mainfrom
olympusbuildz:fix/desktop-remote-agent-presence-actions-5938

Conversation

@olympusbuildz

@olympusbuildz olympusbuildz commented Aug 15, 2026

Copy link
Copy Markdown

Problem

Remote (provider-backed) agents whose process has exited still show online in the profile panel and keep a primary remote-halt control, so there is no UI path to Deploy again. Channel members sidebar already shows the correct offline presence.

Root cause

Two axes exist and are documented:

  • status / isManagedAgentActive = infrastructure still recorded (backend_agent_id present becomes deployed)
  • relay presence = harness actually connected

Profile avatar, primary action label, and lifecycle start-vs-halt all read the infrastructure axis for managed bots. For provider agents that axis never clears when the pod exits.

Fix

  • Add presence-aware helpers in managedAgentControlActions: isManagedAgentPresenceLive, isManagedAgentLive, resolveManagedAgentDisplayPresence
  • Provider primary remote-halt / Deploy affordances and profile avatar use relay presence
  • Local agents still use infrastructure status
  • Wire presence through profile lifecycle hook and members-sidebar agent action

Why it matters

Kubernetes/provider agents that idle-exit become unreachable from the UI until managed-agents.json is hand-edited. Deploy is already idempotent and replaces terminated pods.

Test plan

cd desktop
node --import ./test-loader.mjs --experimental-strip-types --test \
  src/features/agents/lib/managedAgentControlActions.test.mjs

10 passed @ b26c74a779634dd78800b3685fa85481e6a8415b

Named cases:

  • provider deployed + offline → Deploy / not live
  • provider deployed + online/away → remote-halt / live
  • provider process-gone status + online → presence wins (remote-halt)
  • local running/stopped labels unchanged
  • missing presence on provider → Deploy

Manual verify

  1. Provider-backed agent with live presence → profile + sidebar show remote-halt; avatar online
  2. Same agent after process exit (presence offline) → avatar offline, primary Deploy, click starts deploy path
  3. Local agent start/halt controls unchanged

Risk / blast radius

Desktop UI only. Delete-with-confirm already used presence; bulk active filters still use infrastructure status intentionally.

Closest work

none found (open PR search for #5938 / remote agent presence Deploy)

Fixes

Fixes #5938

Peer-review harden

Addressed @themiguelamador review @ d0ab6fa1a:

  • resolveManagedAgentDisplayPresence uses infrastructure status for local agents; relay presence only for provider-backed
  • UserProfilePanel.tsx stays at 999 lines (≤1000 ratchet) by co-locating the presenceStatus prop

Provider-backed agents stay status=deployed while backend_agent_id exists,
so profile and sidebar primary actions treated dead pods as live Shutdown
with no Deploy path. Prefer relay presence for provider liveness; keep
infrastructure status for local agents.

Fixes block#5938

Signed-off-by: Olympusbuildz <Olympus.roots@outlook.com>
Co-authored-by: Olympusbuildz <Olympus.roots@outlook.com>
Signed-off-by: Olympusbuildz <Olympus.roots@outlook.com>

@themiguelamador themiguelamador 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.

Two issues need correction before merge:

  • resolveManagedAgentDisplayPresence ignores its agent argument and uses relay presence for every managed agent. A running local agent with no presence row therefore regresses from online to offline in the profile, contradicting the intended local/infrastructure behavior. The helper should use infrastructure status for local agents and relay presence only for provider-backed agents.
  • The added prop line pushes UserProfilePanel.tsx beyond the repository file-size ratchet (1,000 → 1,001 by the gate’s count), so pnpm check fails on the PR as submitted.

I prepared a signed fix for both findings: https://github.com/Complear/buzz/commit/ef7eebad0

Verification on the fix:

  • focused managed-agent control tests: 10 passed
  • full desktop unit suite: 4,959 passed
  • Biome/file-size/text/pubkey checks pass (only unrelated pre-existing warnings/info)
  • TypeScript typecheck passes
  • git diff whitespace check passes

Address review on block#5967:
- resolveManagedAgentDisplayPresence uses infrastructure status for local
  agents and relay presence only for provider-backed agents.
- Keep the presenceStatus wire without growing UserProfilePanel past the
  1000-line file-size ratchet.

Signed-off-by: Olympusbuildz <Olympus.roots@outlook.com>
Co-authored-by: Olympusbuildz <Olympus.roots@outlook.com>
Signed-off-by: Olympusbuildz <Olympus.roots@outlook.com>
@olympusbuildz

Copy link
Copy Markdown
Author

Addressed review (new commit d0ab6fa1a):

  1. Local display presenceresolveManagedAgentDisplayPresence uses infrastructure (running/deployed → online) for local agents; provider-backed still uses relay presence only.
  2. File-size ratchetUserProfilePanel.tsx remains 999 lines (prop co-located; no net growth past 1000).

Mini: managedAgentControlActions.test.mjs12 passed; check-file-sizes clean @ d0ab6fa1a.

Thanks @themiguelamador.

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.

Remote agents show as online and offer only Shutdown after their process exits, with no UI path to redeploy

2 participants