You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9f98fc7
Browse filesBrowse the repository at this point in the historyBrowse files
An agent that hits a scrollable form section gets correctly rejected for
targeting an off-screen element, but the recovery hint didn't name a
concrete next move. Its "obvious" retry — re-issue the same @ref after
scrolling — is exactly what both live guards reject: the off-screen guard
still sees it off-screen, and the scroll expired the ref frame (ADR 0014),
so the @ref is refused as stale. Two bootstrap-bench runs burned all 60
turns on a single checkout-form screen this way (arm-independent).
Make the rejection self-sufficient for recovery instead of relaxing either
guard:
- Off-screen selector/ref rejection now names the exact scroll direction
(computed from the target rect vs its effective viewport) and steers the
retry to a *selector*, which re-resolves against a fresh snapshot and
bypasses the ref-frame admission guard entirely. The direction is also
surfaced as a machine-readable `scrollDirection` detail.
- `scroll`'s unknown-direction error now carries a grammar hint, since the
transcripts show agents mis-shaping it as `scroll @ref down` — scroll
takes a direction and no target.
New geometry helper `classifyOffscreenScrollDirection` maps a rect +
viewport to the reveal direction (largest-overshoot axis), following the
same convention the CLI off-screen summary already uses.
Both guards keep their exact rejection semantics and messages; only the
hints and one added detail field change.
hint: 'scroll takes a direction first, then an optional amount: scroll <up|down|left|right|top|bottom> [amount]. It takes no @ref or selector — scroll the whole viewport, then retry the target with a selector.',
hint: `The element is outside the visible viewport — likely inside a closed drawer, another tab, or scrolled content. Scroll toward it or open its container, take a fresh snapshot, then retry ${action}.`,
702
+
// A selector re-resolves against a fresh snapshot on every attempt, so the
703
+
// recovery is just: scroll the named direction, then retry THIS selector —
704
+
// no separate snapshot step, and no @ref (a scroll expires the ref frame,
705
+
// #1366). Naming the direction stops the wrong-way / retry-the-same-ref loop.
706
+
hint: (direction)=>
707
+
`${scrollRevealClause(direction)}, then retry ${action} with the same selector — a selector re-resolves against a fresh snapshot, so no separate snapshot is needed. If it is inside a closed drawer or another tab, open that container first.`,
701
708
});
702
709
}
703
710
@@ -710,10 +717,23 @@ function assertVisibleRefTarget(
710
717
throwIfOffscreenInteractionTarget(node,nodes,{
711
718
message: `Ref ${refInput} is off-screen and not safe to ${action}`,
hint: `Use scroll with the direction from the off-screen summary, take a fresh snapshot, then retry ${action} with the new ref or a selector.`,
720
+
// The scroll that reveals the target expires the ref frame (#1366, ADR
721
+
// 0014), so retrying this @ref would be rejected next. Steer to a selector,
722
+
// which re-resolves against a fresh snapshot and bypasses the ref-frame guard.
723
+
hint: (direction)=>
724
+
`${scrollRevealClause(direction)}, then retry ${action} with a selector (e.g. text=/id=) rather than this @ref — the scroll expires the ref frame, so re-run snapshot -i before reusing any @ref.`,
714
725
});
715
726
}
716
727
728
+
// Shared lead-in for both off-screen hints. Names the concrete `scroll <dir>`
729
+
// when the geometry gives one, and falls back to the container-aware phrasing
730
+
// when the target is off more than one edge in a way that has no single reveal.
0 commit comments