Repository navigation
feat(flow): learn per-request bookkeeping from read-only requests - #2413
Conversation
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.
Independent adversarial review: REQUEST CHANGESFrom: Codex P1. The probe can learn an unrelated edit to the acting user's row. The before/after window records the row owner and the changed columns. Another session can change an ordinary field on that same row during one probe round. One observation qualifies for automatic application, and the verifier will then excuse future changes with that column set. The existing concurrency test changes a different user's row. Keep same-owner changes with uncertain provenance pending approval. Auto-apply only where the evidence ties the change to the read request. A synthetic same-owner concurrent edit should stay a stop while ordinary request bookkeeping still qualifies. Probe and proposal · Runtime matching P1. A mixed contract can receive an excuse while an existing target has no version coverage. The eligibility test counts only I reviewed the current source, test assertions and recorded CI. The Flow lint job reports missing annotations for Generality and evidence
|
Independent adversarial review: REQUEST CHANGESFrom: Gemini Gemini (gemini-3.1-pro-preview) reviewed the diff, the PR body,
|
…eside an update the versions don't cover Review blockers on #2413: - A move must show in every read-only round (at least two), so a one-off edit to the acting user's own row during one round is not excused. - _sees_its_own_harm judged only record_written effects. Now every effect counts: create-only means every effect is a count_new_only record_written (or a zero-count guard); otherwise frame.versions must cover each other effect on its target_surface. - Annotate the kept/held lists (mypy). - learn probe takes --base-url for read-only HTTP requests: record why in BACKEND_PARITY.md's URL flags table. - Rename learn_probe.add_parser to register_parser so the parser constructor inventory doesn't read the call as an argparse constructor.
|
From: Claude |
Independent adversarial review: REQUEST CHANGESFrom: Codex P1. A repeated change to the actor’s row still becomes an automatic excuse without evidence of who made it. The learner now requires the same column set in each of at least two distinct rounds. That fixes the one-round case. Each round still records a before/after difference and the row owner. A background writer updating the actor’s row throughout the rounds produces the same evidence as request bookkeeping. The verifier will then excuse future changes to those columns on that actor’s row. Keep candidates with only this timing evidence pending human approval. Automatic application needs an existing source that attributes the change to the request. Probe evidence · Proposal filter · Runtime match P1. An unscoped version read can still miss a write target on a second surface. The new guard correctly refuses a mixed create/update with no versions and an update outside an explicitly named version surface. When I checked the type annotations, the backend-parity entry and both ends of the parser registration rename. Those changes address the earlier CI findings in source. The author reports 173 targeted tests passing. GitHub CI was still pending at review time. This was a source review of the two updated commits. The changes are application-independent. I have no new held-out runtime result for the two remaining cases. GitHub CI |
learn_probe._sees_its_own_harm now takes both: every effect must create, or frame.versions / a bound frame.row_versions must cover every other effect's surface. A derived row_versions is written only when the resulting contract passes that check. Docs describe the binding and the one-table read.
# Conflicts: # CAPABILITIES.md # llms-full.txt
… for unscoped versions Codex review blockers on #2413. fail-open class: correlation-as-attribution. A change to the acting user's row in every read-only round was taken as the request's bookkeeping, but a background writer produces the same evidence. Each round now has a control window of the same length that sends nothing. A move that shows there, or any move when control windows are missing, goes under needs_approval instead of becoming an automatic excuse. fail-open class: ambiguous-subject-binding. With frame.versions and no target_surface, a contract whose other effects span several surfaces was eligible, though the version judge tells targets apart by local id alone. Such a contract now gets no automatic excuse.
Independent adversarial review: REQUEST CHANGESFrom: Gemini Gemini cross-vendor review of the delta that answers Codex's two blockers (control windows; unscoped versions over several surfaces), and of the full PR diff vs main. Summary of Gemini's output:
Checked:
|
…und move Gemini review blocker on #2413 (fail-open class: absent-evidence-as-success). A control window whose frame was not read listed no moves, so a background writer during it could still become an automatic excuse. Every control window must have read the database (frame held or refuted); otherwise the probe's excuses wait under needs_approval.
Independent adversarial review: APPROVEFrom: Gemini Gemini cross-vendor review of the two delta commits since Codex's review at 9397a64:
The review also covers the full PR diff vs main. Summary of Gemini's output; it reported no findings.
|
|
From: Claude |
# Conflicts: # packages/flow/docs/BACKEND_PARITY.md
|
From: Claude |
Independent adversarial review: APPROVEFrom: Gemini Verified clean merge with
|
|
From: Claude |
Independent adversarial review: APPROVEFrom: Gemini Delta over
|
…urces - new_artifact_key moves to sealed_set (at_rest must not import upward). - A type ignore for the unfinished-run resume key, as on the creation path. - The checkpoint lifecycle test checks the refusal when the key is used. - CAPABILITIES.md rows now come from capabilities/: the two at-rest rows move into their sources, and the learn-probe row from #2413 gets one.
Summary
On apps OpenAdapt had never seen, the largest cause of false stops was per-request bookkeeping on the acting user's own rows. Examples are the user's last-login time and the API token's last-used time. The whole-database frame saw those rows move on every write and refuted every correct write.
learn(#1679) can excuse such rows, but only from writes a shadow can check, and then only with a person's approval. On apps whose requests name their target in the URL, it learned nothing (second retest: 0 excuses on every app).openadapt-flow learn probelearns the same moves without a write and without a person:GETandHEADrequests as the agent, and reads again, three times. No write is sent.learn.propose). It admits only a changed row of the acting user (actor_row), with the exact columns. It never admits a column named by a probe query string, a parameter or the contract. A changed move seen in one read-only round is enough, because no round carried a task.frame.learnedwithsource: read_only_probe, the new field this PR adds. Receipts name the source.It does not admit:
needs_approvalforlearn approve.frame.learned. They are refused, so a person reconciles them.No app name appears in engine code. The per-app knowledge is the probe's output, written as contract data.
Measured (replay of the first-contact retest's graded cases)
Measured in openadapt-internal
evidence/false-stops-2026-11. Each case was judged by the frozen verifier, bymainand by this branch, and scored with the retest's ownscore.py. Agent cases were replayed from their recorded transcripts, with no model calls.The cases were judged by the frozen verifier,
mainand this branch (the merged head of this PR and #2377, plus the lost-update rule) on the same writes. The apps are anonymized here; the private report names them.The
maincolumn is worse than frozen on C, E and F. That comes from the recheck defect #2377 fixes: every recheck of a write begun without a ledger is held UNCERTAIN. Without the bookkeeping refutation, one out-of-scope late duplicate on A now passes. The old setup allow-lists its own record table, so the recheck can't see the duplicate. This is a pre-existing gap that the bookkeeping refutation used to hide; it is reported, not fixed here.Tests
tests/test_learn_probe.pyruns on SQLite, and on MariaDB and PostgreSQL when given. It covers:frame.learned;Locally,
test_learn_probe,test_learned_excuses,test_verifier_recheck,test_verifier_api,test_verifier_snapshot_api,test_frame_owner_attribution,test_continuous_learningandtest_verifier_finalitygave 327 passed, 68 skipped. Ruff and mypy pass on the new module.A companion PR, #2377, fixes two recheck false stops found by the same replay.