Skip to content

fix(transducer): every value typed into a saved form must be read back before VERIFIED - #2873

Open
abrichr wants to merge 7 commits into
mainfrom
fix/typed-values-read-back
Open

abrichr wants to merge 7 commits into
mainfrom
fix/typed-values-read-back

Conversation

@abrichr

@abrichr abrichr commented Dec 1, 2026

Copy link
Copy Markdown
Member

Stacked on the hold-hint PR. Follows the post-save screen check model in #2849: every intended value is read back field by field.

Problem

wrap verified a save once the obligations compiled from the instruction were seen. A value the agent typed that no obligation names could be dropped, cut, or rewritten on save without stopping the run. Examples: a reference number, or a field the instruction did not quote.

Change

With a pinned record identity, the done gate holds, then releases the run unverified, while any value typed into the form a commit saved has not reappeared on a saved screen of the record. The value can reappear verbatim, or in the reopened form, under any field name. The hint lists the values not yet read back and says to read them in the saved record, then finish.

Limit

A wrong value that the app saves and shows back exactly as typed passes this check. A screen check cannot tell it is wrong. Catching it needs a check against the task: the caller declares the values that must match the source document (structured_fields). On the OpenEMR benchmark, a same-length wrong authorization number is caught only that way.

Tests

test_typed_value_not_read_back_blocks_verified: the agent typed a reference number that the app dropped on save. The obligations alone would verify the run; now it ends unverified, and the hint names the dropped value.

…k before VERIFIED

wrap verified a save when the obligations compiled from the instruction
were seen. A value the agent typed that no obligation names (a reference
number, a field the instruction did not quote) could be dropped, cut or
rewritten on save without stopping the run.

With a pinned record identity, the done gate now holds, then releases
unverified, while any value typed into the form a commit saved has not
reappeared on a saved screen of the record (verbatim, or in the reopened
form). This follows the post-save screen check model in #2849: every
intended value is read back field by field.

Limit: a wrong value that the app saves and shows back as typed is
confirmed by this check. Catching it needs a check against the task
(declared values), not a screen check.
@abrichr

abrichr commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Grok
Reviewed-Head: 20e27bc

I reviewed this exact head. I am not approving, and I will not merge or push.

This PR is stacked on #2872 / #2871. I requested changes on #2871 because any non-commit click clears form_keys. This gate only inspects writes with in_form=True, so that hole is a fail-open for the claim in the title.

Blocker

  1. A mid-form click lets a dropped typed value still earn VERIFIED. _unseen_writes returns only w.in_form writes that are not yet confirmed. After fill_form, a non-commit click, and save, every write is stored with in_form=False. after_step · note_commit

    I reused this PR's own case: the task names the comments and the start date; the agent also typed PA14689226, which the app dropped. Without the extra click, test_typed_value_not_read_back_blocks_verified correctly keeps the receipt from going VERIFIED and records the hint. With one non-commit click after the fill, the run issued a VERIFIED receipt (persisted_state_reacquisition, reason "Every compiled field obligation is the pinned identity or a write confirmed on a saved screen of the pinned record"). The number stayed unconfirmed and never appeared in a hold hint.

    The PR's test does not insert a click between fill and save, and it accepts receipt is None or receipt.outcome != VERIFIED, which would also pass if the run never finished.

What holds

  • On the no-extra-click path, a typed value that no compiled obligation names can hold the done gate and keep the receipt from going VERIFIED, which is the intended class of check.
  • The gate is pinned-identity only. It holds, then releases unverified when the budget is gone, rather than signing.
  • It is invoked both when obligations are met via saved writes and when they are all found in the current read-back, which covers the two VERIFIED exits in that branch.

Generality gate

python packages/flow/scripts/check_engine_generality.py at this head reported "Engine generality OK (7 baseline hits left)". The check is over typed values and pinned identity, not an application-specific engine path. Tests use a synthetic record. No held-out real-app evidence is claimed.

Tests I ran

  • tests/test_transducer_v3_runtime.py: 29 passed, including test_typed_value_not_read_back_blocks_verified.
  • A local probe of the same dropped-number case with one non-commit click after fill_form produced VERIFIED.

CI at this head

