Skip to content

fix(desktop): offer redeploy when editing a deployed remote agent - #1

Merged
aksOps merged 2 commits into
mainfrom
fix/remote-edit-redeploy
Aug 3, 2026
Merged

fix(desktop): offer redeploy when editing a deployed remote agent#1
aksOps merged 2 commits into
mainfrom
fix/remote-edit-redeploy

Conversation

@aksOps

@aksOps aksOps commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Problem

Editing a provider-backed (remote) agent behaves as if the agent were local: Save writes the local record and nothing reaches the host. The remote unit keeps running with the env file from its last deploy, and every apply mechanism is local-gated:

  • the auto-restart policy never fires for a non-local backend (autoRestartPolicy.ts)
  • the saved-while-stopped toast bails because "deployed" counts as active
  • needs_restart is derived from the local process table, so the restart badge never appears
  • the profile panel Restart button was gated to backend.type === "local"

The only way to apply an edit was a manual !shutdown message followed by Deploy — undiscoverable.

Fix

The start command already IS the redeploy for provider records: it rebuilds the deploy payload from current state, and the SSH provider rewrites the unit env file and unconditionally restarts the unit (verified idempotent, deploy.rs). This PR wires the edit experience to that path:

  • Post-save redeploy offer — saving an edit that touches deploy-visible config on a deployed provider record shows a toast with a Redeploy now action. Offered, not automatic: deploy restarts the remote unit unconditionally, and the local auto-restart policy's mid-turn safety gates (working signal, 3-min quiescence) have no remote equivalent yet.
  • Persistent Redeploy button — the profile panel restart action is un-gated for provider records and labeled Redeploy; respawnManagedAgentWithRules already skips the local stop for provider backends.
  • Linked-definition model writes count — a model edit on a linked instance travels via the definition (the record patch omits model), so useInstanceModelDefinitionWrite now exposes willWrite and the offer counts it as host-visible.
  • Name-only edits do not prompt (the rename syncs to the relay via kind:0 immediately; the host copy is cosmetic).

Decision logic lives in redeployAfterEdit.ts (pure, unit-tested); toast selection is consolidated in showAgentPostSaveToasts so the dialog stays a thin caller and under its file-size ratchet.

Verification

  • pnpm run typecheck — clean
  • pnpm exec biome check on changed files — clean
  • pnpm run check:file-sizes — clean (dialog at exactly its ratchet ceiling)
  • pnpm test — 4193 pass / 0 fail (includes new redeployAfterEdit.test.mjs)

Not verified: live end-to-end against a real SSH host from a Windows build — needs the desktop app rebuilt and a deployed remote agent.

Follow-ups (out of scope)

  • Remote model probing in the edit dialog (the field is deliberately free-text today; the create flow's probe_provider_models machinery is reusable from a record's backend field alone)
  • A remote needs_restart drift signal + auto-apply with proper mid-turn gates
  • Redeploy affordance in the agents list rows / members sidebar

aksOps added 2 commits August 3, 2026 10:16
Saving an edit on a provider-backed agent writes only the local record;
the remote unit keeps running with the env file from its last deploy.
Nothing surfaced this: the auto-restart policy is local-only, the
saved-while-stopped toast treats deployed as active, needs_restart is
derived from the local process table, and the profile panel Restart
button was gated to local backends. The only apply path was a manual
shutdown message followed by Deploy.

- After a save that touches deploy-visible config on a deployed
  provider record, offer "Redeploy now" (start_managed_agent already
  re-deploys provider records; the SSH provider rewrites the env file
  and restarts the unit). Offered, not automatic: deploy restarts the
  unit unconditionally and the local policy's mid-turn safety gates
  have no remote equivalent.
- Un-gate the profile panel restart action for provider records and
  label it Redeploy; respawnManagedAgentWithRules already skips the
  local stop for provider backends.
- Count a linked-definition model write as host-visible via a new
  willWrite flag on useInstanceModelDefinitionWrite.
- Consolidate post-save toasts into showAgentPostSaveToasts with the
  decision logic in redeployAfterEdit.ts plus unit tests.

Signed-off-by: Amit Kumar <ak.nitrr13@gmail.com>
Signed-off-by: Amit Kumar <ak.nitrr13@gmail.com>
@aksOps
aksOps merged commit 8b949cb into main Aug 3, 2026
29 checks passed
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.

1 participant