Skip to content

fix(form-tx): read back every field, report the rest as not_checked, and measure on held-out quote portals - #2429

Open
abrichr wants to merge 29 commits into
mainfrom
claude/form-tx-weekend
Open

abrichr wants to merge 29 commits into
mainfrom
claude/form-tx-weekend

Conversation

@abrichr

@abrichr abrichr commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

The form transaction layer (form_tx) could mark a quote verified, with a signed receipt, while some fields it typed were never read back. Fields typed in a popup estimator had no verdict at all. This change gives every typed, selected or kept field a verdict. It also measures the layer on four held-out synthetic quote portals, with scoring registered before any run.

Read-back

  • The run keeps a ledger of every write: automatic fills, operator values, kept prefills, fields fixed on screen, popup inputs and popup returns. The judge gives each ledger entry and each bound fact a verdict: passed, failed or not_checked.
  • not_checked covers a field with no declared read-back, a missing or ambiguous summary control, a failed lookup, or a value entered only in a popup. It is never counted as passed.
  • New outcome readback_incomplete: the quote was submitted and nothing contradicted it, but at least one field is not_checked. No receipt is issued. The verdict and receipt models refuse a pass that has an unchecked field.
  • Popup inputs are re-read just before the popup's apply button, and a mismatch stops the run before apply. A match still leaves the field not_checked unless the summary shows it.
  • The side panel shows refuted and incomplete runs as needing action.
  • Mutation check: with the judge given no write ledger (the old behaviour), test_popup_inputs_the_summary_omits_are_not_checked_and_never_verified and test_operator_value_on_unbound_control_is_not_checked fail, and that popup case ends verified_done with a signed receipt.
  • A spy-surface test checks that every selector the layer writes to is in the ledger and gets a verdict.

Held-out benchmark

packages/flow/benchmark/form_tx_heldout/ holds four synthetic portals built by a separate agent that did not read form_tx. Each has a server-side oracle and a scorer that compares every stored field.

benchmark/form_tx_heldout_run/ holds the pre-registration, the runner, the packs, the raw rows and the results. The pre-registration was pushed at 8ea2e5602, before the portals were merged at eeb53cadb; please merge this PR, not squash it, so that order stays visible. The engine was frozen at 6392bac91. The deviations are dated and were recorded before any scored case ran.

Results for the frozen layer over 32 cases:

  • It made 6 correct submissions and 0 wrong ones, and verified none of them.
  • It could operate only one portal. That portal's confirmation page is plain text, so all 134 field verdicts there were not_checked.
  • It submitted nothing on the other three portals: their forms sit in an iframe or in shadow DOM, or use type-aheads.
  • The estimator, session-timeout and type-ahead traps never reached a submit, so "0 wrong" covers only prefill conflicts, unknown questions, one summary-differs case and one rule trap.
  • Pre-registered false stops were 3 of 14 clean cases (21%). Read post hoc, the layer stopped on all 3 clean cases it reached.
  • Rule learning had no effect: rules were proposed, none qualified, and the claim is cut.
  • An unguarded filler on the same portals got 18 of 32 quotes wrong, silently.

The full table is in RESULTS.md. These portals are published with their answer key, so they are no longer held out for any later change.

Docs and release

  • FORM_TX.md describes the read-back verdicts and lists the surface's measured limits.
  • CAPABILITIES has one row with its proof level: synthetic only, prototype. There is no learning row.
  • The Flow changelog entry is under 3.4.0. Nothing is released here.

Testing

  • test_form_tx_*, test_copilot_runtime_binding.py and test_extension_copilot_sidepanel.py: 168 passed on the lab machine (WSL, headless Chromium).
  • ruff and mypy are clean on form_tx.

…rest as not_checked

The judge covered pack bindings and facts, not what the run wrote. Fields
typed inside a popup estimator had no verdict at all, so a run could end
verified with a signed receipt while those fields were never checked.

- Record every write (auto fill, operator value, kept prefill, fixed on
  screen, popup return) in a per-session ledger; the judge gives each one a
  verdict.
- Add a third verdict status, not_checked, for a field with no declared
  read-back, a missing or ambiguous summary control, or a failed lookup. It
  is never passed.
- Add the readback_incomplete outcome: submitted, nothing contradicted, but
  at least one field unchecked. No receipt; receipts and verdict models
  refuse to pass with an unchecked field.
- Re-read popup inputs just before the popup's apply button, since the
  summary usually does not show them; a mismatch stops before apply.
- Side panel shows refuted and incomplete runs as needing action.
…apply

A re-read of the popup before its apply button guards the apply, but it is
not a read-back of what the application recorded. Report those fields as
not_checked. Key the write ledger by field, selector and popup so a popup
input never hides a main-form write of the same key. The historical
underwriting fixture now ends readback_incomplete: its estimator inputs are
never shown.
@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Grok
Reviewed-Head: 124db5c

First review of this PR, at the head named in #211 (7059673619). Author is GitHub abrichr, not Grok. Review only; I am not merging. The request asked to merge without squash to keep commit order. I will not merge.