Evaluate review verdict is red: "protected paths changed and there is no Grok or Codex review." Package jobs were skipped for that reason. Passing checks I can see include gitleaks, dependency-review, smoke, install weight, launcher run-ci, and validate-platform-manifest. I am not merging.

Limitations, not blockers once the latch is fixed

The typed-values gate only runs inside the obligations / completeness branch of pre_done. A pinned run with no compiled obligations can still verify by another path (SOP, container, regression) without this check.

@abrichr

abrichr commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

Response to the Grok review at 20e27bc. Fixed at d163eab.

Blocker: a mid-form click let a dropped typed value earn VERIFIED. The cause was #2871's click rule, now replaced by save membership based on screen and container (75f97fa, merged here). test_typed_value_not_read_back_blocks_verified now:

  • runs both without and with a non-commit click before the save;
  • requires the run to finish (receipt is not None) and to end unverified, as you asked.

Live controls on integration build a8f5deb09: 14 of 14 pass.

The limitation you noted stands: the gate runs only in the obligations / completeness branch of pre_done.

Re-review requested at d163eab.

@abrichr

abrichr commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: 4ac395c

I re-reviewed this exact head. It is stacked on #2872 / #2871, which I approved at 5d2135e2e2bb3aeebbb448505abc70322ea8ed2c and 1cc4cbf7761f91be65671d4f9f48eaa6568ae298. The mid-form click that previously let a dropped typed value earn VERIFIED is fixed with the new _form_of latch.

Behavior

_unseen_writes still only inspects in_form writes, but those writes now stay in the form across a non-commit click inside it. test_typed_value_not_read_back_blocks_verified is parameterized for click_before_save in {False, True} and now requires the run to finish (receipt is not None) with outcome != VERIFIED, and that PA14689226 appears in a "typed into a saved form" hint. Both parameterizations passed on this worktree.

On the no-extra-click path, a typed value that no compiled obligation names still holds the done gate and keeps the receipt from going VERIFIED. The gate is pinned-identity only. It holds, then releases unverified when the budget is gone, rather than signing.

I ran tests/test_transducer_v3_runtime.py against this worktree on Python 3.12: 36 passed in 0.37s. packages/flow/scripts/check_engine_generality.py reported "Engine generality OK (7 baseline hits left)". The check is over typed values and pinned identity, not an application-specific engine path. Tests use a synthetic record. No held-out real-app evidence is claimed.

Limitation, not a blocker for this head

The typed-values gate still runs only inside the obligations / completeness branch of pre_done. A pinned run with no compiled obligations can still verify by another path (SOP, container, regression) without this check.

CI at this head: packages scope, packages-gate, install weight, launcher run-ci, smoke, dependency-review, validate-platform-manifest and gitleaks passed. review-verdict is red because the newest Grok review was still REQUEST CHANGES at 20e27bc6. I am not merging. A release decision, if any, still sits with the maintainer.

@abrichr

abrichr commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: d0a4d44

I re-reviewed this exact head (R2 after my APPROVE at 4ac395c9f918). This head merges #2872 (a45cb5c4e2fd), and so includes the #2867 confirmation fix I approved at ca4b84a2c. The unique typed-value read-back code is unchanged. I am not merging.

What changed since 4ac395c9f918

Tests I ran at this exact head

  • tests/test_transducer_v3_runtime.py: 38 passed.

Generality: no per-app engine code. Fixtures are synthetic.

CI at this head

Packages, smoke, and launcher are green. review-verdict is red because the newest posted review was still my APPROVE at 4ac395c9f918, not this head.

This PR is stacked on #2872 / #2871 / #2867. I did not merge.

No release decision from me.

Base automatically changed from fix/hold-hint-names-missing to main December 1, 2026 18:01
@abrichr

abrichr commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

From: Grok (on Richard's delegation)

My APPROVE at d0a4d446 still stands, but GitHub reports this branch as conflicting with main, so it can't enter the merge queue. Please merge main into the branch (a normal merge, no force-push). If the merge changes only what main brought in, I'll check the new head and queue it once CI is green. #2871 and #2872 under it merged at 12:50 and 1:01 PM ET, and GitHub retargeted this PR to main. The conflict is probably with #2852 or #2876, which merged at 12:55 PM ET. This is the last open fix in the stack that blocks the paper wrapper freeze.

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