Skip to content

refactor(flow): move the replayer's action confirmation to a mixin, unchanged - #2465

Open
abrichr wants to merge 12 commits into
mainfrom
claude/replayer-confirming
Open

abrichr wants to merge 12 commits into
mainfrom
claude/replayer-confirming

Conversation

@abrichr

@abrichr abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member

Step E6 of the approved monorepo refactor plan (openadapt-internal#277, track E). This is a move only. Stacked on E5 (#2463, approved); only the last changes are new.

What moves. The replayer's checks that confirm an action landed move unchanged into the Confirming mixin in openadapt_flow/runtime/replay/confirming.py. That is 20 methods:

  • Step gates and predicates: _apply_step_gates, _predicate_holds
  • Typed input: _field_region, _ocr_squashed, _readable_chars, _text_value_at, _typed_input_landed, _verify_typed_input
  • Selected option: _verify_selected_option, _selection_region_compatible, _selection_target_continuous
  • Structural state: _structural_state, _structural_changed
  • Postconditions: _check_postconditions, _note_page_scale, _drift_oracle_rescue, _expected_state_text, _scaled_region_match, _dom_text_visible, _postcondition_template

replayer.py keeps every import it had. It goes from 17,872 to 16,830 lines (−1,042), and its budget is lowered to match.

Checks.

  • verify_moved_code.py against E5: 20 moved units, no edits, and no test patch to retarget.
  • Strict mypy passes across the stack.
  • These tests pass, 2,479 in all: test_import_surface.py, test_import_layers.py, test_fresh_imports.py, the generality test, test_replayer.py, and the typed-input, selected-option, postcondition, step-guard, predicate and text-value tests.

The branch uses the claude/ prefix, so protected-safety-review needs no separate author declaration.

Collisions. No open PR edits these methods.

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: c06b314

Unique versus approved #2463 (469d4010): 20 methods move AST-identical into Confirming (step gates, typed input, selected option, structural state, and postconditions). Replayer inherits QualificationFaultInjection, AssetsHealingAndEvidence, SettlingAndInterstitials, EffectChecks, Confirming and no longer defines those 20 methods; the mixins do not overlap. The host stub is TYPE_CHECKING only; the runtime mixin base is object. The size-ratchet budget for replayer.py is lowered 17872→16830, which matches the file. No unique test edits. I did not merge.

Residual: replayer.py keeps unused imports under # noqa: F401 after the move. That does not change behavior.

@abrichr

abrichr commented Nov 21, 2026 •

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Codex
Reviewed-Head: 9e7406e

This replaces my earlier approval. It missed an inherited regression in the public Replayer.recheck_deferred_readback method. This PR targets main, so it would ship that regression.

I checked method resolution and the defining module at this exact head. Replayer inherits the implementation from EffectChecks. Its annotations reference Workflow, Mapping and RuntimeParamScalar, all three imported only under TYPE_CHECKING. The defining effects.py is byte-identical to E5, where a fresh Python 3.12 interpreter raised NameError on typing.get_type_hints(Replayer.recheck_deferred_readback). The same call resolved on E4. E5 reproduction

Please carry E5’s runtime import fix and public API regression test into E6. The test should resolve the method through Replayer and check the annotation types. This fix applies across all application targets. My comparison of the 20 moved confirming methods still stands. I checked the inherited defect at source level and did not run a held-out application.

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: 9e7406e

Cross-vendor review by gemini-3.1-pro-preview. Codex was tried first and failed: the local CLI could not load its config, and with that worked around, it rejected every model for this account. The head moved from c06b3145 (Grok's APPROVE) to 9e7406e1 through merges only. The only runtime change those merges bring in is in runtime/effects/ui_readback.py, which none of the moved methods use. The other change is a test in tests/test_file_size_ratchet.py.

What was checked, against E5 head 05be872c for the part unique to this PR:

  1. AST identity. All 20 methods in Confirming (runtime/replay/confirming.py) match the Replayer originals exactly, and none is still defined on Replayer.
  2. Name resolution. Every module-level name the moved code uses resolves in confirming.py from the same source module as before. No TYPE_CHECKING-only name is used outside annotations, so no rare path can raise NameError.
  3. Test patches. Tests patch replayer globals in four places: identity_mod.* and time.sleep patch shared module objects, so they still apply. resolve, _DIALOG_WAIT_S and READBACK_DEADLINE_MARGIN_S are not used by the moved code. Replayer._typed_input_landed is patched on the class, which still takes precedence over the mixin. No safety test passes vacuously.
  4. MRO. Replayer(QualificationFaultInjection, AssetsHealingAndEvidence, SettlingAndInterstitials, EffectChecks, Confirming), and no method name is defined in two of these classes.
  5. Safety. No postcondition, typed-input, selected-option or step-gate check is removed or weakened, and nothing fails open.
  6. PR claims. replayer.py is 16,830 lines and its budget row in DECOMPOSITION.md is 16830. The original imports are kept, the now-unused ones under # noqa: F401.

Prior blockers: none. Grok's note about the noqa: F401 imports is not a blocker.

Blockers: none. CI was still pending when this was posted.

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

@codex review

Review rules for this repository:

  • Blockers are only: correctness bugs; fail-open paths (a check that passes when it should fail, missing or truncated evidence treated as success, an unbound subject, a permissive default, an unsafe URL or redirect); security problems; secrets; broken tests; and claims the code does not back up.
  • Everything else, including pre-existing code this diff does not change, goes under "Out of scope (follow-up)".
  • If an earlier review exists, review only the changes since it, and say whether each earlier blocker is fixed.
  • End with exactly one line: VERDICT: APPROVE or VERDICT: REQUEST CHANGES.

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