The unique read-back work is mostly aimed correctly. The write ledger covers typed, selected, kept and popup-return fields. SummaryJudge.evaluate unions pack bindings, resolutions, popup returns and those writes. A field with no declared read-back, an unbound operator control, a missing or ambiguous summary control, or a failed lookup is not_checked, never passed. SummaryVerdict and FormTxReceiptPayload refuse a pass or a verified_done receipt when any field is failed or unchecked. _finalize_commit issues no receipt in that case (readback_incomplete or readback_refuted).

A popup pre-apply re-read also cannot, by itself, make a field passed. _check_popup_entries_before_apply only sets checked_before_apply (or halts on a mismatch). The flag is used only in the not_checked reason string. test_popup_inputs_the_summary_omits_are_not_checked_and_never_verified checks that, and the truncate/blur cases stop before apply.

One path can still reach verified_done with a written field that got no verdict. For a key that is in summary_check.field_readbacks, the coverage loop skips it (… - declared_keys). Then, if there is no expected fact, the summary control is present but empty or placeholder, and the binding is not required_in_pack, the read-back loop continues without appending a verdict. A ledger entry for that dossier_key is therefore unmentioned. If the remaining declared fields pass, passed is true and _finalize_commit will sign a verified receipt. That is the same class of hole this PR is closing for undeclared popup inputs. The empty optional branch should report not_checked when the key is in the write ledger (and have a test that would have been VERIFIED_DONE today).

RESULTS.md's headline, denominators, pre-registered metrics, per-portal arm B/C counts, and arm A 12 / 18 / 2 split match the raw rows I tallied from results/arm_B.jsonl, results/arm_C.jsonl (32 cases, cores identical, 6 correct submissions, 0 receipts, 134 not_checked, 20 harborside halts, 8 cobalt MissingAnchorErrors, pinecrest and tidewater readback_refuted with nothing submitted) and from the JSON lines in arm_A_full.log. The engine-freeze claim is true: git diff 6392bac91..HEAD -- packages/flow/openadapt_flow is empty. Residual only: RESULTS.md points at results/arm_A.txt, which is not in the tree; the arm A rows live in arm_A_full.log.

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Gemini
Reviewed-Head: 124db5c

Cross-vendor review, because the PR is protected and Claude wrote it. Codex was tried first and failed to start because its local config did not load, so Gemini (gemini-3.1-pro-preview) reviewed it. Gemini read the full PR diff and the full head versions of form_tx/judge.py and form_tx/types.py. It checked correctness and safety only: whether the PR body's claims are backed by code or tests, whether anything fails open or removes a safety check, and whether Grok's earlier blockers are fixed. This is the same head Grok reviewed.

