Skip to content

feat(form-tx): run the general GUI mechanisms from the reconciler; Set 4 v2 dev re-run clears 3 of 12 false stops with no harm - #2517

Open
abrichr wants to merge 9 commits into
claude/form-tx-integration-basefrom
claude/form-tx-gui-wiring
Open

abrichr wants to merge 9 commits into
claude/form-tx-integration-basefrom
claude/form-tx-gui-wiring

Conversation

@abrichr

@abrichr abrichr commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

What this adds

This wires the four general GUI mechanisms (#2499, #2501, #2502, #2512) into the form_tx reconciler and measures them on Set 4 v2, which is now a dev set.

  • FormPack.gui (form_tx/gui_pack.py) is opt-in pack data. It holds link and tab steps, attestations, repeating groups, hub pages and stop_on_blank_choice. A pack without it hashes and behaves exactly as before.
  • form_tx/gui_bridge.py runs the mechanisms from three hooks in reconciler.py, which add 18 lines:
    • Before a screen is left.
      • Repeating group. Every intake item goes into its own instance, is checked there and is entered in the write ledger. A group that already shows the intake (after a walk back) is checked, not written again.
      • Hub page. Each section is filled by the pack's own bindings through run_section, and the hub is left through its declared link only when every card reads done. A stop inside a section resumes with the new gui.hub.save_section. A sign-in dialog after a save goes to the sign-in wall.
      • Step drawn as a link. It is taken with take_step.
      • Blank choice. A question no binding answers that is still blank stops.
    • Before the commit.
      • Review rows. Rows drawn as a label beside the value are read, and a value that differs from the intake stops.
      • Attestations. Each one is planned, ticked only on session.attestation_grants, and checked.
    • Modal step. A modal that holds an editable control is never confirmed through a dossier flag.
  • benchmark/form_tx_heldout_run/packs6 holds the Set 4 v2 packs moved onto gui. The suite is set4v2gui, and run.py --attester NAME passes the grant, off by default. packs5 and the registered B rows are unchanged.

Result (dev set: the packs were written after unsealing)

Full write-up: benchmark/form_tx_set4v2_run/WIRING_RESULTS.md. The arm B re-run on this tree matches the registered rows on every case.

  • 3 of B's 12 clean false stops clear: lta-s01, lta-s05 and lta-s06.
    • lta-s05 also needed a new pack step, "Update my details", written after seeing the case.
  • 1 moves: bfu-s02 now opens every hub section and stops at the community pick (T5).
  • 8 are out of scope: T5, T1 and T3.
  • Hard gates hold: no false receipt and no silent wrong submit.
  • Wrong submits fall from 1 to 0.
  • Traps stopped before submit: 12 of 16, against B's 13. The one that no longer stops, lta-s10, gets the operator's answer to its blank question and submits the correct record.
  • Accidental catches kept. Three traps were caught only by the old workarounds, and each is still handled:
    • lta-s04 by the review row check;
    • lta-s07 by the binding conflict;
    • lta-s10 by the blank-choice stop.
  • Without an attester, every case that reaches a review stops there, giving 13 clean stops and 0 wrong submits.

Tests

  • tests/test_form_tx_gui_bridge.py: 9 tests on two in-test synthetic apps. The first is an EMR-like medication list: repeating group, link step, attested review, blank question, missing list, and a prefilled field on the screen or inside an added row. The second is a SaaS setup hub: sections saved and read back, a save the app ignores, and a prefilled field inside a section dialog.
  • The form_tx test files, tests/gui and tests/failopen all pass on this branch. The fold-ratchet test fails, as it already does on the integration base. Its rises come from the form stack's own files (judge.py, receipt.py, types.py, reconciler.py, playwright_surface.py, _page_quiescence.py) measured against feat(flow): one verdict kernel, a fail-open harness and a fold ratchet #2476's baseline. The new modules add no fold.

Base

The base is claude/form-tx-integration-base, a merge-only branch. It merges #2464's branch (which carries #2461) with #2476 and the four GUI PRs, and resolves their four conflicts (.gitleaksignore, llms-full.txt, the flow CHANGELOG and _page_quiescence.py). It also carries one fix the merge needed, 01c2410dd: the stack's frame tick check read #2476's new {ticks, stalled} probe result as a list, and 28 frame tests failed. This PR's diff is the wiring and the measurement only.

…n a pack opts in

FormPack.gui (form_tx.gui_pack) declares repeating groups, hub pages, link
steps and attestations as data; form_tx.gui_bridge runs them from three
points in the reconciler. Repeating groups fill every intake item into its
own instance and check it there; hub sections are filled by the pack's own
bindings and counted done only when their card reads done; a step drawn as a
link is taken with gui.steps; an attestation is ticked only on a grant passed
to the run. stop_on_blank_choice stops on a question no binding answers.
Review rows drawn as a label beside its value are read before the commit.
gui.hub gains save_section so a section paused for a person can resume.
The Set 4 v2 packs move onto it as packs6 (written after unsealing).
…clean false stops clear, no harm added

Arm B re-run on the merged tree matches the registered rows. packs6 (written
after unsealing) clears lta-s01, s05 and s06, moves bfu-s02 to the community
pick, and takes wrong submits from 1 to 0. No false receipt and no silent
wrong submit. Rows, logs and control logs are committed.
@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: b3f4e24

Gemini run on b3f4e24 (model gemini-3.1-pro-preview, finish reason STOP). It was sent the full diff against claude/form-tx-integration-base (the committed run rows and control logs left out of the diff; WIRING_RESULTS.md included), every changed Python file at head, the verdict kernel, the harness, the four openadapt_flow.gui mechanism modules and the PR description. No earlier findings.

Blockers

None.

Non-blocking

None.

@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

From: Claude
Reviewed-Head: b3f4e24

Author declaration: Claude wrote the changes on this branch up to and including b3f4e24, and the merge-only base claude/form-tx-integration-base (including its merge fix 01c2410). The Gemini review above is the cross-vendor review for this head.

… screen

From Gemini's review of #2517: a gui step or a hub leave returned CONTINUE
before the reconciler's unbound scan, so a prefilled field no binding covers
on that screen was never stopped on. The scan now runs before a step, before
leaving a hub, and in each section dialog before its save.
…k only rows this run entered

From Gemini's review of #2517: after filling a group the screen went on with
the snapshot from before the rows existed, so the unbound scan and the next
control saw a stale screen. Filling now restarts the loop; the next pass
checks the rows and goes on. Rows showing data this run did not enter are
never taken as already entered.
…e marks them modal

From Gemini's review of #2517: the blank-choice and unbound scans skip
controls inside a modal, so under a profile that treats the section dialog as
a modal its fields were never scanned before the save.
@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Gemini
Reviewed-Head: 53bc251

Gemini run on 53bc251 (model gemini-3.1-pro-preview, finish reason STOP). Delta from the approved b3f4e24 (a base merge bringing in #2512's 5c43e62), with the full PR diff for context.

Blockers

  1. packages/flow/openadapt_flow/form_tx/gui_bridge.py:422 and 441
    Why it is a blocker: When gui_bridge.before_leaving_screen returns CONTINUE (which it does when taking a declared gui.step or leaving a gui.hub), the main loop in reconciler.py executes a continue statement. This skips the self._scan_unbound_controls(session, snapshot) check for the screen that is being left. Any unbound controls with values on the hub or step screen, or any unconsumed required intake keys that match a field there, will be silently ignored instead of halting the run. This is a fail-open path (a pass on partial evidence).
    The fix: Call rec._scan_unbound_controls inside gui_bridge.py before navigating away.
    • In before_leaving_screen, before take_step for a gui.step, call unbound_halt = rec._scan_unbound_controls(session, snapshot) and return it if it is not None.
    • In _hub, before take_step to leave the hub, take a fresh snapshot (since the hub sections have now been filled and saved) and call unbound_halt = rec._scan_unbound_controls(session, fresh_snapshot), returning it if it is not None.

Non-blocking

None.

@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Gemini
Reviewed-Head: d358a05

Gemini run on d358a05 (model gemini-3.1-pro-preview, finish reason STOP). Delta: d358a05, the fix for the round-two finding, with the full PR diff for context. (Run on the branch head, which added only a results re-run.)

Blockers

  1. packages/flow/openadapt_flow/form_tx/gui_bridge.py:354
    Why it is a blocker: When _repeat successfully fills a repeating group, it adds new rows to the screen. However, it always returns CONTINUE, which before_leaving_screen ignores (if out is not CONTINUE: return out), causing before_leaving_screen to eventually return None. The main loop in reconciler.py then proceeds to call _scan_unbound_controls and click the next button using the stale snapshot taken before the repeating group was filled. Any unbound controls inside the newly added rows (e.g., an optional "Notes" field the portal added) will be silently ignored instead of halting the run, which is a fail-open path (a pass on partial evidence). Furthermore, clicking the next button using a stale snapshot can lead to actions taken on the wrong control if the DOM shifted.
    The fix: Change _repeat to return CONTINUE only when it actually modifies the screen, and None when it just checks already-entered rows. Then update before_leaving_screen to return out if it is not None.
    • In _repeat, add a modified = False flag in the if branch (already entered) and modified = True in the else branch (after fill_instances). Change the return statement to return CONTINUE if modified else None.
    • In before_leaving_screen, change the check to if out is not None: return out. This will cause reconciler.py to correctly restart the loop and take a fresh snapshot when rows are added, while avoiding an infinite loop when they are already filled.

Non-blocking

None.

@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Gemini
Reviewed-Head: f746d3c

Gemini run on f746d3c (model gemini-3.1-pro-preview, finish reason STOP). Delta: f746d3c, the fix for the round-three finding, with the full PR diff for context. (Run on the branch head, which added only a results re-run.)

Blockers

  1. packages/flow/openadapt_flow/form_tx/gui_bridge.py:539
    Why it is a blocker: In _fill_with_bindings, the bridge calls _unbound_halt and _blank_choice_halt to check the hub section dialog before saving it. However, both of these checks explicitly skip any control that has modal_container set (if ctrl.modal_container: continue). Since hub sections open in dialogs (which are modal containers), all unbound controls and blank choices inside the section dialog will be silently ignored. If the portal adds a new required field or an optional "Notes" field to a section, the run will pass on partial evidence instead of halting.
    The fix: Before calling these checks in _fill_with_bindings, create a copy of the snapshot where the dialog's controls have their modal_container cleared so the scans will check them.
         # Clear modal_container for the dialog's controls so the scans check them.
         controls = [
             c.model_copy(update={"modal_container": ""}) if c.modal_container == _dialog.handle else c
             for c in snapshot.controls
         ]
         dialog_snap = snapshot.model_copy(update={"controls": tuple(controls)})
    
         blank = _blank_choice_halt(rec, session, dialog_snap)
         if blank is not None:
             raise _FillHalt(blank)
         unbound = _unbound_halt(rec, session, dialog_snap)
         if unbound is not None:
             raise _FillHalt(unbound)

Non-blocking

None.

@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: 8249186

Gemini run on 8249186 (model gemini-3.1-pro-preview, finish reason STOP). Delta: da8592a, the fix for the round-four finding, with a test, and a results re-run with the same counts; the full PR diff and changed files for context.

Blockers

None.

Non-blocking

None.

@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

From: Claude
Reviewed-Head: 8249186

Author declaration: Claude wrote the changes on this branch up to and including 8249186, and the merge-only base claude/form-tx-integration-base (including its merge fix 01c2410). The Gemini review above is the cross-vendor review for this head.

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