Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(wiki): stop the numeric guard from rejecting source-citation UUIDs
Ruben Lütkedf75e03c64c5
diff --git a/jarvis/memory/wiki/consolidator.py b/jarvis/memory/wiki/consolidator.pyindex 50617c3f67..f1ed536f9a 100644--- a/jarvis/memory/wiki/consolidator.py+++ b/jarvis/memory/wiki/consolidator.py@@ -82,6 +82,12 @@ _GRAPH_TARGET_DIR_BY_KIND = {# response and try another provider without a second model call._NUMERIC_VALUE_RE = re.compile(r"(?<!\d)\d+(?:[.,:/-]\d+)*(?:\s*%)?(?!\d)")_ORDERED_LIST_PREFIX_RE = re.compile(r"^\s*\d+[.)]\s+")+# Inline code carries identifiers (``session `f260abcc-…```` in a Sources+# line), not numeric claims about the world. Fragmenting a cited UUID into+# pseudo-numbers once wedged the whole provider chain: every judge that+# followed the schema's citation style was rejected for "unsupported"+# digit runs of its own source reference.+_INLINE_CODE_SPAN_RE = re.compile(r"(`+)([^`\n]+?)\1")_SCHEMA_DATE_RE = re.compile(r"\d{4}-\d{2}-\d{2}\Z")_SCHEMA_DATE_FIELDS = frozenset({"created", "updated", "started", "last_activity", "valid_until"}@@ -982,6 +988,7 @@ class Consolidator:body,row=by_id[cid],existing_path=target_path if target_path.is_file() else None,+ neighbours=neighbours.values(),)if unsupported:values = ", ".join(sorted(unsupported))@@ -1140,16 +1147,22 @@ class Consolidator:*,row: JournalRow,existing_path: Path | None,+ neighbours: Iterable[str] = (),) -> set[str]:"""Return model-added numeric values with no grounded source.Candidate facts, their exact user-evidence excerpt, safe subject slugs,- and the current target page are authoritative. ISO dates in the+ the current target page, and the neighbour bodies the judge was shown+ are authoritative — a number copied from a page in the judge's own+ input is a cross-reference, not an invention, and rejecting it would+ burn every provider on a correct answer. ISO dates in theschema's date frontmatter fields are bookkeeping rather than factualprose and are allowed; the normal create/update path supplies today'sdate there. Markdown ordered-list indices are formatting, not claims."""- grounded_text = "\n".join((row.fact, row.evidence_excerpt, *row.subjects))+ grounded_text = "\n".join(+ (row.fact, row.evidence_excerpt, *row.subjects, *neighbours)+ )grounded = cls._numeric_values(grounded_text)today = _dt.date.today()# The Stage-2 prompt explicitly supplies this temporal context. The@@ -1223,6 +1236,7 @@ class Consolidator:):continueclaim_text = _ORDERED_LIST_PREFIX_RE.sub("", raw_line)+ claim_text = _INLINE_CODE_SPAN_RE.sub(" ", claim_text)values.update(match.group(0).replace(" ", "")for match in _NUMERIC_VALUE_RE.finditer(claim_text)diff --git a/tests/unit/memory/wiki/test_consolidator.py b/tests/unit/memory/wiki/test_consolidator.pyindex af2df007a4..35f50889b4 100644--- a/tests/unit/memory/wiki/test_consolidator.py+++ b/tests/unit/memory/wiki/test_consolidator.py@@ -1244,6 +1244,56 @@ async def test_numeric_value_already_in_existing_page_remains_valid(stack) -> Noassert "installed in the desktop" in content+def test_source_citation_uuid_in_inline_code_is_not_a_numeric_claim() -> None:+ """A schema-style Sources line cites opaque ids in inline code+ (``session `f260abcc-…```` ). Fragmenting those ids into pseudo-numbers+ once rejected every provider for citing its own source reference."""+ row = SimpleNamespace(+ fact="The user uses Safari as their web browser.",+ evidence_excerpt=(+ "Evidence user turn [e4fa3a8e-13c4-40c9-ae04-8e88bf702b6a]: "+ "open Safari please"+ ),+ subjects=("user", "safari"),+ )+ body = (+ "# Safari\n\n## Summary\n\nThe user's web browser.\n\n"+ "## Sources\n\n"+ "- Realtime transcript: session "+ "`f260abcc-b5a3-4c38-9502-3f6473ba0ae9`, turn "+ "`8cf7b42d-5229-4617-91fe-d406b1e4fe6d`.\n"+ )+ assert (+ Consolidator._unsupported_numeric_values(+ body, row=row, existing_path=None+ )+ == set()+ )+++def test_numbers_copied_from_shown_neighbour_page_are_grounded() -> None:+ """A number the judge copied from a page in its own input is a+ cross-reference, not an invention; only truly new numbers are flagged."""+ row = SimpleNamespace(+ fact="Lena lives in Hamburg.",+ evidence_excerpt="",+ subjects=("lena",),+ )+ body = "# Hamburg\n\nLena (born 1994) lives here.\n"+ assert Consolidator._unsupported_numeric_values(+ body, row=row, existing_path=None+ ) == {"1994"}+ assert (+ Consolidator._unsupported_numeric_values(+ body,+ row=row,+ existing_path=None,+ neighbours=["# Lena\n\n- Born 1994.\n"],+ )+ == set()+ )++@pytest.mark.asyncioasync def test_range_rendering_of_grounded_endpoints_is_accepted(stack) -> None:""""5 to 6 million" evidence grounds a "5-6 million" page rendering.