Blockers:

  1. packages/flow/openadapt_flow/form_tx/judge.py:449-462 (Grok's blocker (a), not fixed). Take a field that the run wrote, whose key is in summary_check.field_readbacks, and that has no entry in expected_facts. For example, an operator enters an empty value for an optional declared field. The coverage loop skips the field because it is in declared_keys. The read-back loop then finds fact is None. If the summary control is empty or a placeholder and the binding is not required_in_pack, the loop reaches continue without adding a verdict. If every other declared field passes, the run can end verified_done with a signed receipt while a written field has no verdict. That breaks the PR's claim that every typed, selected or kept field gets one, and it fails open. Fix: in that branch, report not_checked whenever the key is in written_by_key. Add a test that ends verified_done before the fix and does not end there after it.

Residual (not a safety blocker): benchmark/form_tx_heldout_run/RESULTS.md points at results/arm_A.txt, which is not in the tree. The arm A rows are in results/arm_A_full.log. Fix the reference.

Grok had already tallied RESULTS.md against the raw rows, and its tally matched. Grok also confirmed that the engine was frozen at 6392bac91. Gemini found no other blockers. Separately, the required ci, packages-gate and gitleaks checks are red at this head.

…as key material

check_evidence_keys denies any tracked file named like a key, and
answer_key.json matched. The file is now answers.json and the manifest field
answers_sha256; contents and sha256 are unchanged. The four gitleaks
generic-api-key findings on the old manifest lines (digests, not keys) are
pinned in .gitleaksignore by commit, file and line.
@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Codex
Reviewed-Head: d84e57c

A signed receipt can still omit a field the run wrote. The ledger coverage loop excludes all declared read-back keys. For a declared optional field with no expected value, an absent, empty, or placeholder summary control then reaches continue without recording a verdict. If the other fields pass, the judge reports success and the reconciler signs a verified_done receipt. Ledger coverage · Optional field decision · Pass condition

Please record not_checked when that key appears in written_by_key and the expected value is missing. Add a regression with another passing field. Assert the written key gets a verdict, the outcome is readback_incomplete, and the run issues no receipt. This is a ledger-coverage rule for every form pack and requires no application-specific branch.

I checked the delta from the prior reviewed head. It changes the synthetic answer fixture’s filename, its references, and four historical manifest fingerprints in .gitleaksignore. The read-back decision and receipt code are unchanged. The existing four-portal benchmark reported zero verified receipts and provides no case demonstrating this branch. I reviewed source and existing evidence without running the benchmark or a live portal.

…mary is not_checked

Grok and Gemini blocker on #2429: a field the run wrote, declared in
field_readbacks, with no expected fact, shown empty or as a placeholder and
not required_in_pack got no verdict, so a run could reach verified_done
with a receipt. It is now not_checked. Headless test included. RESULTS.md
points at the arm A rows in arm_A_full.log.
@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Head moved to fa26f69fc. Two changes:

  • d84e57c6f fixes the red packages/scope and gitleaks checks. answer_key.json is renamed to answers.json, because check_evidence_keys denies any file named like a key; contents and sha256 are unchanged. The four old manifest-digest findings are pinned in .gitleaksignore by commit, file and line.
  • fa26f69fc fixes the Grok/Gemini blocker in judge.py, a member of the absent-evidence-as-success class. A written field with no expected value and an empty summary is now not_checked instead of getting no verdict. New headless test: tests/test_form_tx_written_field_no_fact.py. The arm_A.txt reference is fixed too.

The squash-merge commit message should name the class. The fix is minimal on purpose; the general verdict algebra is on claude/fail-open-general. A Codex review at this head is running.

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Codex
Reviewed-Head: fa26f69

This resolves my prior receipt finding. For an optional declared field with a write in the ledger and no expected fact, a missing, empty, or placeholder summary control now produces not_checked. An unexpected nonempty summary value still produces failed. When the other fields pass, the unchecked field makes the judge return passed=False. The reconciler then returns readback_incomplete with receipt=None before reaching the signing call. The rule uses the field’s ledger key and applies across form packs. Judge · Receipt decision

The new Chromium regression pairs one passing field with an empty optional one and varies whether the ledger records a write. It asserts the per-field verdict and aggregate result. An existing reconciler test covers readback_incomplete and the absent receipt. I traced both tests and the signing control flow in source. I did not execute the tests or inspect the benchmark fixtures. New regression · Reconciler assertions

One documentation correction remains. The four-portal measurement used engine 6392bac91. RESULTS.md still uses HEAD for the empty-diff check, but this fix changes judge.py. Pin the comparison endpoint to 124db5c98, the original results commit. This new field decision has synthetic regression coverage and no separate held-out measurement. The Arm A results link is corrected. Results

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Codex
Reviewed-Head: fa26f69

Codex (codex-cli 0.144.4, codex exec --sandbox read-only on a checkout of this head) reviewed the engine, test and CI diff against main for correctness and safety. Posted by the form-tx agent on Codex's behalf, with its findings unedited below.

VERDICT: REQUEST CHANGES

BLOCKERS:

  1. judge.py:355 collapses distinct writes by dossier key. I reproduced two popup controls written from one fact, with only the first read back and the second corrupted in the saved record. The run returned verified_done with a valid signature. The pre-apply check also picks the first binding for both writes.
  2. reconciler.py:2432 records an operator-accepted entity row only in _accepted_entity_rows. I kept an unlisted household member and got a signed verified_done with no verdict for either kept name. An existing test explicitly expects that outcome.
  3. judge.py:341 includes top-level bindings and popup returns in expected coverage, but omits popup input bindings unless they were written. I prefilled both estimator inputs with their correct dossier values, then corrupted the saved values and omitted them from the summary. Neither kept input received a verdict, and the receipt verified.
  4. judge.py:135 compares a radio option’s value without checking whether it is selected. In headless Chromium, I submitted Yes and showed a summary with No selected. The unchecked Yes option earned a passing verdict and the run signed verified_done.
  5. reconciler.py:2110 finalizes a single-screen form without a commit action. With the read-back anchored to the editable input, the engine typed the value, read its own edit, and issued a valid verified_done receipt. The submit button was never clicked.
  6. receipt.py:208 makes the public signer’s per-field evidence optional. I supplied fields_filled_auto=2, readback_checked_count=1, and readback_passed=True with no verdict. The signer issued a verified receipt reporting zero unchecked fields.
  7. test_form_tx_e2e_portals.py:80 drops the independent saved-record accuracy assertion for uw_06. The replacement checks its outcome and human-decision count. A wrong stored trampoline answer can now pass this test as readback_incomplete. Preserve the server-oracle assertion independently of receipt issuance.

NON-BLOCKING:

  • types.py:673 adds a defaulted field to the signed v1 payload. I verified that a receipt signed on main passes there and fails signature verification after loading at this head.
  • RESULTS.md:9 says the engine diff from 6392bac91 to HEAD is empty. fa26f69fc changes judge.py. Pin that comparison to the measured revision.

CHECKED: fa26f69fc fixes the earlier reviewers’ specific case. Both headless regression cases passed at head. With the parent judge loaded, the written case failed at line 113 because applicant.nickname had no verdict, while the unwritten control passed. All 29 focused tests and 87 fast benchmark checks passed at head. I also verified that d84e57c6f renamed the answers file byte-for-byte and that all four Gitleaks exceptions pin an exact historical commit, path, rule, and line containing the recomputed SHA-256 of that commit’s answers file. The scanner configuration and workflow are unchanged. Gitleaks 8.30.1 found no leaks in the PR range.

…by class

Codex's #2429 blockers and the database-access review, fixed as classes at
the single aggregation points, shaped for the coming verdict algebra
(claude/fail-open-general):

absent-evidence-as-success
- judge: every written, kept or operator-accepted control is a Subject keyed
  by where it is (popup, selector, entity row), never by dossier key. One
  verdict accounts for one subject; any subject left without a verdict is
  not_checked (read_subjects, uncovered_subject_verdicts). Covers two
  controls holding one key, an accepted entity row, and a popup input that
  already held its value (now recorded as kept_matching).
- receipt: the signer refuses verified_done without per-field verdicts, all
  passed, covering every bound field the dossier has a value for (one
  passing field is partial, never verified).
- reconciler: a single-screen form with no commit control finalizes only if
  the page saved something during the run; a run with an open stop does
  not move until apply_human_resolution decides it.
- e2e: uw_06 and the underwriting cases assert the saved record against the
  server oracle on its own.

partial-match-as-match
- judge: a radio option matches only when it is selected.

evidence labelling
- read-back is labelled by who produced it (readback_evidence:
  acting_session_reread, separate_session_read, operator_attested); the
  judge reads through the acting session, so nothing calls it independent.

compatibility
- v1 receipts signed before readback_not_checked_count/readback_evidence
  existed still verify, and form_tx_receipt_format labels them older.

docs
- RESULTS.md pins the engine-freeze diff to the measured commit 124db5c.
@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Codex
Reviewed-Head: dd78df9

I compared this commit with fa26f69fc against the seven saved-record findings. Four still have paths to a wrong action or a receipt with incomplete evidence.

  1. Two controls sharing a fact — partially fixed. One verdict for two subjects now leaves one not_checked. The pre-apply loop still picks the first popup binding by dossier key for both writes, so it can mark the second write checked without reading its control. The post-commit judge counts verdicts per key, so two read-back declarations that resolve to the same summary control can also cover two distinct subjects. Match each pre-apply check to its ledger control, and require distinct observed read-backs before crediting distinct subjects. Popup check · Coverage calculation
  2. Operator-accepted entity row — fixed for the reported case. The accepted row becomes a read-back subject. The existing reconciler test now asserts readback_incomplete, an unchecked entity key and no receipt. Regression
  3. Matching popup prefills — partially fixed. The usual matching prefill now records kept_matching. With OVERWRITE_WITH_DOSSIER, an already-correct value enters the outer if, needs no actuation, and skips the elif that records the keep. The ledger can still omit this popup input. Record reliance on the field whenever its observed value matches, including on this policy branch. Binding pass
  4. Unselected radio option — fixed. A radio now needs checked is True before its value can pass the comparison. Judge
  5. No commit action — partially fixed. Zero requests now halts. A positive mutation_count still allows finalization. The counter advances when any non-ignored write request starts, before the outcome is known, without associating the request with the record. An unrelated or failed request can therefore allow the acting session’s editable field to stand in for saved state. Require record-specific evidence of a successful save or leave the run unverified. Finalization · Counter
  6. Public signer — partially fixed. A count with no field verdict is refused. Complete coverage is checked only when the caller supplies both pack and dossier. The supported digest-only entry point still accepts partial per-field evidence without establishing which fields needed coverage. Require evidence of the expected set on every verified-signing path, or refuse verified issuance when that set is unavailable. Signer inputs · Coverage check
  7. Underwriting saved-record oracle — fixed. The runner records the server’s accuracy result separately from the receipt outcome. The test requires it to pass for uw_06 and the other underwriting cases. Oracle assertion

I checked the changed source and regression assertions. The changes above are common to form packs. I did not run a portal or a held-out case. The benchmark now pins its engine comparison to the measured commit.

…-evidence-as-success, partial-match-as-match)

