Repository navigation
Conversation
A write begun with ledger=None was rechecked against the default ledger, found no attempt there, and was held UNCERTAIN. A recheck that slept until its due time could wake a few milliseconds before the wall clock reached it, read the time as not yet due, and hold the write UNCERTAIN.
openadapt-flow learn probe reads the whole-database frame, sends only GET and HEAD requests as the agent, and reads again. A changed row of the acting user that moved (a last-login or token-use time) becomes a frame.learned excuse with source read_only_probe, with no approval. Added rows, rows of other users and rows no user owns are not admitted.
…' into fix/verdict-tiers
Rows that move with no harm (a scheduler, a task queue, totals the app recomputes, notifications) stopped correct writes under the whole-database frame. With frame.database.entity_tables, rows added or changed outside the business-entity tables are logged side effects on a CONFIRMED result and candidates for the learner; removed rows, entity-table rows the write doesn't declare, another user's row and an unexcused column of the actor's row still refute. learn entities derives the scope from the setup and applies it only when planted faults are all still caught under it (runtime/effects/admission.py). The verifier waits for declared records with backoff before judging, settling ignores motion outside the scope, and a generated read's check columns are not compared on undeclared rows. New contracts start in shadow (WriteResult.blocks false) until N clean checks in a row, then a person can turn gating on (openadapt-flow gate).
Independent adversarial review: APPROVEFrom: Grok Protected-path review of the unique work versus
Residual: at judge time, |
What this changes
A whole-database frame stops a correct write when any row anywhere moves. In
the false-stop study (openadapt-internal
evidence/false-stops-2026-11),rows that move with no harm stopped correct writes on three apps: scheduler
and task-queue rows, totals the app recomputes after a save, and a
notification for each watcher of a record. This pull request separates those
from real harm, without letting a planted fault through.
It builds on #2413 (learn per-request bookkeeping from read-only requests)
and #2377 (two rechecks that held correct writes UNCERTAIN). Both are merged
into this branch, not rebased, so review the diff against them.
Three verdict tiers
duplicate, a row the write doesn't declare that changed or was removed in a
business-entity table (another user's row and an unexcused column of the
acting user's row included), a late revert, a lost update, any removed row,
and anything no row comparison explains.
only outside the entity tables. They are listed in the frame evidence as
side_effects(table, change, row count, column names; no keys orvalues) and offered to
openadapt-flow learnas candidate excuses.become visible (0.5, 1, 2, 4 s; 8 s budget;
OPENADAPT_VERIFY_RETRY_S).It reads only through database verifiers, decides nothing, and the full
judge runs afterwards. Settling ignores motion outside the entity tables.
The outcome contract doesn't change. A logged pass is CONFIRMED, so a harm
that slips through it is counted as a silent pass by anything that grades
the outcome.
WriteResultgainstier,side_effects,enforcementandblocks.Entity-scoped frames
frame.database.entity_tablesis opt-in. Unset, every table is judged asbefore. The tables the frame already names (views, judged_by,
new_row_fields, side records, learned excuses, owner tables, profile rules)
always count as entities.
openadapt-flow learn entitiesderives the listfrom the setup: each kind's main table, every table a contract's read
selects from, and the acting user's table (derived from the manifest's actor
parameters by foreign key; with none, no scope is proposed). No app is
named in engine code. On a frame that diffs the whole database, a generated
read's own check columns (
pin__*,empty__*) are no longer compared onundeclared rows. One flipped with the clock on rows nobody wrote.
The safety bar
runtime/effects/admission.pyadmits a relaxation only when, under it,planted wrong-row, wrong-value, duplicate, sibling-edit, late-revert and
lost-update faults, plus the two actor-table attacks, all ran and were all
caught. It also requires that every case caught before still runs.
learn entities applywrites a scope only with such results, run against thestaged scope (the proposal digest must match), and writes every contract or
none.
Shadow mode by default
A new contract is in shadow: its verdict is computed and recorded in full,
but
WriteResult.blocksis false. After N clean checks in a row (20 to 50,default 30,
OPENADAPT_GATE_CLEAN_RUNS), gating is offered. A person turnsit on with
openadapt-flow gate enable.gate labelmarks a stop as a realcatch, which keeps the run, or as a false stop.
OPENADAPT_ENFORCEMENT=gatingrestores the old behaviour everywhere. The ledger still holds refuted
attempts, so a retry is never sent silently.
Docs:
packages/flow/docs/VERDICT_TIERS.md, the command map, aCAPABILITIES row and
llms-full.txt.Not in this pull request
blocksyet. Theirstopping is unchanged. Wiring them is a separate change.
refused at
begin_write. That refusal is right for an arbitrary SQLquery, so the fix belongs in the generator's null-safe template.
stops the write.
Tests
tests/test_verdict_tiers.py(SQLite, real reads) checks the following:logged, with names only.
another user's row, another column of the actor's row, a record read
through, a removed side-table row, a duplicate and a wrong value.
through an API.
enablerefused until gating isoffered.
learn entitiesderives, stages and applies only on matching, all-caughtresults.
The existing frame, learned-excuse, verifier, verify-run, recheck, ledger,
receipt, shadow and CLI-census suites pass, with
test_verifier_apiupdated for the new
WriteResultfield.Real-app replay on the false-stop harness is pending and will be reported on
this pull request.