fix: agents update patches from full config so a rename can't wipe the pipeline#7
Open
rajarshidattapy wants to merge 1 commit into
Open
Conversation
…add tests for update behavior
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.
What
Fixes #2
bolna agents updatefetched 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-levelagent_config/agent_promptskeys), that wipes everything else: tasks, voice, telephony, synthesizer, transcriber, LLM, and any siblingtask_2(summarization) prompt.Fix
Extract a pure
buildAgentUpdate(...)that starts from a copy of the agent's existing nestedagent_config/agent_promptsand 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.go—Agent.AgentConfig()/Agent.AgentPrompts()to read the current nested objects from a GET response.internal/cli/agents.go—buildAgentUpdate(...)replaces the inline partial-payload construction; shallow-copies so it never mutates the fetched agent.internal/cli/agents_test.go— pins the guarantee.Tests
tasks/llm/synthesizer/agent_welcome_message.--promptpreserves thetask_2prompt.go build,go vet,go test ./...all pass.Confidence / remaining blocker
agent_prompts(task_2 preservation): confirmed solid —SystemPrompt()already readscurrent["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 nestedagent_config, config-only edits degrade to the old partial (marked with aponytail:comment).