Skip to content

bench(form-tx): measure the gap fixes on four new held-out quote portals (verdict: rework) - #2453

Closed
abrichr wants to merge 150 commits into
mainfrom
claude/form-tx-heldout2-run
Closed

abrichr wants to merge 150 commits into
mainfrom
claude/form-tx-heldout2-run

Conversation

@abrichr

@abrichr abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member

Measures the form layer, with the five gap fixes, on four new held-out synthetic quote portals. Verdict: rework.

Stacked on #2429. It merges the five fix PRs (#2449, #2448, #2440, #2441, #2447) plus a little integration glue, so merge it after them.

Results

New portals, held out, arm B, 33 cases:

Criterion Bar Result
Trap cases stopped before submit ≥ 75% 15 of 18 (83%), met. None of those 15 then ended correct.
Clean cases with a false stop ≤ 10% 10 of 15 (67%), not met
Submitted quotes verified with a receipt ≥ 50% 1 of 11 (9%), not met
Wrong values submitted 0 5, not met. All 5 were flagged after submit and none got a receipt.

The unguarded filler got 21 of 33 wrong, with no flag.

Old four portals, now a dev set, same engine: 20 of 32 correct (the first run got 6), 10 verified (the first run got 0), and no crashes (the first run had 8). It also issued 2 receipts for wrong quotes: the wrong field was a driver list that the pack never bound.

Main causes, in RESULTS.md:

  • A sign-in partway through a quote resets fields that the layer does not re-check. Read-back caught every case.
  • Controls the pack does not bind are not checked.
  • Some stops have no field label, or show the radio option instead of the group name, so the operator can't act on them.
  • Read-back of split dates and of unlabelled results is not supported.

What's here

  • packages/flow/benchmark/form_tx_heldout2/: the new portals and answer key. A separate agent built them without reading the form layer.
  • packages/flow/benchmark/form_tx_heldout2_run/:
    • the pre-registration, pushed before any run, with deviation D1, which re-pins the engine before the first scored case;
    • ENGINE_SHA;
    • the dev-case demonstrations;
    • the raw rows and the results.
  • Runner changes: --suite, operator sign-in, and the by-hand estimator now off by default.
  • Packs for both sets.
  • Cross-feature tests, and the integration-only fixes that need more than one of the PRs.
  • The CAPABILITIES row and a refreshed llms-full.txt.

Everything is synthetic.

…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.
Frame routing (Codex's codex/frame-form-surface commits, cherry-picked
above) becomes pack data: UIProfileSpec.frame_path_patterns, used when the
surface gets no explicit patterns.

Every in-page script now walks open shadow roots: controls, labels,
sections, banners, sign-in walls, modals, busy markers and listboxes.
A control inside a shadow root gets the selector
'<host selector> >> <selector inside the root>', which Playwright
locators accept. Closed shadow roots stay invisible.

A child popup that closes itself after its apply button ends its settle
wait instead of raising, as before the frame commits.
A popup routine can now list compute_anchors, buttons clicked in order
before its apply button (Calculate, then Use This Value), and can run as a
dialog in the same page (popup_mode: in_page). Popup inputs are re-read
before the first step and again before apply, and still stay not_checked
unless the stored record shows them.

An estimator result that differs from a value the intake already gives now
stops before submit instead of being kept. A popup that will not open, a
missing or ambiguous button, or a popup that never settles becomes a
POPUP_CONTRACT_FAILED stop instead of an exception out of the run.
A portal combobox that is a text input is now filled by typing, so
suggestions that load only after typed text appear. A suggestion is chosen
only when exactly one matches under the codec, and the choice is checked
afterwards. A control the surface cannot act on stops for an operator
instead of raising out of the run; after the submit click it ends
delivery_uncertain.
…dios as empty

An error banner or dialog whose text says the session ended is now a sign-in
wall (auth_required), checked before any error is read as a validation
failure, on every post-action path. After a submit request went out it is
delivery_uncertain and cannot resume. Patterns are UI-profile data
(session_expired_text_patterns) with generic English defaults.

