Skip to content

Bug: relevance_patch_agent saves literal file reference strings instead of erroring #6

@charliebirch

Description

@charliebirch

Summary

When passing a file path reference like {{FILE:/tmp/prompt_for_patch.txt}} as a value to relevance_patch_agent, the tool saves the literal string {{FILE:/tmp/prompt_for_patch.txt}} as the field value instead of either resolving the file or returning an error.

This silently overwrote a 35,858-character system prompt with a 34-character garbage string, breaking a production agent.

Steps to Reproduce

  1. Call relevance_patch_agent with:
    {
      "agent_id": "...",
      "patch": {"system_prompt": "{{FILE:/tmp/prompt_for_patch.txt}}"}
    }
  2. The tool returns "patched": true with system_prompt_length: 34
  3. The agent's system prompt is now the literal string {{FILE:/tmp/prompt_for_patch.txt}}

Expected Behavior

Either:

  • Option A (preferred): Reject the input with an error if the value looks like a file reference template (matches {{FILE:...}} pattern)
  • Option B: Document clearly that MCP tool parameters are always literal values with no template resolution

Impact

  • Severity: High — silently destroys agent config with no warning
  • The tool returns "patched": true which makes it look like success
  • Only the system_prompt_length in the response reveals the problem (34 vs expected 35,858)

Suggested Fix

Add input validation: if any string value in patch matches {{FILE:...}} or similar template patterns, return an error explaining that file references are not supported and the actual content must be passed directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions