Skip to content

feat(settle): prototype an adaptive early exit behind an internal switch (off by default) - #4611

Open
thymikee wants to merge 8 commits into
mainfrom
t3/adaptive-settle-prototype
Open

thymikee wants to merge 8 commits into
mainfrom
t3/adaptive-settle-prototype

Conversation

@thymikee

@thymikee thymikee commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Summary

This is a prototype of an adaptive short confirmation for --settle, for review as is. It is off by default. It runs only when the daemon host environment sets AGENT_DEVICE_SETTLE_ADAPTIVE=1, which the daemon passes on as SettleParams.earlyExit: 'adaptive'. It adds no CLI flag and does not change the output shape. With the switch off, every path matches main; the loop refactor is behavior-neutral.

Flipping the default is not part of this PR. It needs:

  • the ADR 0011 settleObservation guarantee;
  • its interaction-guarantees.ts matrix cell;
  • the --settle help.

The rule (settle-adaptive-confirmation.ts):

  1. The first capture that differs from a fresh pre-action baseline gets one confirming capture 110 ms later.
  2. If that capture is equal and from the same producer/presented surface, settle.
  3. These conditions escalate to today's quiet window:
    • the two captures disagree;
    • a busy indicator is on screen (the classification from fix(open): wait for the launched app's first screen before the first capture #4513, now shared in kernel);
    • the presented surface changed;
    • the 1.5 s broad-replacement floor applies;
    • the capture holds the baseline beside a new screen (a transition union);
    • the baseline was not captured by this action, and the daemon does not report the session observation current. Current means: the frame is active, its tree is the newest observation, and nothing outdated it (wait text, Android freshness reads).
  4. If nothing differs from the baseline, the quiet window applies as today.

Deadlines, quality checks, private-AX recovery and diff output are unchanged.

The PR touches 20 files, including a test-only Settle lab fixture screen (agent-device-test-app://settle-lab).

Results

Each cell is N=15 (tab: 30), with 2.5 s post-checks (diff snapshot against the stored settled tree) and blocks rotated across arms.

  • on/off: pass 2, built at 3e048a7f7c.
  • main: pass 1, built at 244d1ff683.
  • Wrong: settled, but the screen changed afterwards.

iOS (iPhone 17 Pro sim, snapshot -i frame, bridge producer, 300 ms window)

scenario wall p50/p95 ms on · off · main settle wait p50 on · off captures on · off wrong on · off · main
counter 806/3080 · 1002/2628 · 1122/3625 221 · 417 2 · 2 0 · 0 · 0
fill 2913/3959 · 3084/4176 · 3289/5403 327 · 505 2 · 2 1 · 1 · 0
tab 1128/1170 · 1359/1562 · 1378/1610 293 · 497 2 · 2 0 · 0 · 0
push 1804/2292 · 1903/3063 · 1901/2256 935 · 968 3 · 3 0 · 0 · 0
back 1844/1985 · 2013/2262 · 1997/2500 476 · 658 2 · 2 0 · 0 · 0
open-automation 1582/1817 · 1605/2165 · 1692/2699 927 · 927 3 · 3 2 · 2 · 0
back-to-settings 1621/3686 · 1797/4041 · 1957/4550 269 · 475 2 · 2 0 · 0 · 0
sheet-present 1203/1307 · 1220/1333 · 1298/1633 518 · 518 2 · 2 0 · 0 · 0
sheet-dismiss 2414/2591 · 2428/2502 · 2503/3016 1680 · 1697 5 · 5 0 · 0 · 0
delay500 1187/1323 · 1354/1495 · 1407/1472 603 · 778 3 · 3 0 · 0 · 0
delay800 997/1331 · 1048/1298 · 1004/1134 418 · 435 2 · 2 15 · 15 · 15
overlay 805/837 · 1071/1634 · 1036/1134 225 · 442 2 · 2 15 · 15 · 15
stage-spinner 997/1382 · 1391/2256 · 1000/2485 418 · 812 2 · 3 14 · 6 · 10
stage-plain 827/1105 · 1067/2375 · 1043/1485 238 · 434 2 · 2 15 · 10 · 10
toast-nav 814/1560 · 1052/2959 · 1066/3162 226 · 435 2 · 2 15 · 14 · 13

Android (API 37 AVD, full snapshot frame, helper, 500 ms window)

scenario wall p50/p95 ms on · off · main settle wait p50 on · off captures on · off wrong on · off · main
counter 542/1034 · 780/1124 · 901/1276 233 · 540 2 · 3 0 · 0 · 0
fill 694/1185 · 1044/2695 · 1249/1851 214 · 560 2 · 3 0 · 0 · 0
tab 1523/2239 · 1856/3021 · 1635/2473 972 · 1264 4 · 3 0 · 0 · 0
push 958/2972 · 1270/2412 · 1361/1956 678 · 1007 3 · 4 0 · 0 · 0
back 1005/1824 · 1392/2879 · 1381/1512 791 · 1175 3 · 4 0 · 0 · 0
open-automation 1024/2427 · 1414/1790 · 1474/1982 779 · 1155 3 · 4 0 · 0 · 0
back-to-settings 968/1689 · 1321/2020 · 1356/1735 743 · 1096 3 · 4 0 · 0 · 0
sheet-present 806/1112 · 1225/1449 · 1454/2124 566 · 971 3 · 4 0 · 0 · 0
sheet-dismiss 587/754 · 1003/1196 · 1131/1875 342 · 731 2 · 3 0 · 0 · 0
delay500 1008/1248 · 804/1546 · 1344/1933 752 · 545 4 · 3 2 · 8 · 3
delay800 775/959 · 777/1615 · 796/906 536 · 538 3 · 3 15 · 14 · 15
overlay 675/819 · 828/1650 · 1126/2180 321 · 561 2 · 3 15 · 12 · 10
stage-spinner 825/1600 · 853/1547 · 1486/1689 582 · 578 3 · 3 12 · 9 · 6
stage-plain 469/697 · 1059/1997 · 804/1657 228 · 570 2 · 3 15 · 8 · 11
toast-nav 687/719 · 810/1854 · 865/2076 456 · 554 3 · 3 15 · 8 · 10

Delayed effects with an immediate acknowledgement (re-measured at 7dad132c87 after review). The Settle lab now shows a "Run N" marker as soon as an action starts, so these cells measure "acknowledgement now, result later". In the tables above, the delay500/delay800 rows measured "no change, then a late change".

platform scenario wall p50/p95 ms on · off settle wait p50 on · off wrong on · off
iOS delay500 812/3506 · 1362/4003 230 · 784 15 · 0
iOS delay800 811/907 · 1001/1066 231 · 425 15 · 15
Android delay500 483/740 · 1504/1793 234 · 1266 15 · 2
Android delay800 472/711 · 1703/1794 228 · 1464 15 · 6

The early exit settles on the acknowledgement every time. Today's window still catches a 500 ms result on iOS, and most Android results.

Checkout flow (10 steps, 9 settled; N=15; p50/p95 total):

  • iOS: on 25.6/29.1 s, off 27.5/36.2 s, main 27.5/32.4 s.
  • Android: on 11.9/21.2 s, off 14.9/21.1 s, main 16.2/18.0 s.

Which escalations mattered:

  • Transition union. Pass 1 (210c5b1f6f) ran without it. There, iOS stack pushes settled mid-transition: 9/15 and 14/15 wrong, versus 0/15 for off. With it, both match off.
  • Frame currency. In pass 1, Android never armed: selector resolutions run in a different view than a full-snapshot frame.
  • Presented surface and broad floor. These keep the sheet cases at today's latency.
  • Busy indicator. It blocks the early exit but cannot lengthen today's window. The 600 ms spinner plateau beats 300/500 ms in every arm.

What the rule makes worse: an action that acknowledges immediately and finishes later (above) is always wrong with the switch on. Also, unmarked multi-stage effects go from often wrong to always wrong. These are the plain intermediate step, toast-then-navigate, and the fading overlay. Today's rule already misses them 8–15/15 times, as it does delay800.

Recommendation

Don't flip the default yet.

  • For single-stage effects (in-place, fill, tab, push, back, sheet), the rule saves ~200 ms (iOS) and ~300–400 ms (Android) of settle wait. On those it adds no wrong settles.
  • Both producers gain, so a per-producer default isn't justified.
  • Next steps before a default:
    • a busy-indicator hold (wait for it to leave);
    • a run on real apps.

A default change would need these updates (none are in this PR):

  • the ADR 0011 settleObservation guarantee;
  • the interaction-guarantees.ts matrix cell;
  • the --settle help and docs;
  • settle-observation.test.ts;
  • the TS/Swift parity table, if required.

Validation

  • The touched suites pass. Each escalation was mutation-checked.
  • Failing-first tests:
    • the @ref freshness test fails on 9492f88;
    • the requested-window floor test (quietMs: 2000) fails with the c423b99 guard.
      Both pass at the head.
  • Typecheck passes.
  • Measured on the iPhone 17 Pro simulator and the API 37 AVD; 1-minute load averages ranged from 5 to 86.
  • Caveats:
    • Android snapshot -i hides text, so Android uses full snapshots.
    • In the measured bundle, the overlay was laid out in flow; this is fixed in source.
    • The freshness fixes after the runs (9492f88, and observationCurrent at 421179e5d6) change only flows after wait text or after a newer observation, which the benchmark never takes.
  • CI at 8d80138216 was green (18 checks). The unrelated wait-target dedupe moved to refactor(wait): type the wait command target with the contracts DaemonWaitTarget #4618.
  • Device smoke lanes run once the PR is ready for review.

🤖 Generated with Claude Code

@apex-sentinel-staging

apex-sentinel-staging Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 0 still open · 1 no longer raised (1 marked fixed)

No open findings.

Reviewed with this repository's own Sentinel configuration (a30accf38081).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

Earlier reviews

Review of 7dad132c · 16.11.2026 23:21 UTC

Apex Sentinel · ✅ Approve

Since the last review: 1 new · 0 still open · 0 no longer raised

1 finding(s): 1 minor.

🟡 Minor (1)

Where Finding
packages/command-runtime/src/commands/interaction/runtime/settle-adaptive-confirmation.ts:47 🆕 Adaptive exit settles replacements in the 0.5–0.8 retained band that neither rule catches

Reviewed with this repository's own Sentinel configuration (a30accf38081).

Review of 74425371 · 16.11.2026 23:08 UTC

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 0 still open · 0 no longer raised

No open findings.

1 new finding away from what changed since 8d80138 not shown. Comment @apex-sentinel-staging review for a full review.

Reviewed with this repository's own Sentinel configuration (a30accf38081).

Review of 8d801382 · 16.11.2026 21:37 UTC

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 0 still open · 1 no longer raised (1 marked fixed)

No open findings.

1 new finding away from what changed since c423b99 not shown. Comment @apex-sentinel-staging review for a full review.

Reviewed with this repository's own Sentinel configuration (a30accf38081).

Review of c423b993 · 16.11.2026 21:25 UTC

Apex Sentinel · ✅ Approve

Since the last review: 1 new · 0 still open · 0 no longer raised

1 finding(s): 1 minor.

🟡 Minor (1)

Where Finding
packages/command-runtime/src/commands/interaction/runtime/stable-capture.ts:285 🆕 floorInForce misses a confirmed broad replacement when the requested window already exceeds 1.5 s

1 finding below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (a30accf38081).

Review of 421179e5 · 16.11.2026 21:12 UTC

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 0 still open · 0 no longer raised

No open findings.

1 finding below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (b13b016e9bc1).

Review of 9492f880 · 16.11.2026 19:31 UTC

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 0 still open · 2 no longer raised

No open findings.

Reviewed with this repository's own Sentinel configuration (ea414582b7fa).

Review of 3e048a7f · 16.11.2026 18:45 UTC

Apex Sentinel · ✅ Approve

2 finding(s): 2 minor.

🟡 Minor (2)

Where Finding
packages/kernel/src/snapshot.ts:576 isBusyIndicatorNode adds a 'progressbar' role that showsFirstScreen used to allow
packages/daemon/src/execution/interaction/internal/interaction-flags.ts:42 refFrameCurrent ignores an observation the daemon marked outdated, so adaptive settle fires early

2 findings below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (ea414582b7fa).

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 2 new findings on 3e048a7. The verdict and the full list are in the summary comment.

Comment thread packages/kernel/src/snapshot.ts Resolved
@thymikee

Copy link
Copy Markdown
Member Author

I found one defect at 9492f88: with AGENT_DEVICE_SETTLE_ADAPTIVE=1, the @ref route can settle early on a screen that is still about to change. CI is green (6 checks, none failing), but main CI has not run on this draft. The branch has merge conflicts with main, so checks will rerun after the rebase.

Repro by code reading: run snapshot -i, then wait text 'Loaded', then press @e3 --settle. findText marks the snapshot outdated (selector-runtime-backend.ts:256) while the frame stays active. readSettleRequest correctly sends refFrameCurrent=false. But resolveSettleBaseline still picks the loading-screen frame as the baseline and marks it fresh through baseline === refFrame (line 279). The ref route's resolved.preAction is also the stored frame, not a capture, so baseline === resolved.preAction would mark it fresh too. The first post-action capture differs from that stale baseline, and a second capture 110 ms later agrees before the action has rendered. The loop then settles on a pre-effect screen, and the diff and refs describe that screen. The same happens on Android when a freshness capture advances the observation past the frame (reconcileFreshObservation). This is the case the PR says it escalates, and it skews the prototype's measurements for any flow that waits on text before a ref press.

The rule to satisfy: a baseline counts as fresh only if this action's own resolution captured it, or if the daemon reports the session observation current (frame active, frame tree and stored snapshot not outdated, no newer observation). Please apply that to every baseline candidate in resolveSettleBaseline, including both @ref candidates. Please also add a ref-target test with refFrameCurrent: false that asserts waitedMs is at least the quiet window. It should fail on this head.

Not blocking, and you can take or leave these: the outdated-frame tests in settle-adaptive-confirmation.test.ts:205 cover only a selector press, and the helper comment at lines 47-48 ('the stored tree is the fresh baseline') is the assumption above; isTransitionalUnion (settle-adaptive-confirmation.ts:85) repeats the shared-identity count in stableCaptureSignalsHaveBroadReplacement, which could be one exported sharedIdentityCount; SettleParams.confirmation: 'adaptive' (interaction.ts:309) reuses the word confirmation that the stable-capture loop already uses for its broad-transition floor, so a name like earlyExit: 'adaptive' may read better; and the baseline-freshness rule is computed in three places (interaction-flags.ts:29-37, generic-settle.ts:106, and resolveSettleBaseline), which is where they disagree.

Could one predicate replace those three? Keep the rule module as is, and have the daemon compute one fact, observationCurrent = isRefFrameCurrent(session), in readSettleRequest and pass it to both routes. On the generic route, use baselineFresh = baseline === stored && observationCurrent. In command-runtime, have postActionBaseline report which candidate answered, as {source: 'action-capture' | 'frame' | 'stored'}, so baselineFresh = source === 'action-capture' || observationCurrent. That fixes the defect by construction and removes the baseline.nodes === frame.nodes identity check. Nothing has to change first for the prototype. Flipping the default still needs the ADR 0011 settleObservation guarantee, the interaction-guarantees.ts matrix cell, and the --settle help, as the PR body already lists.

The two inline threads from the earlier review no longer apply, so please resolve them. The progressbar thread was withdrawn correctly: showsFirstScreen runs only for Apple sessions, and Apple node.type never formats to progressbar. The outdated-frame thread is fixed at this head, because isRefFrameCurrent now checks isOutdatedObservation. The same hazard on the @ref branch is the defect above.

The live runs were at 3e048a7, and by diff the 9492f88 delta affects only flows after wait text. The defect comes from tracing readSettleRequest, resolveSettleBaseline and runStableCaptureLoop, not from a device run.

Before merge, please make the @ref baseline respect refFrameCurrent with the failing-first test, then rebase onto main.

thymikee and others added 2 commits November 16, 2026 22:02
Deep link agent-device-test-app://settle-lab. Each button starts one effect
with a known final screen: an in-place counter, 500/800 ms delayed results,
a fading overlay, two-stage transitions with and without a spinner, and a
toast that precedes navigation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A capture that differs from a fresh pre-action baseline settles once one
confirming capture ~110 ms later agrees with it. A disagreeing pair, a busy
indicator, a producer or presented-surface change, the broad-replacement
floor, a capture that holds both screens of a transition, or a baseline
the action did not capture while the daemon reports the observation not
current keep today's quiet window. The daemon enables it only when its
host environment sets AGENT_DEVICE_SETTLE_ADAPTIVE=1; default off, no flag
or output change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee
thymikee force-pushed the t3/adaptive-settle-prototype branch from 9492f88 to 421179e Compare November 16, 2026 21:04
@thymikee

Copy link
Copy Markdown
Member Author

Fixed in 421179e, after a rebase onto main at b13b016. The branch is squashed into two commits: the runtime change and the test-app fixture.

Defect. The daemon now computes one fact, observationCurrent, in readSettleRequest. It is true only when the ref frame is active, its tree is the session's newest observation (session.snapshot === refFrameTree), and that tree is not outdated. Both routes use it for every baseline this action did not capture itself.

  • Command runtime (resolveSettleBaseline): baselineFresh = actionCapture || observationCurrent. Here actionCapture means resolved.kind !== 'ref' && baseline === resolved.preAction, i.e. a selector resolution or a point evidence read. A ref's preAction is the stored frame, so it no longer counts as fresh. The baseline === refFrame and baseline.nodes === frame.nodes checks are gone.
  • Generic route: baselineFresh = baseline === stored && observationCurrent. Its own isOutdatedObservation check is gone.

Fail/pass evidence for the new test, an @ref press on the stored frame: a frame the daemon reports outdated keeps the quiet window (ref target, stored frame as baseline, observationCurrent: false):

  • 9492f88 with only the test added: FAIL … AssertionError: 110ms (1 failed, 13 passed). The press settled after one 110 ms confirmation.
  • 421179e: passes. Settle waits at least the 500 ms quiet window.
  • The daemon side has a new test too: a newer observation than the frame (the Android freshness case) is not current.
  • Focused suites at the head: 244 files, 2288 tests pass. Typecheck is clean.

Non-blocking notes, all taken:

  • The switch is renamed to earlyExit: 'adaptive'.
  • isTransitionalUnion and stableCaptureSignalsHaveBroadReplacement now share an exported sharedIdentityCount.
  • The test helper comment now says the ref baseline is fresh because the daemon reports the observation current. The ref-route helper passes observationCurrent: true.
  • I kept the source decision local to resolveSettleBaseline. postActionBaseline is unchanged, so the generic route's capture-kit call is unchanged.

Rebase conflict: one, in showsFirstScreen (#4601). It keeps main's text-count logic and uses the shared isBusyIndicatorNode.

Measurements: the live runs were at 3e048a7. The measured paths are unchanged: iOS selector presses use the action capture; Android presses and back follow a fresh snapshot, so the observation is current. Only flows after wait text, or after a newer observation, behave differently.

CI: this is a draft, so CI may not run the main unit and integration lanes. I'll report what runs.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.33 MB 6.33 MB +3.6 kB
Package (unpacked) 6.33 MB 6.33 MB +3.6 kB
Package (download) 1.92 MB 1.92 MB +1.4 kB

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 34.3 ms 30.5 ms -3.8 ms
CLI --help 71.1 ms 58.5 ms -12.6 ms

…and the loop under threshold

Load the adaptive module only when a settle asks for it, fold one capture's
quiet-window and early-exit decisions into observeStableCapture, and name
the capture presentation. The wait command reuses the contracts
DaemonWaitTarget instead of a copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on c423b99. The verdict and the full list are in the summary comment.

…placement under any window

The guard compared the required window with the requested one, so a
requested window at or above the 1.5 s floor hid a confirmed broad
replacement. The broad-transition confirmation now reports its latch,
and the adaptive rule keys on that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

This PR is ready at 8d80138. Both earlier concerns are fixed: the confirmation now keys off the latch instead of requiredQuietMs > quietMs (the quietMs: 2000 test covers it), and both routes share one freshness check. Not blocking: c423b99 also swaps WaitCommandOptions.target for the contracts DaemonWaitTarget in selector-wait.ts, which is a dedupe unrelated to the settle prototype, so you can keep it or move it to its own small PR.

The checks show 18 reported and none failing at 8d80138, and there are no conflicts. The earlier live runs were at 3e048a7, and the delta only touches the switch-on paths plus a loop refactor that reads as behavior-neutral with the switch off.

Of the open inline threads, the freshness-check one and the observation-current one are fixed at this head, and you can resolve them. The first-screen progressbar one does not apply, because that check runs only for Apple sessions and Apple nodes never format to progressbar. You can resolve it too.

Nothing else blocks the prototype. Before the default can flip, the PR needs the ADR 0011 settleObservation guarantee, the interaction-guarantees.ts matrix cell and the --settle help.
This is still a draft, so please mark it ready for review when you want it labeled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee thymikee changed the title feat(settle): prototype an adaptive short confirmation (internal switch, default off) feat(settle): prototype an adaptive early exit behind an internal switch (off by default) Nov 16, 2026
@thymikee
thymikee marked this pull request as ready for review November 16, 2026 23:00

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 20 files

You’re at about 98% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

thymikee and others added 2 commits November 17, 2026 00:14
…an early exit held

The adaptive early exit now keeps the quiet window when a capture reads
another iOS system surface than the baseline, and the settle reports the
quiet span its confirming pair held instead of the full window. Covers
the adaptive switch on the press/click/longpress and generic routes, and
the window fields surviving the opt-in branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ired timers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on 7dad132. The verdict and the full list are in the summary comment.

…t judged a broad replacement

A rootless read after a non-presented baseline fails the broad-transition
gate, so the latch stays an open question that a later rooted capture can
still confirm. The adaptive rule now asks the shared broad-replacement
predicate against the baseline in that state and escalates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

This PR is ready at 8142f91. The two earlier gaps are fixed: an unruled latch no longer exits early, and a surface-bundle change (including an iOS system surface) now disarms the early exit. CI is green, with 19 checks and none failing, and I found no code problems. No conflicts.

Not blocking, and you can take or leave these: surfaceBundleChanged in settle-adaptive-confirmation.ts repeats the baseline-vs-capture surface comparison that resolvePostActionSurfaceChange already owns, so disarming on resolvePostActionSurfaceChange(baseline, surfaceScopedNodes(snapshot)) !== undefined would let you delete it. The module doc at line 13 and the PR body rule list do not yet name the two new escalations (iOS system-surface change, and an armed latch that has not ruled on a broad replacement), and the body still says 20 files where the diff has 23.

The inline threads on the press/click/longpress forwarding tests (#4611 (comment)), heldQuietMs reporting (#4611 (comment)), the adaptive generic-settle tests (#4611 (comment)), surface-bundle disarm (#4611 (comment)), the lab screen run cells (#4611 (comment)), the flags test (#4611 (comment)), the timer cleanup (#4611 (comment)) and the unruled-latch note (#4611 (comment)) no longer apply, because each is fixed at this head; please resolve them. The 0.5-0.8 band half of the last one is benign, since main does not latch there either.

The PR-body measurement tables predate 5b81888 and 8142f91; those commits only add disarm conditions on the switch-on path, so they can only lengthen switch-on waits, but the tables were not re-measured at head. A device run would confirm that a real SafariViewService sheet capture carries iosSystemSurfaceBundleId while the stored baseline does not.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 17, 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

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant