Skip to content

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.

fix(wiki): make primary/secondary decision classification order-independent

Ruben Lütkecf8ba929a492
diff --cc install/installer.py
index 28764ae881,a52ad427a7..994285e3f2
--- a/install/installer.py
+++ b/install/installer.py
@@@ -413,10 -423,10 +423,10 @@@ def step_pip_install(*, with_desktop: b
def is_update_run() -> bool:
"""True when this checkout was already installer-managed (re-run = update)."""
- return (repo_root() / ".jarvis-managed-install").exists()
+ return (repo_root() / MANAGED_INSTALL_MARKER).exists()
-def step_models(*, dry_run: bool) -> None:
+def step_models(*, full_profile: bool, dry_run: bool) -> None:
phase("5/6", "Voice models")
note("downloading everything the voice pipeline needs, so the first")
note("launch is ready immediately - nothing is fetched at startup")
diff --cc jarvis/memory/wiki/consolidator.py
index fc094ff4c3,8ab0072c54..d5b0d3353e
--- a/jarvis/memory/wiki/consolidator.py
+++ b/jarvis/memory/wiki/consolidator.py
@@@ -121,6 -115,6 +121,24 @@@ _EXPLICIT_PERSISTENCE_CLAUSE_RE = re.co
)
++def _canonical_decision_order(parsed: list[Any]) -> list[Any]:
++ """Stable-sort ``update`` decisions ahead of everything else.
++
++ The judge's array order carries no semantics, but primary/secondary
++ classification is positional: ``{add companion, update profile}`` in
++ that order once read the add as the primary and rejected the update
++ as an illegal second primary — while the identical pair in reverse
++ order was the legal companion shape. Canonicalising makes both
++ orderings validate (and execute) identically.
++ """
++ return sorted(
++ parsed,
++ key=lambda item: (
++ 0 if isinstance(item, dict) and item.get("decision") == "update" else 1
++ ),
++ )
++
++
@dataclass(frozen=True, slots=True)
class _BatchOutcome:
"""Internal Stage-2 result without collapsing transient states."""
@@@ -404,7 -386,7 +422,7 @@@ class Consolidator
rejection_reasons.append(reason)
return reason
try:
-- parsed = _extract_json_array(agg.text)
++ parsed = _canonical_decision_order(_extract_json_array(agg.text))
except ValueError as exc:
reason = f"malformed JSON array: {exc}"
rejection_reasons.append(reason)
@@@ -463,7 -437,7 +481,11 @@@
"Consolidator: judge returned %d decision(s) for %d candidate(s) "
"in %dms", len(parsed), len(rows), duration_ms,
)
-- return [item for item in parsed if isinstance(item, dict)]
++ return [
++ item
++ for item in _canonical_decision_order(parsed)
++ if isinstance(item, dict)
++ ]
# ------------------------------------------------------------------
# decision execution
diff --cc tests/unit/memory/wiki/test_consolidator.py
index 626861c938,00c5cc0ca4..04b8f30de9
--- a/tests/unit/memory/wiki/test_consolidator.py
+++ b/tests/unit/memory/wiki/test_consolidator.py
@@@ -682,6 -682,6 +682,57 @@@ async def test_companion_add_creates_to
assert journal.pending() == []
++async def test_companion_add_before_profile_update_is_the_same_legal_shape(
++ stack,
++) -> None:
++ """Array order carries no semantics: {add companion, update profile} in
++ that order must validate exactly like the reverse (live 2026-07-20:
++ gemini emitted add-first for every retry and the whole chain burned on
++ a correct answer)."""
++ vault_root, _curator, journal = stack
++ _write_aged(vault_root / "entities" / "ruben.md", RUBEN_FULL_BODY)
++ journal.append(
++ [CandidateFact(
++ fact="The user is pursuing a high-end espresso machine for the kitchen.",
++ kind="preference", subjects=("ruben", "espresso-machine"),
++ )],
++ source_label="realtime-aggressive:4", turn_hash="h-espresso-4",
++ )
++ cid = journal.pending()[0].id
++
++ updated_profile = RUBEN_FULL_BODY.replace(
++ "- Enjoys great coffee.\n",
++ "- Enjoys great coffee.\n"
++ "- Pursuing a high-end espresso machine for the kitchen.\n",
++ )
++ brain = FakeBrain([_judge_json([
++ {
++ "candidate_id": cid,
++ "decision": "add",
++ "target": "projects/espresso-machine.md",
++ "new_body": _espresso_project_body(),
++ "reason": "companion topic page listed first",
++ },
++ {
++ "candidate_id": cid,
++ "decision": "update",
++ "target": "entities/ruben.md",
++ "new_body": updated_profile,
++ "reason": "profile note listed second",
++ },
++ ])])
++ consolidator = _consolidator(stack, brain)
++
++ label = await consolidator.run_once()
++
++ assert label == "journal-batch:1"
++ assert (vault_root / "projects" / "espresso-machine.md").is_file()
++ profile = (vault_root / "entities" / "ruben.md").read_text(encoding="utf-8")
++ assert "- Pursuing a high-end espresso machine for the kitchen." in profile
++ assert journal.pending() == []
++
++
@pytest.mark.asyncio
async def test_failing_companion_add_never_blocks_the_primary_fact(stack) -> None:
"""The companion topic page is a bonus, not a hostage-taker: when it is