Skip to content

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

Merged
abrichr merged 32 commits into
mainfrom
claude/form-tx-weekend
Nov 23, 2026
Merged

abrichr merged 32 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.

…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.

# Conflicts:
#	packages/flow/CHANGELOG.md
@abrichr

abrichr commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: b813c50

Cross-vendor re-review at the current head. My last verdict was REQUEST CHANGES at 124db5c981ed99b6aced6a016e08293d83073968 (#2429 (comment)). The PR is open and its head matches this SHA. I will not merge this PR. The head is a merge of main on top of the twelve form-tx commits from d84e57c6f to cfdb87bf8. There are no new PR commits since the ef4f5cc8 head that other reviewers approved.

My earlier finding is fixed

At 124db5c9, a declared read-back key that had no expected fact, an empty or placeholder summary control, and no required_in_pack flag hit continue with no verdict. A written field could therefore be silent inside a verified_done receipt. At this head, SummaryJudge.evaluate adds a third branch (judge.py ~479–490). If the key is in the write ledger, it appends not_checked ("written with no expected value, and the summary shows it empty"). tests/test_form_tx_written_field_no_fact.py covers this. On top of that, uncovered_subject_verdicts now gives any written, kept or accepted subject without a verdict a not_checked. passed requires zero not_checked and zero failed.

Fail-open review of the signer (receipt.py)

build_form_tx_receipt refuses VERIFIED_DONE (raises) unless all of the following hold:

  • there are per-field verdicts and every one passed;
  • the pack and dossier are present, and every bound field that has a dossier value, plus every human-provided, fixed or accepted key, is among the verdicts;
  • the run's writes are supplied and their subjects_digest equals the judge's ledger_digest, so the signer cannot be handed a different ledger from the one judged;
  • no subject is uncovered;
  • fields_filled_auto equals the number of distinct auto-fill subjects in the ledger.

The signed checked-count is derived from the verdicts, not passed in. Receipts that predate the new optional fields verify only in the exact encoding they arrived in. A field that is absent is not re-added, and stripping a present field breaks the digest and signature. I found no path where a count, an absent field, or a caller-supplied number becomes "verified". All of this lives in form_tx/ and keys on pack bindings, the write ledger and anchors, not on any fixture portal. It passes the generality gate. The portal-specific code is confined to benchmark/.

Tests at this head (Python 3.12, in-tree flow and types)

  • test_form_tx_written_field_no_fact.py, test_form_tx_fail_open_classes.py, test_form_tx_reconciler_and_receipts.py, test_form_tx_save_answer.py, test_form_tx_lease_and_compiler.py, test_form_tx_heldout_portals_selfcheck.py: 154 passed, 1 failed.
  • The failure is test_reference_human_solves_every_scored_case, listed in nightly_only.txt (live, 32 browser runs). It failed twice locally on the same case, harborline hl-s09. The benchmark reference driver raises TargetClosedError when it clicks "Use This Value" on an estimator popup that closes itself. That is a race in the scripted reference filler (benchmark/form_tx_heldout/drivers/harborline.py) under my local Playwright 1.61, not in openadapt_flow/form_tx. It is not part of the PR-tier CI. Worth hardening (wait for the popup close event instead of awaiting the click), but it does not block.
  • Not run: the full flow suite, the e2e portal suite, or RESULTS.md re-tallies (I tallied those at 124db5c9; no benchmark result file changed since).

CI at review time: red, unrelated, needs a rerun

28 pass, 24 skipping, 1 pending (packages-gate), 1 failing: packages / flow core unit (shard 3/4). The only failure in that job is tests/test_api_step_json.py::test_the_api_step_sends_what_the_page_sends (IndexError on app.posts[-1] after wait_for_load_state("networkidle")). That is a timing race in a test this PR does not touch. Neither that test nor the API-step code is in the diff. This APPROVE is on the code. The merge gate still needs shard 3/4 rerun green at this exact head.

# Conflicts:
#	packages/flow/CHANGELOG.md
abrichr added a commit that referenced this pull request Nov 23, 2026
…ead it as key material

check_evidence_keys denies any tracked file named like a key, and
answer_key.json matched. As in #2429, the file is now answers.json and the
manifest field answers_sha256; contents and sha256 are unchanged. The
historical gitleaks generic-api-key findings (manifest digests and the
synthetic portals' made-up test passwords) are pinned in .gitleaksignore by
commit, file and line. The selfcheck test is also run through ruff format.
@abrichr

abrichr commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: 1fc5357

Delta review versus previously Grok-approved head b813c508: clean origin/main merge with conflict resolution only in packages/flow/CHANGELOG.md; zero code delta or behavior regression. Approve for merge on green CI.

@abrichr

abrichr commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: 1fc5357

Exact-head re-approval after a merge from main. My last verdict was APPROVE at b813c5086ff6267928b9baec52e3d3621eb8bfda (#2429 (comment)). The PR is open and its head matches this SHA. I will not merge this PR.

What changed

1fc53573e is one merge commit: parents are b813c5086 (the approved head) and 2ea74802f (main after #2565 and #2367). No PR commit changed. I recomputed the merge with git merge-tree b813c508 2ea74802. The only conflict is packages/flow/CHANGELOG.md, under "Fixes". The pushed tree differs from the automatic merge only by removing the three conflict markers, so both entries (form_tx read-back and the #2367 credential-field pixel-check fix) are kept unchanged. No code file differs from the automatic merge.

So my earlier code review still holds at this head. No new P1 or P2. Generality gate: unchanged (engine logic in form_tx/, portal code under benchmark/).

Tests

I did not re-run tests at this head. The code under review is identical to b813c508, where I ran the form_tx suites (154 passed, 1 nightly-only reference-driver race outside the engine). The flow shards at this head are the real check, especially shard 3/4, which failed at the old head on an unrelated test_api_step_json.py networkidle race.

CI at review time

Passing: CodeQL (js/ts), GTK check, internal links, source boundary, dependency review, freerdp loopback. Pending: CodeQL python/rust, gitleaks, windows replay, platform manifest. The packages workflow (flow shards, packages-gate, ci/run-ci) had not reported at this head yet. Evaluate protected-path evidence shows as failing, but the job's conclusion is cancelled (job 137801747123), so it needs a re-run by the PR owner. The merge gate still needs all of that green at this exact head.

@abrichr
abrichr merged commit 03578dc into main Nov 23, 2026
57 checks passed
@abrichr
abrichr deleted the claude/form-tx-weekend branch November 23, 2026 22:25
abrichr added a commit that referenced this pull request Nov 23, 2026
#2429 squash-merged to main, so main's side is taken for every file it
touched. Only the harborline popup fix remains, with a handoff check:
the reference human now fails a case when the estimator popup closes
without writing its value to the parent box.
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