Skip to content

fix: agents update patches from full config so a rename can't wipe the pipeline#7

Open
rajarshidattapy wants to merge 1 commit into
bolna-ai:mainfrom
rajarshidattapy:fix/agents-update-partial-config
Open

fix: agents update patches from full config so a rename can't wipe the pipeline#7
rajarshidattapy wants to merge 1 commit into
bolna-ai:mainfrom
rajarshidattapy:fix/agents-update-partial-config

Conversation

@rajarshidattapy

Copy link
Copy Markdown

What

Fixes #2

bolna agents update fetched the full agent (GetAgent) but then threw it away and PATCHed a single-key payload — e.g. {"agent_config":{"agent_name":"new"}} for a rename, or {"agent_prompts":{"task_1":{...}}} for --prompt. If the API replaces (or only shallow-merges the top-level agent_config/agent_prompts keys), that wipes everything else: tasks, voice, telephony, synthesizer, transcriber, LLM, and any sibling task_2 (summarization) prompt.

Fix

Extract a pure buildAgentUpdate(...) that starts from a copy of the agent's existing nested agent_config / agent_prompts and overlays only the changed fields, so the PATCH always carries the complete object — safe whether the API replaces or shallow-merges those keys.

Files:

  • internal/api/agents.goAgent.AgentConfig() / Agent.AgentPrompts() to read the current nested objects from a GET response.
  • internal/cli/agents.gobuildAgentUpdate(...) replaces the inline partial-payload construction; shallow-copies so it never mutates the fetched agent.
  • internal/cli/agents_test.go — pins the guarantee.

Tests

  • Rename preserves tasks / llm / synthesizer / agent_welcome_message.
  • --prompt preserves the task_2 prompt.
  • Builder does not mutate the caller's fetched agent.
  • No-op input yields an empty payload (never PATCH when nothing changed).

go build, go vet, go test ./... all pass.

Confidence / remaining blocker

  • agent_prompts (task_2 preservation): confirmed solidSystemPrompt() already reads current["agent_prompts"] and works, so the nested shape is known.
  • agent_config: rests on the codebase's documented assumption (api/agents.go:34 — GET mirrors the {agent_config, agent_prompts} create shape). Made defensive: if GET omits nested agent_config, config-only edits degrade to the old partial (marked with a ponytail: comment).

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.

Agents update sends a partial agent_config — may wipe the rest of the agent's configuration

1 participant