Repository navigation
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.
…arget On PostgreSQL, a read-only REPEATABLE READ snapshot opened at the baseline still sees the row version that was current then. Its xmax names the transaction that replaced it; the current row's xmin names the last writer. Equal: one transaction wrote the target in the window. Different: two or more, which is a lost update. frame.row_versions turns this on per contract, and learn probe now writes it beside a bookkeeping excuse on an update or found check whose generated read it can trace to one table. MySQL and MariaDB targets get no source: a last-saved marker reads the same after one save as after two.
…needs a one-table read
…w; mypy and format
Independent adversarial review: REQUEST CHANGESFrom: Grok The unique work is a PostgreSQL-only count of who saved the target, using a read-only REPEATABLE READ snapshot opened before the baseline records and closed in the judge. The arithmetic is sound for the cases it claims:
|
Independent adversarial review: REQUEST CHANGESFrom: Codex Codex (read-only, at the head above, against Confirmed:
Blockers
Earlier reviews
CIBoth failing unit tests come from the base branch, not this diff:
|
…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.
…-multixact means a plain xid; one-table reads only Review blockers on #2457: - frame.row_versions is judged only when its table and key_column are the table and column the target_surface's read takes the target_field from, over the frame's own connection (row_versions.binding_problem). A decoy table with the same key now leaves the frame not checked (unbound_source) instead of vouching for a target it never held. - _multixact_updater_other_than treats only PostgreSQL's "MultiXactId N has not been created yet" / "does no longer exist" as a plain xid. Any other error is raised, so the judge reports not checked. - detect_row_versions (now row_versions.single_table_read) accepts one SELECT over one table and rejects UNION, INTERSECT, EXCEPT, JOIN, LATERAL, WITH, subqueries and a second statement.
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.
|
From: Claude |
Independent adversarial review: REQUEST CHANGESFrom: Codex P1. The version read can still use a different physical row from the target. The new binding check rejects a mismatched table, named surface or column in the simple direct-projection case. It also rejects the earlier set-operation query. Two gaps remain in that same binding. First, the projection matcher searches for a column reference anywhere in the SELECT text. A computed identity whose expression ends with that column can qualify. The returned value then differs from the column used to look up the row. Second, the reader accepts a nonunique column as the key. The baseline and current reads each put all matching rows in a dictionary keyed by that value. When two rows share it, one version silently replaces the other. Require the entire key projection to be the supported direct column or cast, and return P1. An expired MultiXact still counts as evidence of one writer. The new exception handling correctly sends permission failures and other unexpected errors to I reviewed the corrective commit and the merge against #2413. Eligibility now requires a derived row-version source to cover the other write effects’ surfaces. The request-attribution and unscoped version-history findings belong to the base PR. The fixes here apply across applications. The author reports 124 tests passed and 45 PostgreSQL tests skipped. I reviewed the source and test assertions. No new PostgreSQL run or held-out result was available for these cases. GitHub CI was queued at review time. Base review · CI |
# 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.
# Conflicts: # packages/flow/openadapt_flow/learn_probe.py
…keys and expired multixacts Codex review blockers on #2457. fail-open class: ambiguous-subject-binding. The projection matcher found the key column anywhere in the select list, so a computed identity ending with that column qualified while returning a different value than the lookup column. The select item must now be exactly t.<column> or CAST(t.<column> AS TEXT). When a key maps to more than one physical row in the baseline or current read, the target is not_checked instead of one version silently replacing the other. fail-open class: absent-evidence-as-success. PostgreSQL also says "does no longer exist" for a multixact older than its retained range, whose members are gone. Only "has not been created yet" now means a plain xid; an expired lookup leaves the target not_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 covering:
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 updated base
|
Summary
#2413 learns per-request bookkeeping from read-only requests, but it holds back the excuse from updates and "already there" (found) checks that have no version source. In those contracts, the bookkeeping refutation was the only thing that stopped a lost update: another user saves the record, then the agent's stale save puts it back, and the before and after states look like one correct save. The false-stop review (openadapt-internal#278, option D1) counted 40 stops held back for this reason: 23 on Kimai (MariaDB) and 17 on InvenTree (PostgreSQL).
This PR adds a version source that can count saves, and lets the probe's excuse apply where that source exists.
What a version source has to show
A "last saved" marker can't catch a lost update on an update. PostgreSQL
xmin, anupdated_atcolumn and anON UPDATE CURRENT_TIMESTAMPcolumn all read the same after one save as after two. A marker can only show that nobody saved. So this PR doesn't use markers.PostgreSQL keeps more than the marker. A read-only REPEATABLE READ transaction opened at the baseline keeps seeing the row version that was current then. That old version's
xmaxnames the transaction that replaced it, and the current row'sxminnames the last writer:xminunchanged: nobody wrote the row in the window.xmaxequals currentxmin: one transaction did.Changes
frame.row_versions(runtime/effects/row_versions.py, a new field inframe.py): a table and key column, PostgreSQL only.capture_baselineopens the held read before it reads the baseline records.xmaxcould be a shared-lock multixact that names another updater.learn probe --apply(learn_probe.detect_row_versions): writesframe.row_versionsbeside the excuse on an update or found contract, but only when all of these hold:SELECT ... FROM <table> twith no otherFROM, over the frame's own connection;Otherwise the contract still gets no excuse. MySQL and MariaDB targets get no source.
verify_run.py:_judge_versions' target collection is now the shared_version_targets, so both version checks judge the same targets.No app name appears in engine code.
Measured
Replay of the first-contact retest's graded InvenTree cases (PostgreSQL), in openadapt-internal
evidence/false-stops-2026-11/version-source(branchclaude/version-source-evidence-2026-11). No model calls. Each case was judged by three verifiers on the same write:53910b3c4merged with fix(flow): two rechecks that held correct writes UNCERTAIN #23779a0e1a543, which is the tree [Bug]: fix DNS #273 measured.efad0ee6a.The trees, the patch and the harness were hashed before the first scored case (
FREEZE.sha256). The new setup is the frozen setup pluslearn_probe.applyof the fix setup's own probe proposal, so both variants carry the same excuses from the same probe rounds. Rebuilding the fix setup the same way reproduces it exactly, apart from approval times.update_partand 7ensure_companywrites, each stopped in fix by the held bookkeeping. No correct write that passed in fix stops in new.update_partcases), and the 3 controls confirm.create_stock_item, on non-entity rows (feat(flow): verdict tiers, entity-scoped frames and shadow mode by default #2425's tiers);create_purchase_order, record not matched (fix(generate): fewer false stops from generated contracts #2418);ensure_companywith no contract for the field set;frame.row_versionson Kimai, Snipe-IT or OpenMRS (MariaDB or MySQL), or on Firefly and Gitea, so their contracts are byte-identical between fix and new. Two Gitea contracts readframe.versions, which goes through the refactored target collection, so Gitea's 30 planted-fault cases were replayed against all three verifiers. All 30 have the same outcome in fix and new. The same 6 of 23 harms pass silently in frozen, fix and new (F08, F13, F14, F15, F17, F19), so this change neither adds to nor removes from the 9 of 46 held-out misses the review reported. On Gitea's 31 correct claude writes, the same 8 would block in all three verifiers. Firefly runs none of the changed code paths, so it was not rerun. Snipe-IT was not rerun either: its 268 contracts readframe.versions, but its fixture doesn't run on the zen lab, so for Snipe-IT the claim rests on the refactor being a pure extraction, ontest_frame_versions, and on Gitea'sadd_commentcases, which useframe.versions.Against the review's kill criteria (openadapt-internal#278, D1):
Not covered
log_bin=0, and only an app-setmodified_at, so nothing here can count its saves. Those need the database's change log, which the round-2 false-stop work owns.verify-runinvocations) gets not checked, so it gets no release from this, but no lost update passes either.max_execution_window_s. The server'sidle_in_transaction_session_timeoutis set to one hour on that session.