Repository navigation
fix(memory): handle non-numeric confidence in bootstrap --infer - #6656
Conversation
|
Verdict: Approve A model that answers Real-world evidenceN/A: no evidence bundle was produced for this run. To exercise the change for real, a live model has to return a word confidence, and this runner has no inference. The verdict rests on static review plus the PR's unit tests, which drive the CLI review loop and the 🔍 Technical detailsIssues found 🟢 Stream 🟢 Siblings checked, none affected. 🟢 Commit history: Known bug classes: no new waits, subprocesses or shared-file writes. On model-output handling, the parser now tolerates the word/number variants models actually emit, and raw values reach the user only via Docs drift: no doc states the old 0.7 substitution or describes how confidences are parsed (I grepped Strengths
|
A model can answer "Infinity" or a float overflow; clamping that to 1.0 would store a full-confidence insight the model never meant. Treat any non-finite number like NaN: skip the insight and say why.
Summary
gaia memory bootstrap --inferno longer crashes when the model returns a word confidence such as"high". Word confidences are mapped to numbers; unusable ones are skipped with a message that names the insight.Why
_bootstrap_infer()didfloat(insight.get("confidence", 0.7))with no guard, so one"high"ended the whole review with a traceback, even after earlier insights were approved. The Agent UI's/api/memory/stream-inferencecaught the error but silently substituted 0.7, which goes against the no-silent-fallbacks rule.Linked issue
Fixes #6637
Changes
normalize_confidence()insrc/gaia/agents/base/inferred_insights.py, used by both paths:low/medium/high(case-insensitive, whitespace stripped) map to 0.4 / 0.7 / 0.9"very sure",null, lists, bools, NaN) returnsNoneconfidencestill defaults to 0.7logSSE event instead of a silent 0.7, and thedonetotal counts only insights actually sent.Test plan
pytest tests/unit/test_memory_bootstrap_infer.py tests/unit/test_memory_router.py(232 passed, 2 skipped)"high","HIGH ", numeric strings, clamping, and rejection of"very sure","",None, list, dict, bool, NaN"high","very sure"andnullstores the valid insights and prints the skips; missing confidence still shows 70%"HIGH "maps to 0.9,"very sure"is skipped with a log event,totalis 2pytest tests/unit -k memory(2274 passed, 105 skipped)python util/lint.py --black --isort --pylint --flake8: black/isort/flake8 pass; pylint reports only the two existing E1120 errors insrc/gaia/utils/terminal.pyandsrc/gaia/utils/awake_clock.py, which are also on main