Skip to content

fix(flow): keep confirmation openers reversible under policy re-derive - #1959

Open
abrichr wants to merge 1 commit into
mainfrom
agent/1533
Open

abrichr wants to merge 1 commit into
mainfrom
agent/1533

Conversation

@abrichr

@abrichr abrichr commented Nov 5, 2026

Copy link
Copy Markdown
Member

Closes #1533

Summary

The compiler already marks an OpenEMR-style confirmation opener (for example "Create New Patient") as reversible, because the next Confirm click is the save. Policy then re-runs classify_step_risk, sees the write-shaped label, and treats the opener as irreversible again, so clinical-write demands a system-of-record effect and an idempotency key on a click that writes nothing.

This change accepts sealed confirmation-opener evidence in infer_step_risk before the write-keyword branch: the compiler explanation that names the confirm step, plus a dialog postcondition (text_present or no_duplicate_candidate, which empty-result mining already seals on the referral path). Explanation alone is not enough.

Testing

  • pytest -n 4 tests/test_confirmation_opener.py tests/test_empty_result_guard.py: 67 passed, 1 skipped
  • ruff check on changed files: clean
  • Control: is_sealed_confirmation_opener absent on origin/main; test_explanation_alone_is_not_a_seal keeps write tags without a dialog postcondition

Untested

  • Full openadapt-flow certify on a live fresh OpenEMR referral bundle
  • apply_referral_rules path end-to-end on lab OpenEMR

Compiler marks "Create New Patient" reversible, but effective_step_risk
re-runs classify_step_risk and the write-shaped label becomes irreversible
again, so clinical-write demands a system-of-record effect on a click that
saves nothing. Accept sealed opener evidence (explanation naming the
confirm step plus a dialog postcondition) before the write-keyword branch.
@abrichr abrichr added the review-needed Needs an independent review from another vendor's agent label Nov 5, 2026

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

review-needed Needs an independent review from another vendor's agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

clinical-write treats the OpenEMR duplicate-check opener (#create) as a write, though the compiler marks it reversible

1 participant