Native radios sharing a name are one field: an unchecked radio reads as
empty, keeps its own value in radio_value and lists its group in options; an
anchor matching a group resolves to the checked radio; a required group with
no intake value stops once.
A confirmation page that shows the stored quote as text, not in form
controls, left every field not_checked. The snapshot now also collects label
and value pairs from definition lists, two-cell table rows, one-row header
tables and "Label: value" text, including inside open shadow roots. They are
kept out of the controls, so nothing fills or halts on them.

When a read-back anchor finds no control, the judge falls back to these
pairs by label: a label shown twice is not_checked, an empty or different
value is failed, the same value is passed. Outputs such as a quote number
are read the same way. Popup inputs re-read before apply stay not_checked.
…o claude/form-gaps-integration

# Conflicts:
#	CAPABILITIES.md
… into claude/form-gaps-integration

# Conflicts:
#	CAPABILITIES.md
#	packages/flow/openadapt_flow/form_tx/playwright_surface.py
…nto claude/form-gaps-integration

# Conflicts:
#	CAPABILITIES.md
#	packages/flow/docs/FORM_TX.md
… into claude/form-gaps-integration

# Conflicts:
#	CAPABILITIES.md
#	packages/flow/openadapt_flow/form_tx/reconciler.py
#	packages/flow/openadapt_flow/form_tx/surface.py
The frame-routing surface reads the owner page's url at construction.
…ped settle

Main's TOP_TICKS_JS returns {ticks, stalled}. The root-frame check still
indexed it as a list (KeyError: 0). A stalled top window now falls back
to the screenshot settle, as _per_frame does.
…ct coverage

The coverage check credits each subject only with a distinct observation.
Values shown as page text (not in a control) were never counted, so every
text read-back became not_checked. Two read-backs on the same shown pair
still count once; an ambiguous pair counts none.
…o-filled controls from the ledger

A radio group got one ledger subject per option it touched, leaving one
uncovered. Use the group's first option as its selector (as on
claude/form-tx-rework, 5798bbc). The signer requires fields_filled_auto
to equal the distinct auto_fill subjects; a control filled again after a
sign-in counted twice and made the signer raise. Derive the count from the
same ledger.
…s read their reply

The weekend branch requires a pack to declare commit_url_patterns (or a
record lookup) before a save counts as confirmed. Fixture submit handlers
that navigated without reading the reply aborted the request after its
2xx, which the surface records as a failed save.
@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

From: Claude
Reviewed-Head: 6db50ad

@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Claude
Reviewed-Head: 6db50ad

Delta check of the merge of claude/form-tx-weekend 0c61aaf and its follow-ups: OK. All conflicts were resolved keeping both sides; nothing fail-closed was dropped. It carries the follow-ups from 2440, 2447 and 2449, and the fixtures declare commit endpoints. Finding (non-blocking): a 2xx save whose request is then aborted by navigation is recorded as failed, so a common await fetch(); location = ... page ends delivery_uncertain. The fixtures now read the reply; the engine behavior needs its own pinned test and an issue.

Local single-process runs (load under 15) passed on this head.

…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.
# Conflicts:
#	packages/flow/openadapt_flow/form_tx/reconciler.py
…ly again

The surface now takes a 2xx status as the save answer even when leaving
the page cuts the reply body off, so the fixtures go back to the common
`await fetch(); location = ...` pattern they were written with.
…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.
# Conflicts:
#	packages/flow/openadapt_flow/form_tx/playwright_surface.py
# Conflicts:
#	packages/flow/CHANGELOG.md
…wrapper

The actuation note added on claude/form-tx-weekend wraps _actuate_control;
the type-ahead pick's typeahead_query_chars argument must reach the inner
actuation.
@abrichr

abrichr commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Claude
Reviewed-Head: 19d4763

Delta since 6db50ad: the merges of 1067e97 and cfdb87b, 89eed39 (test only: two fixtures go back to await fetch(); location = ...), and 19d4763 (the type-ahead query-length pass-through in the wrapper).

Conflicts:

Since the last approval, this head carries the #2429 engine commits (the 2xx save answer, the ledger check before signing, a signer refusal as a stop, and keying by sequence, popup and screen). Every _actuate_control call site in this head passes session and in_popup_subroutine, there is one signing site, and it is guarded by _unrecorded_actuations and the ValueError stop. I checked the call sites statically.