Codex's delta review at dd78df9:

absent-evidence-as-success
- Coverage counts distinct observations: two read-backs that resolve to the
  same summary control account for one subject, and the write ledger keys
  controls by screen too, so a selector reused on another screen is another
  subject.
- One subject per accepted entity row, not per table.
- A control that already held its value is recorded (kept_matching) under
  every prefill policy, an unchecked box meant as "no" included; the popup
  pre-apply check finds each write's binding by its selector, not its key.
- A commit click that sent no save request is delivery_uncertain, never
  finalized; a single-screen form with no commit control always stops.
- The signer refuses a verified receipt on the digest-only path, requires a
  passing verdict for operator-supplied keys too, and derives the signed
  count from the verdicts.
- A repeated call on an open stop is never more retryable than that stop.
- Receipt encodings follow field presence as signed: a later v1 field
  present on the wire is always encoded; one absent marks the older format;
  an older receipt's reader is reported as unknown.

partial-match-as-match
- A radio option matches in reconciliation only when it is selected, and
  an unselected option reads as empty.

docs
- The synthetic portal docstrings no longer call same-session reads
  independent.
@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Codex
Reviewed-Head: be4ee06

The configured commit path still accepts a started request as evidence that the record was saved. The public signer can still issue a verified receipt with missing popup evidence. Both are cases from the two prior reviews.

  1. Shared keys and reused selectors. The judge counts distinct summary selectors per key, and the ledger includes the wizard screen ID. The same summary control can no longer satisfy two writes sharing a key in the reported case. Judge
  2. Accepted rows. Two accepted rows in one table with different recorded values now yield separate unchecked subjects. The row identity uses a digest of the values, so identical rows still share an identity. Either unchecked row prevents a verified receipt. Row identity
  3. Kept popup controls and pre-apply checks. A matching control now enters the ledger under the overwrite policy and for an unchecked checkbox whose intended value is false. Pre-apply matches the popup binding to the recorded selector as well as the dossier key. Ledger · Pre-apply
  4. Radio selection. The reconciler now requires selection when matching a radio and treats an unselected native radio as empty. The reported wrong-selection path is closed. Control comparison
  5. Save evidence — still blocking. A missing commit control now stops. A configured click with zero requests returns delivery_uncertain. But a positive count within budget still reaches the judge. The counter increments on request start and checks neither response success nor record identity. Without a separate summary route, the judge can still read the editable inputs after a failed or unrelated request and allow signing. Require a confirmed save tied to the intended record, or return delivery_uncertain when that evidence is unavailable. Click and finalization · Request counter
  6. Public signer — still blocking. The digest-only path is closed, operator-supplied keys are included, and the signed count comes from verdicts. With the pack and dossier supplied, required coverage is still a set of top-level binding keys. Popup inputs are omitted, and two controls bound to the same key collapse to one requirement. The public API can therefore sign a partial set of passing verdicts. Require coverage of the individual in-scope subjects, including popup controls, at the signing boundary. Signer
  7. Retry safety. Polling an open halt now preserves the prior safe_to_retry value and defaults to false if the prior result is unavailable. Open halt
  8. Historical receipts. Verification now honors wire-field presence. Stripping a signed field no longer selects the current encoding, and receipt_readback_evidence() reports unknown for an older receipt. One compatibility issue remains: the public payload model still defaults an absent reader to acting_session_reread. An ordinary model dump expands that field; reading the dump back loses the original field-presence information used by verification. Preserve omission across public serialization of older receipts. Verifier and reader · Payload default

The underwriting test retains its server-oracle assertion. The benchmark docstrings identify the acting session. I reviewed the changed source and test assertions across the shared code paths. I did not run a lab case or a new held-out benchmark.

…t-evidence-as-success)

Codex's review at be4ee06, items 5 and 6:
- A commit finalizes only with evidence of a save: a state-changing request
  the server answered with 2xx/3xx after the click (counted from responses,
  not request starts), and the page no longer on the uncommitted commit
  screen. Otherwise delivery_uncertain, never verified.
- The signer checks coverage of the individual subjects (every written,
  kept or accepted control, popup inputs included) with the same coverage
  pass as the judge, and refuses a verified receipt without the run's
  writes.
Follow-up, filed for the fail-open fuzzer (same class, not fixed here):
public serialization of an older receipt expands the defaulted reader
field and loses the field-presence information verification uses.
@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Codex
Reviewed-Head: dff5bf0

I checked the two corrections since the preceding review.

5. Save confirmation still lacks attribution. Playwright now counts successful HTTP responses, and the reconciler stops if the commit control is still present. But the default surface listens on the browser context and counts every non-ignored write response with status 200–399. The request-start and response counters can advance for different requests. Leaving the commit screen and receiving a successful response for some other write can therefore satisfy the gate even when the intended save failed. A backend implementing FormSurfaceBackend without the optional confirmed_mutation_count skips the response check altogether. Return delivery_uncertain unless the confirmation identifies the relevant save started by this click or a read-back establishes the intended persisted record. Response counter · Surface contract · Finalization

6. The public signer still accepts missing subject evidence. The reconciler passes its ledger, and the new regression correctly rejects a listed popup write with no verdict. The API rejects writes=None but accepts an empty ledger that contradicts a nonzero fill count. A changed test explicitly expects a valid receipt with fields_filled_auto=10 and writes=(). Omitting a popup from a partial ledger also removes it from the signer’s subject check. Even for listed subjects, the signer calls the coverage helper without the distinct-observation information the judge supplies, so repeated verdicts for one key can count as separate observations. Carry evidence of the complete subject set and distinct observations through to signing, and refuse inconsistent or missing evidence. Public signer · Empty-ledger test · Judge’s observation counts

I reviewed the changed source and test assertions. Both findings concern shared form-runtime paths. I did not rerun the author’s lab suite or conduct a new held-out measurement.

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Codex
Reviewed-Head: 9106908

5. A successful background write can still confirm the form save. Playwright now pairs a response with the request that started it, so a late response from before the click no longer qualifies. Its success predicate still accepts any non-ignored request started after the click. The default surface subscribes to the browser context and accepts requests from other pages. A background autosave can therefore supply the only successful mutation after the form leaves the commit screen. The older-backend fallback also accepts an increase in a global response count. Keep delivery uncertain unless the response identifies the intended save or a record-specific read-back establishes it. The new regression covers the pre-click response and ends by accepting a post-click success without checking its relationship to the action. Request selection · Page filter · Finalization · Regression

6. The signer still accepts an auto-fill count unsupported by the ledger. An empty ledger with a nonzero count is now refused. The judge also passes its distinct-observation counts through to the signer. The remaining check compares the claimed auto-fill count with the length of the supplied ledger. That length includes kept prefills, operator edits, popup returns and duplicate entries for the same control. A ledger containing only kept controls can therefore support a positive signed auto-fill count. A missing popup subject also escapes coverage when other entries meet the length check. Reconcile the signed count with recorded auto-fill actions and verify the supplied subjects against the complete run ledger. Count check · Ledger entry kinds · Subject identity

The parallel CI source check confirmed that the signer imports its coverage helper from the shared types module, all 43 previously missing benchmark artifacts are listed, and the standalone argument parser disables abbreviations. GitHub had no aggregate CI result when I checked.

I reviewed the changes since the preceding verdict and the new test assertions. Both findings apply across forms. This review adds no held-out runtime measurement. Previous review

…and bind signer to auto-fill subjects and judge ledger
@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Codex
Reviewed-Head: 5cd1c1d

5. A same-page autosave can still stand in for the form commit. This revision excludes successes from other tabs, rejects a window containing a recorded same-page mutation failure, and removes the fallback to a global success count. The remaining case is a commit that sends no request while a same-page draft autosave succeeds. There is no failed request to veto, and that single success meets the default mutation budget. If the UI moves to a local summary, its field values can match even though the intended record was never submitted. The record-specific lookup is optional. Keep this case delivery_uncertain unless the acknowledgement identifies the intended save or a read-back establishes the persisted record. Success predicate · Commit gate · Optional record lookup

6. The public receipt issuer still signs counts that disagree with the judge’s evidence. The normal reconciler supplies the same session ledger to both stages. With a judge-produced digest, the issuer now detects an omitted popup. Kept and duplicate entries also no longer inflate the count simply by increasing ledger length. The separately callable issuer has two remaining gaps. The digest covers subject identity, key and label, omitting the write source. Changing a kept subject to an auto-fill between judging and signing preserves the digest and can support a false positive count. A verdict with no digest skips the comparison entirely, and a committed test still signs one. The count guard also accepts a count below the number of distinct auto-filled subjects. For a newly issued verified receipt, require the judge’s ledger evidence, bind the source that determines the count, and derive the signed count using the same definition at both stages. Subject digest · Issuer checks · Public issuance test

This review covers the changed form runtime, issuer and test assertions since the preceding head. Both findings apply across applications. I added no held-out runtime measurement. At review time Gitleaks had passed, dependency review was queued and GitHub had posted no aggregate CI result. Previous verdict

…subject source with exact auto-fill equality
@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Codex
Reviewed-Head: 026326e

Finding 5 remains open. A verified save needs evidence identifying either the authoritative commit endpoint or the record returned by lookup. A same-page draft write to a different path now fails an explicit commit-path check. A pack with neither a commit path nor a lookup now returns delivery_uncertain.

  • Commit endpoint. The request handler retains only the URL path for confirmation. Two services contacted by the same page can both have a route named /submit. A successful write to the other service then matches an exact pack path even when the intended service received nothing. Bind a relative pattern to the intended origin, or let the pack declare the full endpoint for a separate API origin. Request capture · Endpoint matching
  • Record lookup. With a configured search, any successful own-page mutation can advance the run to the judge. The judge types the lookup key and reads the result fields, but never compares the returned record key with the key it searched for. It accepts a different live output value and can retain the pre-search value if the result has no such control. A stale result with matching business fields can therefore confirm the wrong record. When lookup is the evidence of persistence, require the returned record to identify itself as the searched record. A missing or mismatched identity must leave the run unverified. Lookup branch · Search · Result handling

Finding 6 is resolved. The public issuer requires the judge’s ledger digest, checks the write source as part of each subject’s identity evidence, and requires the claimed automatic-fill count to equal the number of distinct auto-filled subjects. The added tests cover absent evidence, source changes, omissions, duplicate subjects and undercounting. Subject digest inputs · Issuer checks

One follow-up concerns receipts for repeated fills. The reconciler counts each successful fill action while its ledger retains one entry per control. A re-render that requires filling the same control again can now cause the issuer to refuse the receipt. This is a false stop and is separate from the resolved signing-integrity finding. Action count · Ledger identity

At review time dependency review had passed, Gitleaks was running, and GitHub had posted no aggregate CI result. I reviewed the changed source and test assertions against the previous verdict. These checks apply across forms. This review adds no live-portal or held-out measurement. Previous verdict

@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: dff5bf0

Gemini run on dff5bf0 (gemini-3.1-pro-preview, cross-vendor; author is Claude). Input: the commit messages, the engine and test diff against the PR base, and the head versions of the key files. Posted by the form-tx agent on Gemini's behalf; output unedited below.

VERDICT: APPROVE
BLOCKERS: none
NON-BLOCKING: none
CHECKED: I verified that the absent-evidence-as-success and partial-match-as-match fail-open classes are correctly fixed. I checked that all written, kept, and accepted controls are recorded as subjects and require a passing read-back verdict. I verified that the signer enforces per-field verdicts and refuses to sign a verified receipt if any required field or subject is uncovered or not passed. I checked that radio buttons require explicit selection to match. I verified that single-screen forms without a commit control halt safely, and that a commit click without a confirmed save request halts safely. I also verified that older receipt serialization correctly preserves field presence using model_fields_set.

# Conflicts:
#	.gitleaksignore
#	llms-full.txt
#	packages/flow/CHANGELOG.md
#	packages/flow/public-artifacts.json
026326e made save confirmation fail closed unless a pack declares
commit_url_patterns or a record-specific lookup. The two synthetic
portal packs and the copilot runtime test pack declared neither, so
every commit was refused as unconfirmed. Declare each fixture's commit
endpoint as pack data; the engine check is unchanged.
@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

From: Claude
Reviewed-Head: 0c61aaf

@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Claude
Reviewed-Head: 0c61aaf

The diagnosis is right. 026326e made save confirmation fail closed unless the pack declares a commit endpoint or a record lookup, and these fixture packs declared neither. The fix adds the real commit endpoints as pack data: /api/quotes/commit (underwriting), /api/hms/register (HMS) and /save (inline test). Matching is exact. None of the portals' draft, re-render, estimator or dismiss POSTs matches, and those POSTs are also in ignored_mutation_paths. No engine code or test expectation changed. The test that refuses a pack with neither patterns nor a lookup is still there, and so is the test that a draft autosave does not count as the commit.

Follow-up, not blocking: the pack compiler (pack_compiler.py:1113) emits no commit_url_patterns, and certified_ready does not require commit evidence. A compiled pack can therefore be certified ready and still always end DELIVERY_UNCERTAIN at commit unless its summary check has a lookup. This comes from 026326e, not from this fix.

The reviewer read the code only. It did not rerun tests because host load was above the limit.

…e reply body

The surface marked a save as failed when the request failed after its
status arrived. That happens whenever a page does `await fetch(); location
= ...`: leaving cuts off the reply body. No save decision reads the body,
so the status and headers are the answer; a request that never got a
status still fails.
…nt fills from the ledger; a signer refusal is a stop

- Every control the reconciler actuates is noted apart from the write
  ledger. Before signing, each must be in the ledger (a radio option may
  be named by its group); otherwise the run ends readback_incomplete with
  no receipt.
- The receipt's fields_filled_auto is the number of distinct auto-filled
  controls in the ledger, so a control filled again after a sign-in or a
  re-render is one field.
- A signer refusal (ValueError) ends the run readback_incomplete instead
  of raising, including from apply_human_resolution.

Tests pin the await-fetch-then-leave pattern with a reply that is still
streaming, a save with no status, an actuation missing from the ledger,
a planted signer refusal after a human decision, and a re-filled control.
@abrichr

abrichr commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

From: Claude
Reviewed-Head: 1067e97

…a client abort; actuations keyed by popup and screen

Review follow-ups:
- The answered flag is keyed by the request's sequence number and cleared
  with the counter, so a reused object id cannot turn a later failed save
  into a cut-off reply. A request that failed after its status counts as a
  cut-off reply only when the browser reports a client abort; any other
  failure still vetoes the save.
- An actuation is covered only by a ledger entry in the same popup and on
  the same screen, as the ledger keys its subjects.

Tests: a later save with no status vetoes an earlier 2xx; a ledger entry
for the same selector in another popup does not cover an actuation.
@abrichr

abrichr commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

From: Claude
Reviewed-Head: cfdb87b

@abrichr

abrichr commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Claude
Reviewed-Head: cfdb87b

This covers 0c61aaf..cfdb87b (two review rounds; round 1 requested changes and both blockers are fixed).

  • Save answer. A 2xx/3xx status is the save answer even when the page leaves and cuts the reply body off (await fetch(); location = ...). A failure after a status counts as a cut-off reply only on a client abort. Any other failure, and any save that never got a status, still vetoes the save. The answered state is keyed by request sequence (never by object id) and cleared with the counter, so a reused id cannot hide a failed save.
  • Signer independence. The reconciler notes every actuation apart from the write ledger, keyed by popup, screen and selector, as the ledger keys subjects. Before signing it refuses (readback_incomplete, no receipt) if any actuation is missing from the ledger. A mismatch can only cause a false refusal.
  • Receipt count and refusals. fields_filled_auto is the number of distinct auto-filled controls in the ledger. A signer ValueError becomes readback_incomplete with safe_to_retry false and never escapes, including from apply_human_resolution.
  • Tests pin each case: a reply still streaming when the page leaves (fails with the false stop when the surface fix is reverted), no status, a later save with no status after a 2xx, an actuation missing from the ledger, a ledger entry from another popup, a planted signer refusal after a human decision, and a re-filled control.
  • No app names in engine code.

Follow-ups, not blocking: radio aliases are scoped by name across the whole snapshot, not per form. FormTxResult.fields_filled_auto still reports the raw actuation counter.

Local single-process run at load under 15: form-tx, copilot and quiescence suites, 335 passed.

@abrichr

abrichr commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: ef4f5cc

VERDICT: APPROVE

Independent cross-vendor adversarial review of ef4f5cc88d583eeee25f96026eb2eaaf1c4bbea1 (Claude-authored claude/form-tx-weekend; I authored none of this PR).

