Skip to content

fix(jit): lift a retyped input from the saved record; distill drops a corrected save - #1336

Merged
abrichr merged 2 commits into
mainfrom
claude/jit-lift-repeated-input
Oct 19, 2026
Merged

abrichr merged 2 commits into
mainfrom
claude/jit-lift-repeated-input

Conversation

@abrichr

@abrichr abrichr commented Oct 19, 2026

Copy link
Copy Markdown
Member

Fixes #1328.

Problem

In the scoreboard's OpenEMR run (arm 2, 2026-10-18-a) the agent typed Female into Gender Identity, pressed Create New Patient, got "Birth Sex is not valid", typed Female into Birth Sex and pressed Create again. lift_params gave up on sex ("typed in 2 steps"), so admission failed at --accept-params. Distill kept all 39 steps, so the program would also write Gender Identity and press Create once for nothing (that click also left a placeholder effect, which admission refuses).

Change

Lift (jit/lift.py). An input typed whole in more than one step is lifted at the step whose field the mined record check holds it in. Field names are compared whole after dropping a leading # and form_, so form_sex matches the record field sex and form_sex_identified does not. The proposal lists the other steps in also_typed_in; they still type the demonstrated text. It fails closed and names the steps when:

  • there is no mined record check (a placeholder doesn't count),
  • the saved record holds the value in no field, or
  • none, or more than one, of the steps writes a field that holds it.

Distill (compiler/distill.py). There's a new correction rule. It needs the system-of-record snapshots.

  • save_retried: a click on a write-labelled control with no record change and the same URL, title and page count, when the same control is pressed again later, nothing was written before then, and something was typed in between.
  • entry_corrected: inside such a correction, a literal typed before the refused save and retyped into a different field between the two saves is dropped, with its focus click and the Enter after it. This happens only when the record the run saved holds the value under the second field's name and has no field named like the first. Otherwise both entries stay.

Evidence

On the recorded OpenEMR run (from #1303, replayed offline, no model calls):

  • distill: 39 → 35 steps. It drops 9 (click Gender Identity), 10 (type), 11 (Enter) as entry_corrected and 31 (the refused Create) as save_retried.
  • lift on the original bundle: sex → step_034 (form_sex), also_typed_in: [step_010].
  • openIMIS launch-4: nothing dropped.

Tests

Synthetic fixtures shaped like the OpenEMR evidence:

  • tests/test_distill.py: the correction, plus each condition that keeps both entries: the record has the first field, the record lacks the value, no refused save, the refused save wrote, nothing typed between the saves, no snapshots, and a parameter in the first field.
  • tests/test_jit.py: lift binding, the four fail-closed reasons, and a placeholder ignored.

pytest tests/test_jit.py tests/test_distill.py: 73 passed. test_authoring.py -k distill passed. I didn't run the full suite because of host load.

No new command, so CAPABILITIES.md doesn't change. docs/JIT.md (Pruning, Parameters) is updated.

🤖 Generated with Claude Code

… corrected save

An agent that types a run input into the wrong field, gets a validation
error, and types it into the right field left the input unlifted ("typed in
2 steps") and the detour in the program (#1328).

- lift_params: an input typed whole in more than one step is lifted at the
  step whose field the mined record check holds it in. The other steps are
  listed in also_typed_in. No record check, no holding field, or several
  holding fields: not lifted, and the reason names the steps.
- distill: a save the app refused (write-labelled click, record unchanged,
  same page), pressed again after a correction, is dropped (save_retried).
  A literal typed before the refused save and retyped into another field is
  dropped with its focus click and Enter (entry_corrected), only when the
  saved record holds the value under the second field's name and has no
  field named like the first.

On the scoreboard's recorded OpenEMR run this drops steps 9-11 (Gender
Identity) and 31 (the refused Create) and lifts sex at Birth Sex.

Closes #1328

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@abrichr
abrichr merged commit 3dc33df into main Oct 19, 2026
40 checks passed
@abrichr
abrichr deleted the claude/jit-lift-repeated-input branch October 19, 2026 16:45
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.

JIT lift: a run input typed in two steps (agent detour) is never lifted; distill keeps the detour

1 participant