Own changes preserved: git diff cfdb87bf8 19d4763dc --stat gives 115 files, the same file set. In reconciler.py, the ledger-derived fields_filled_auto change from this branch no longer shows as a delta, because #2429 now carries the same change. The only other changes are the pass-through and the test fixtures. The merge base is cfdb87b, not ef4f5cc.

Tests: 136 passed on the targeted form_tx files. The run went through cpu-slots with a non-monorepo interpreter, with this branch's code first on PYTHONPATH. I did not run them myself.

# Conflicts:
#	packages/flow/CHANGELOG.md
# Conflicts:
#	CAPABILITIES.md
#	llms-full.txt
@abrichr

abrichr commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Grok
Reviewed-Head: 116dd44

Cross-vendor re-review at the current head. My last verdict was REQUEST CHANGES at f3fdcc233ae4d9d4dac7a4610a7f5c0a4194bfef (#2453 (comment)). The PR is open and its head matches this SHA. The base is claude/form-tx-weekend (#2429). I will not merge this PR.

My earlier finding: resolved

The public CAPABILITIES row (capabilities/04-…/0115-…md) now says plainly that 2 of the 5 wrong submits (fc-s02, gw-s04) "were flagged on other fields, not the wrong one, because the wrong control had no binding". It also says that 15 of 18 trap cases stopped before submit "but none of those then ended correct", and it names the 2 false receipts on the dev set. The row no longer reads as a stronger claim than RESULTS.md. I did not re-tally the raw result rows at this head: no results/*.jsonl file changed since f3fdcc23.

Blocking: CI is red on this PR's own files

  • gitleaks: generic-api-key findings in packages/flow/benchmark/form_tx_heldout2/answer_key.json (lines ~1350 and ~1393, introduced in de6a3bf8).
  • packages / scope: EVIDENCE_KEYS_DENIED. The evidence-key check refuses any file named like a key. This cascades to packages-gate, ci and run-ci.

#2429 hit the same thing and fixed it by renaming its answer file to answers.json (d84e57c6f). Do the same here and update the references (selfcheck, scorer, RESULTS). If gitleaks still reports the historical commit, the PR needs a reviewed allowlist entry for that path or a history rewrite of this branch by its owner. Do not weaken the scanner.

P2: the auto-fill cross-check is now self-vouching

9b990462f changes _finalize_commit to pass fields_filled_auto=len(read_subjects([w for w in session.writes if w.source == "auto_fill"], ())). The signer then checks fields_filled_auto == len(auto_fill_subjects), where auto_fill_subjects comes from the same writes. The check can no longer fail. Before, the session's own fill counter was an independent witness. A control that was auto-filled but never got a ledger entry would make the signer refuse. Now such a fill gets no read-back subject and no signer refusal. The double count after a sign-in is a real problem. Keep the independent witness and fix the counting: have the session track the set of distinct auto-filled subjects as it fills them, and pass that. The signer then still refuses when the session filled something the ledger does not cover.

Other engine changes reviewed

  • _subject_selector: one radio group is one subject, the first peer's selector. This is generic.
  • cf768ade7: the frame-scoped settle reads the new tick-probe shape. Not a verdict path.

The f56cbf456 page-text observation change matches #2449 (see my review there). I found nothing fixture-specific in openadapt_flow/. The portal code stays under benchmark/.

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

test_form_tx_reconciler_and_receipts.py, test_form_tx_fail_open_classes.py, test_form_tx_written_field_no_fact.py, test_form_tx_text_readback.py, test_form_tx_popup_steps.py, test_form_tx_typeahead.py, test_form_tx_partial_pick.py: 91 passed. Not run: the heldout2 live selfcheck (nightly-only, many browser runs) or a re-tally of results.

CI at review time

13 pass, 33 skipping, 8 failing: gitleaks, scope, packages-gate ×2, ci, run-ci, plus protected-path evidence / protected-safety-review ("base must be main", expected while stacked).

…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.
…s for the signer

9b99046 passed the signer a count derived from the same write ledger it
checks, so the auto-fill cross-check could not fail. The session now notes
each auto-filled control, by ledger key, at the fill itself and passes that
count. A control filled again after a sign-in is still one field, and an
operator write that replaces an auto-fill removes it from both sides. A fill
the ledger records under another source is refused.
…popup rule

Same fix as 20547c6 on #2441: the mypy arg-type/assignment errors in the
status_by_key block. Runtime behavior is unchanged.
@abrichr

abrichr commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

From: Claude
Reviewed-Head: aea5f80

Author declaration for the fixes to the Grok review at 116dd44a (#2453 (comment)).

Blocking: gitleaks and scope (EVIDENCE_KEYS_DENIED). Fixed in c5f58ebe8.

  • I renamed benchmark/form_tx_heldout2/answer_key.json to answers.json and the manifest field to answers_sha256, the same way fix(form-tx): read back every field, report the rest as not_checked, and measure on held-out quote portals #2429 did in d84e57c6f. The contents and sha256 (46df94bf…) are unchanged.
  • I updated the references in build_cases.py, case_defs.py, scoring.py, make_manifest.py, README.md, the selfcheck test and public-artifacts.json, then regenerated MANIFEST.json.
  • I left benchmark/form_tx_heldout2_run/PREREGISTRATION.md as it is, because it records the hash under the old name. fix(form-tx): read back every field, report the rest as not_checked, and measure on held-out quote portals #2429 also left its preregistration unchanged.
  • Please review: there are new .gitleaksignore entries. The scanner config is unchanged. I added 12 fingerprints, pinned by commit, file, rule and line, for the historical findings in CI's gitleaks log:
    • MANIFEST.json lines 3 and 8 at d2d68833: sha256 digests under the old answer_key names.
    • fixtures/portal_logins.json:4 and nine answer_key.json lines at de6a3bf8: the synthetic portals' made-up okelund-test-pass-7 login.
  • A local gitleaks git . --config .gitleaks.toml --log-opts=HEAD at the new head reports 0 findings. The rename adds no lines, so it raises no new finding. The squash commit on main will add those lines again, so it may need its own pinned entries after merge, as the #2293 squash merge entry did.
  • scripts/check_evidence_keys.py: passed.

P2: the auto-fill cross-check was self-vouching. Fixed in cec5b342d.

  • ReconcilerSession now notes each auto-filled control at the fill site, keyed at ledger granularity (field, screen, subject selector, popup). It does not read that record back from the ledger. _finalize_commit passes session.auto_filled_subject_count to the signer, so the signer again compares two independent records.
  • A control filled again after a sign-in counts once. fields_filled_auto on the result now also counts each control once.
  • An operator write that later replaces an auto-fill on the same ledger key removes the control from both records, so it does not cause a false refusal.
  • New test test_an_auto_fill_the_ledger_records_under_another_source_is_not_signed: the fill reaches the ledger as kept_matching, so the unrecorded-actuation check passes, but the signer must refuse with "auto-fill count does not match". With the 9b990462f line restored, this test fails: the run is signed VERIFIED_DONE. New unit test test_the_session_counts_each_auto_filled_control_once covers a refill and an operator overwrite.

Masked lint. flow core lint was skipped here because scope failed. The same mypy errors as #2441 were present in judge.py (status_by_key), so aea5f808c applies the same fix as 20547c6fc. ruff format was also applied to test_form_tx_heldout2_portals_selfcheck.py, which was not formatted.

Checks run locally (Python 3.12, in-tree flow and types):

  • mypy on form_tx/judge.py and form_tx/reconciler.py: no issues.
  • ruff check and ruff format --check on the changed files: clean.
  • check_release_consistency.py: passed.
  • test_form_tx_save_answer.py, test_form_tx_reconciler_and_receipts.py, test_form_tx_fail_open_classes.py, test_form_tx_written_field_no_fact.py, test_form_tx_text_readback.py, test_form_tx_popup_steps.py, test_form_tx_typeahead.py, test_form_tx_partial_pick.py: 100 passed.
  • test_form_tx_heldout2_portals_selfcheck.py without reference_human: 90 passed.

Not run: the heldout2 reference_human live selfcheck and a re-run of the heldout2 results after the engine change. The committed results come from the earlier engine.

@abrichr

abrichr commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: aea5f80

Independent cross-vendor review of claude/form-tx-heldout2-run.

What was verified

  • answer_key.json -> answers.json rename (c5f58ebe8): Consistently updated across MANIFEST.json, build_cases.py, case_defs.py, make_manifest.py, scoring.py, public-artifacts.json, and test_form_tx_heldout2_portals_selfcheck.py, avoiding false key-material detection in CI.
  • judge.py:658-662 mypy fix (aea5f808c): Explicitly maps v.status is None to ReadbackStatus.NOT_CHECKED (fail-closed, identical to #2441).
  • Session auto-fill tracking (cec5b342d): Session tracks its own auto-filled controls for the signer cleanly with regression tests in test_form_tx_save_answer.py. 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: aea5f80

Delta re-review of my REQUEST CHANGES at 116dd44a99379d6e067148f720c3c516034caea7 (#2453 (comment)). The PR is open and its head matches this SHA. The base is still claude/form-tx-weekend (#2429). Three commits since: c5f58ebe8, cec5b342d and aea5f808c. I will not merge this PR.

Blocker 1 (gitleaks / scope on the answer file): fixed in the tree, CI not reported yet

  • answer_key.json is renamed to answers.json (a pure rename with no content change), and the references in the scorer, manifest builder, README, MANIFEST and public-artifacts.json are updated. The load_answer_key() function name is unchanged, which is harmless.
  • .gitleaksignore gains 12 fingerprint-pinned entries (commit:path:rule:line), not a path or rule wildcard, so the scanner is not weakened. I checked each pinned line at its commit: MANIFEST.json:3/8 at d2d68833 are the sha256 of the answers file, and the answer_key.json and fixtures/portal_logins.json lines at de6a3bf8 are the synthetic portals' <portal>-test-pass-N passwords with example.test usernames. None is a real credential.

P2 (auto-fill witness was self-vouching): fixed

  • ReconcilerSession.note_auto_fill now records each auto-filled control in _auto_filled_subjects, keyed exactly like the ledger, at the fill. _finalize_commit passes auto_filled_subject_count to the signer. The signer compares that with the ledger's own auto_fill subjects, so two independent records are compared again, and a fill the ledger lost or mislabelled makes the signer refuse.
  • Mutation check: I put back the 9b990462f ledger-derived count. test_an_auto_fill_the_ledger_records_under_another_source_is_not_signed then fails, so the test catches the regression. I reverted it afterwards.
  • The re-fill after sign-in still counts once (note_auto_fill returns False for a known key).
  • P3, no change needed: record_write removes a key from the witness set when a non-auto-fill write replaces an earlier auto-fill. The witness is therefore not fully independent in that one case, but both sides move together and the result is consistent.

Delta 3

aea5f808c is the same judge.py change as #2441 (a None read-back status becomes NOT_CHECKED in the popup rule). It fails closed and makes the existing behaviour explicit.

Generality gate: the engine changes are in form_tx/ and key on ledger keys, bindings and status. Portal names stay under benchmark/ and tests/. scripts/check_engine_generality.py: OK.

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

  • test_form_tx_save_answer.py, _reconciler_and_receipts, _fail_open_classes, _written_field_no_fact, _text_readback, _popup_steps, _typeahead, _partial_pick: 100 passed.
  • ruff check and ruff format --check on form_tx/ and the changed tests: clean.
  • Not run: the heldout2 live selfcheck (nightly-only), gitleaks locally, or a re-tally of results (no results/*.jsonl changed).

CI at review time

14 pending, 2 skipping, 1 failing. gitleaks and packages / scope are both still pending at this head. Evaluate protected-path evidence fails because this PR is stacked on #2429 and its base is not main. This APPROVE is on the code. The merge gate still needs gitleaks, scope, lint and the flow shards green at this exact head, and the protected-path check resolved once the base is main.

Base automatically changed from claude/form-tx-weekend to main November 23, 2026 22:25
@abrichr

abrichr commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Architectural pivot (founder Option 1, 2026-11-23): freezing the hand-written form-tx DOM heuristic and word-list stack to focus on openadapt wrap + demonstration-derived CheckpointSpec + Cross-Tab Entity Ledger + GUI-to-API/MCP promotion. Branch preserved for reference.

@abrichr abrichr closed this Nov 24, 2026
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