Findings & fail-closed verification (covering 72206156..cfdb87bf + main merges 18e772e3, ef4f5cc8)

  • Sequence-keyed answered-save & client-abort boundary (playwright_surface.py): _answered_mutation_seqs and _body_cut_off_mutation_seqs are keyed by request sequence number (never reusable id(request)) and cleared in reset_mutation_counter(). _on_request_failed treats a post-status drop as non-failing ONLY when seq in self._answered_mutation_seqs AND _is_client_abort(request) matches (err_aborted, ns_binding_aborted, cancelled); any un-answered save or non-client-abort error goes to _failed_page_mutation_seqs and vetoes an earlier 2xx (test_a_later_save_with_no_status_vetoes_an_earlier_2xx).
  • Actuation-vs-ledger & signer-refusal fail-closed checks (reconciler.py): Every actuated control ((popup, screen, selector)) is verified against the write ledger before signing (test_a_write_noted_for_another_popup_does_not_cover_an_actuation), receipt fill counts come from the ledger (test_a_control_filled_more_than_once_counts_once_on_the_receipt), and any issue_form_tx_receipt refusal yields READBACK_INCOMPLETE with receipt=None and safe_to_retry=False (test_signer_refusal_after_a_human_decision_is_a_stop).
  • Generality: Commit endpoints live in pack data, engine invariants apply across portals, and held-out quote portal runs are honestly reported.
  • Note: PR currently shows CONFLICTING against main and needs a clean main merge before landing.

@abrichr

abrichr commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Claude
Reviewed-Head: ef4f5cc

Scope: the three engine commits since the last approval at 0c61aaf (7220615, 1067e97, cfdb87b), plus the two merges of main. I read the diffs and the code at the head with git show. I did not run tests.

(a) Save answer (playwright_surface.py). No fail-open found.

  • A 4xx or 5xx response adds the sequence to _failed_page_mutation_seqs in _on_response. The cut-off branch in _on_request_failed only returns early and never removes a sequence from the failed set, so a 4xx or 5xx followed by a navigation still vetoes the save.
  • A request with no status is not in _answered_mutation_seqs, so it fails. A request that failed after a 2xx counts as cut off only when request.failure contains err_aborted, ns_binding_aborted or cancelled. A connection reset, an incomplete chunked body or an empty reply still fails and vetoes the save.
  • Keying by sequence fixes the object-id reuse problem. Both sets are cleared in reset_mutation_counter, the only place the sequence restarts. _pending_mutation_seqs is still keyed by id(request), but each entry is popped on requestfinished or requestfailed while Playwright still holds the request object, so the id is live for the entry's whole lifetime.
  • A 2xx alone is a commit gate, not a verdict. VERIFIED still needs the read-back judge and the signer, so a server that streams a 2xx before its own commit and then fails is caught by the read-back.
  • If a driver ever delivered requestfailed before response, the request would count as failed. That direction fails closed.

(b) Ledger check (reconciler.py). The check is independent of the ledger it checks: _actuations is appended in the _actuate_control wrapper, apart from record_write. All three call sites pass session and in_popup_subroutine. No field actuation (fill_text, select_native_option, set_checkbox_or_radio, choose_portal_combobox_option) happens outside _actuate_control_once, and there is one signing site, guarded by _unrecorded_actuations. The keys are unambiguous: they compare (popup, screen, selector) tuples, the | string is only the message, and both sides read the screen from session._last_observation at the same point.

(c) Signer refusal. A ValueError from issue_form_tx_receipt now gives READBACK_INCOMPLETE with no receipt and safe_to_retry=False. This path is reached from _finalize_commit, and therefore from apply_human_resolution through _resume_after_resolution.

Merges of main. For every file, the PR's net diff against main's merge base is the same before the merges (cfdb87b against 7c55ba3) and after them (ef4f5cc against 49cdd76), with three expected differences:

Nothing was dropped.

Non-blocking notes

  1. The signer's auto-fill count check is now tautological. fields_filled_auto is computed with the same read_subjects(...auto_fill...) call the signer compares against, so that check can no longer fail. This is acceptable because _unrecorded_actuations is the independent check now, and it is stronger for the case the count used to catch. session.fields_filled_auto no longer feeds the receipt.
  2. Coverage only checks presence. Any ledger entry with the same popup, screen and selector covers an actuation, whatever its field key or source (kept_matching, operator_value). Every ledger subject still needs a passing read-back verdict, so the control is still checked.
  3. An actuation is noted only when _actuate_control_once returns no halt. At this head, halts happen before the value changes. In children that add surface-error halts (fix(form-tx): type into type-aheads and stop on surface errors (partial-match-as-match fix) #2448 and later), a halt can come after partial typing. Resolving that halt records a ledger entry for the same selector, so I see no gap in practice, but it is worth keeping in mind.
  4. In apply_human_resolution, the actuation is noted with in_popup_subroutine=None, but the write is recorded with in_popup_sub from the halt metadata. If those ever differ, the run refuses to sign. That is a possible false stop, not a fail-open.
  5. _body_cut_off_mutation_seqs is written and cleared but never read. No save decision reads a reply body today, so nothing can end in an unknown state. Any future decision that reads a body must consult this set.
  6. A TypeError from _coerce_private_key still escapes. That is not a fail-open, since no receipt is issued.
  7. Missing tests: a 4xx followed by a client abort should still veto the save, and a 2xx followed by a non-abort failure should veto it too. The code handles both cases correctly; tests would pin that behavior.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant