Skip to content

Add edit dialog for managed agents with relay profile sync#277

Open
wpfleger96 wants to merge 3 commits intomainfrom
sprout-ux/edit-agents
Open

Add edit dialog for managed agents with relay profile sync#277
wpfleger96 wants to merge 3 commits intomainfrom
sprout-ux/edit-agents

Conversation

@wpfleger96
Copy link
Copy Markdown
Collaborator

@wpfleger96 wpfleger96 commented Apr 8, 2026

This PR adds an Edit dialog for managed agents so configuration changes don't require delete-and-recreate, and syncs name changes to the relay so they're visible in @mentions, DMs, and member lists.

UpdateManagedAgentRequest only patched model and system_prompt. Name, parallelism, relay URL, agent command, MCP command, turn timeout, and toolsets were write-once at creation time. Renaming an agent updated the local record but never re-published the relay profile, making name changes invisible to other users.

  • Extend UpdateManagedAgentRequest in types.rs with editable fields for all runtime config (parallelism, relay URL, commands, toolsets) using patch semantics
  • Make update_managed_agent async; call sync_managed_agent_profile() to re-publish the kind:0 event when the name changes (best-effort — local save always succeeds, relay sync failure is logged and returned as a non-fatal warning)
  • Add useUpdateManagedAgentMutation hook with optimistic cache update and invalidation on managed-agents and relay-agents queries
  • Add EditAgentDialog.tsx reusing CreateAgentBasicsFields and CreateAgentRuntimeFields pre-populated with current values; diffs on submit to send only changed fields; includes mcpToolsets field from Add per-agent MCP toolset configuration to agent setup #279
  • Wire an "Edit" DropdownMenuItem with a Pencil icon into AgentActionsMenu in ManagedAgentRow.tsx (hidden for provider-backed agents)
  • Validate numeric fields (parallelism, turnTimeoutSeconds) and block clearing previously-set acpCommand/mcpCommand to empty strings

@wesbillman
Copy link
Copy Markdown
Collaborator

@wpfleger96 I have some agent catalog stuff in flight here, so it might change the behavior of this. Let's check things again after that merges to see where we can improve.

@wpfleger96
Copy link
Copy Markdown
Collaborator Author

@wesbillman np happy to wait until that's ready!

@wesbillman
Copy link
Copy Markdown
Collaborator

wesbillman commented Apr 9, 2026

@wpfleger96 excellent, the start of the catalog is in there now so feel free to take a look. Might not impact this work too much.

Oh also, it's nice if you can drop an image or 2 in here (or a video) to see what this feature does for the reviewers

@wpfleger96 wpfleger96 force-pushed the sprout-ux/edit-agents branch 4 times, most recently from a64f253 to afaed41 Compare April 10, 2026 16:47
@wesbillman
Copy link
Copy Markdown
Collaborator

@wpfleger96 is the #288 work similar to yours here?

@tellaho
Copy link
Copy Markdown
Collaborator

tellaho commented Apr 10, 2026

@wpfleger96 is the #288 work similar to yours here?

Think they are adjacent, but not overlapping. #288 is mostly for importing against "my" teams and agents.

Once a managed agent was created, there was no way to change its
configuration — system prompt, parallelism, relay URL, commands,
timeouts, and name — without deleting and recreating it from scratch.

Extends UpdateManagedAgentRequest on the Rust side to accept all
editable fields with patch semantics (absent = don't touch), updates
the update_managed_agent command handler to apply them, and mirrors
the extended type on the frontend. Adds a useUpdateManagedAgentMutation
hook following the existing mutation pattern, creates EditAgentDialog
that reuses the CreateAgentDialogSections form components pre-populated
with the agent's current values, and wires an "Edit" item into the
AgentActionsMenu dropdown.
@wpfleger96 wpfleger96 force-pushed the sprout-ux/edit-agents branch from afaed41 to e6c391c Compare April 10, 2026 17:47
useEffect deps included non-stable references (agent object, args
array), causing form state to reset on every 5s background poll
while the user was editing. Pin deps to [open, agent.pubkey].

Also: validate numeric fields in canSubmit, trim relayUrl before
diff, hide Edit for provider-backed agents, and block empty
acpCommand/mcpCommand submission.
@wpfleger96 wpfleger96 force-pushed the sprout-ux/edit-agents branch from e6c391c to bd01f8f Compare April 10, 2026 17:57
@wpfleger96 wpfleger96 changed the title Add edit dialog for managed agents Add edit dialog for managed agents with relay profile sync Apr 10, 2026
update_managed_agent was fire-and-forget for name changes — the local
record updated but the relay's kind:0 profile event was never
re-published, making renames invisible in @mentions, DMs, and member
lists. Reuses the existing sync_managed_agent_profile() path from
agent creation to re-publish the kind:0 event when the name changes.
@wpfleger96 wpfleger96 force-pushed the sprout-ux/edit-agents branch from a365ffa to 1fae620 Compare April 10, 2026 18:15
@wpfleger96
Copy link
Copy Markdown
Collaborator Author

new Edit menu for managed agents:
image
image

@wpfleger96
Copy link
Copy Markdown
Collaborator Author

Renaming a managed agent (or updating avatar) now syncs to the relay after save without having to delete/recreate teh agent:
image

image

(didn't need to restart Sprout or delete/recreate agent here)

image

@wpfleger96
Copy link
Copy Markdown
Collaborator Author

wpfleger96 commented Apr 10, 2026

edits are validated before saving (typing asdf in Turn timeout grays out Save changes button until I fix it):

image

@wpfleger96
Copy link
Copy Markdown
Collaborator Author

@wesbillman mind giving this another look if you get the chance? 😄

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.

3 participants