fix(desktop): offer redeploy when editing a deployed remote agent - #1
Merged
Conversation
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>
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.
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:
autoRestartPolicy.ts)"deployed"counts as activeneeds_restartis derived from the local process table, so the restart badge never appearsbackend.type === "local"The only way to apply an edit was a manual
!shutdownmessage 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:respawnManagedAgentWithRulesalready skips the local stop for provider backends.model), souseInstanceModelDefinitionWritenow exposeswillWriteand the offer counts it as host-visible.Decision logic lives in
redeployAfterEdit.ts(pure, unit-tested); toast selection is consolidated inshowAgentPostSaveToastsso the dialog stays a thin caller and under its file-size ratchet.Verification
pnpm run typecheck— cleanpnpm exec biome checkon changed files — cleanpnpm run check:file-sizes— clean (dialog at exactly its ratchet ceiling)pnpm test— 4193 pass / 0 fail (includes newredeployAfterEdit.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)
probe_provider_modelsmachinery is reusable from a record'sbackendfield alone)needs_restartdrift signal + auto-apply with proper mid-turn gates