Skip to content

curate: invalid category enum value silently fails an operation while task/CLI report overall success #767

Description

@GlennJimerson

Summary

brv curate can silently fail an operation while the CLI and the task log both report overall success, when the curator agent's structured output includes a category value outside the accepted enum. This looks like a validation/retry gap rather than an LLM-quality issue: the model's classification attempt was reasonable given the input, but there's no correction path when it doesn't match the schema.

Repro

$ brv curate -- "[Agent memory] some fact worth remembering"
  Thinking...
  ✓ CodeExec
  Thinking...
  ✓ CodeExec
✓ Context curated successfully. (Task: <id> · Log: <log-id>)

CLI output reports success. But the task's own curate-log JSON (~/.local/share/brv/projects/<project>/curate-log/<log-id>.json) shows:

{
  "operations": [
    {
      "status": "failed",
      "type": "ADD",
      "message": "Invalid input: [{\"received\":\"agent_memory\",\"code\":\"invalid_enum_value\",\"options\":[\"personal\",\"project\",\"preference\",\"convention\",\"team\",\"environment\",\"other\"],\"path\":[\"operations\",0,\"content\",\"facts\",0,\"category\"],\"message\":\"Invalid enum value. Expected 'personal' | 'project' | 'preference' | 'convention' | 'team' | 'environment' | 'other', received 'agent_memory'\"}]"
    }
  ],
  "status": "completed",
  "summary": { "added": 0, "deleted": 0, "failed": 1, "merged": 0, "updated": 0 }
}

The top-level task status is "completed" and the CLI prints a green checkmark despite summary.failed: 1 and zero facts actually added.

The trigger: input text containing a bracketed hint like [Agent memory] (from a downstream integration that labels mirrored content by source) leads the curator to invent a category string derived from that hint (agent_memory) rather than picking one of the seven valid enum values. Removing the bracket label and curating the same fact as plain text succeeds normally.

Why this matters

Any caller relying on brv curate's process exit code or the printed "✓ Context curated successfully" / task status: completed as a success signal cannot detect this failure mode without separately inspecting operations[].status in the curate-log. For an integration (e.g. a plugin that mirrors another tool's memory writes into brv curate calls) this means writes can silently vanish.

Suggested fix

Either:

  1. Retry the structured-output generation with the Zod/schema validation error fed back to the model (standard self-correction loop), or
  2. Fall back to a safe default category ("other") when the model's output doesn't validate, rather than dropping the fact entirely, or
  3. At minimum, surface operations[].status === "failed" in the CLI's exit code / top-level printed message, so callers relying on the CLI's own reported outcome aren't misled.

Environment

  • byterover-cli/3.16.1 linux-x64 node-v24.13.1
  • Linux x64, release tarball install (not npm)

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