Files
floop/code/tests
onibot 004c7974c6 floop: execution branches over ambiguity — fork per reading, conditional answer
His branching design (22-23/10, consolidated; now coded): when an
expert returns SEVERAL defensible readings of one question (the
knowledge ablation audit's ambiguous + alternatives payload), a
question that DEPENDS on that row must not inherit the coin-flip.
The old behaviour: alternatives were passed in the router context
(rejected — it only moves the guess into answer_kg) or collapsed
inside the ANSWER prompt (run L: 'Papandreou was the predecessor' —
the exact rejected behaviour).

The mechanism (floop/branches.py + machine._run_branch):
- LAZY: a branch is born only when the ambiguous row has an OPEN
  dependent subtree (open_subtree, frozen at fork time so every
  branch of the fork copies the same questions); an ambiguity nobody
  needs stays a note.
- A branch is a WORLD, not a fork of the run: the dependent subtree
  is re-created inside the branch with branch-scoped qids (B1.Q2),
  and the shared evidence table is read through a BranchView that
  BINDS the ambiguous row to the branch's reading (a VIEW — the table
  is never mutated, the original row keeps all readings) and hides
  other branches' rows.
- SHARED: acquired knowledge lands in the ONE table, tagged
  provenance['branch']; the KG/seen-index live in the expert, shared
  by construction. A later branch reuses an earlier one's gathering.
- DEATH: by contradiction, dead end (all branch questions failed) or
  NATURAL MERGE (same normalized answer as another branch — one
  conclusion, recorded merged). Never an absurdity judge.
- NESTING: an ambiguous row answered inside a branch (with its own
  dependent) opens sub-branches under it (origin=<branch id>); the
  parent carries its children's conditional as its answer. Branch
  cap (6) drops and NAMES extra readings — never silent.
- CONDITIONAL ANSWER: _finish composes the final answer by FIXED
  CODE over surviving branches — 'if you meant X -> A | if you meant
  Y -> B'; single survivor renders plain. Never a synthesis prompt
  choosing a reading inside itself.
- WARNINGS: FORK/BRANCH lines on screen AND log ([W]) — the fork is
  a machine judgement worth a human's eye, and META's lessons bank
  counts them.

Docs: ALGORITHM.md §6-bis (the mechanism as a law); README honest map
row. Tests: tests/branches.py — 5 E2E (fork+conditional, lazy no-fork,
dead-branch honesty, natural merge, nested sub-branches). Suite 18/18.

Live smoke (ollama-cloud, warm agent KG): the Pedro question runs
clean through the new paths (8 calls, 52s, honest answer; the fork
did not fire — the audit found no second reading in that KG; the
mechanism is proven by the E2E tests, the real-detector proof is his
local run over his accumulated KG).
2026-10-23 16:29:26 +02:00
..