Repository navigation
Engine: when the node budget cuts, keep what the window shows (visible-first walk) - #306
Conversation
…he window shows, printed in document order (refs #301) Decision Log entries for ruling aed3f041: the two-pass walk (visible-first selection, document-order emission, the re-fetch in the same order), when to seed and its price, id stability across a scattered cut, the truncation marker and Chromium's strips, the 500 ms cap and the timings, and the width rule's omitted branch in the guard's record only; the Observation paragraph, the Indexes paragraph and the Skyshot interface amended. Sminos-Session: cursor235#b93055dd (cua on macbook)
…ws, seeded by hit-tests on Chromium, and says what it left above and below (refs #301) The walk reads visible-first (frames order it; on Chromium, once the read elements and the children they name exceed the budget, hit-test chains on an 80-pt grid seed it, capped at 500 ms inside the deadline) and emits in document order, so an uncut walk is the plain preorder, tokens included. Every unread child of a read element is carried over in its place, so tokens survive a cut that moves with the scroll. truncated gains above and below, rendered as '[truncated: at least N elements omitted: A above the visible area, B below it, C elsewhere]', and the first-call document's macOS paragraphs gain a fourth saying so. The width rule's omitted branch keeps its shown rows and their subtrees in the guard's record only. The re-fetch walks in the same order. Timings: seedMs and its counts, recordOnlyNodes. Sminos-Session: cursor235#b93055dd (cua on macbook)
…wice (refs #301) Sminos-Session: cursor235#b93055dd (cua on macbook)
… the deadline, and the re-fetch clips as the walk does (refs #301) From the review of 1abb734: the omitted branch's frame search is bounded by the deadline and by the children it reads; the search and the record-only reads run once the tree's selection is done, so a screenshot never changes the printed tree; the re-fetch walk carries its ancestors' clip, so it does not spend its budget on what a scroll area hides. Tests for each; the spec's #301 entries amended. Sminos-Session: cursor235#b93055dd (cua on macbook)
…he seeding's trigger counts distinct elements (refs #301) From the review of c4057c3..effffce: the per-walk description cache keeps the answer asked for the earliest element in the preorder, resolved at emission, so reading a visible sibling first no longer changes any node; the trigger counts distinct handles, so children shared by several parents (a table's cells under rows and columns) no longer seed a walk under the budget. The uncut test compares whole payloads; tests for both; the spec's #301 entries amended. Sminos-Session: cursor235#b93055dd (cua on macbook)
… budget for every node it changes, and refused past it (refs #301) From the re-review of effffce..ab0e019: an earlier element's longer answer, swapped in at emission for nodes already selected, could take the tree past the 6 MiB budget and the 8 MiB frame. The selection now charges the difference per node using the name and refuses a replacement that would not fit; an uncut walk never refuses one, so it stays the preorder's. Test and spec entry amended. Sminos-Session: cursor235#b93055dd (cua on macbook)
…iptions near the byte budget (refs #301) From the re-review of ab0e019..9bbbacc, ruled doc-only: when the same action names in one process answer differently per element and one name's growth must wait for another's shrink near the byte budget, the growth is refused and the later-in-preorder answer shows. The spec's claim that an uncut walk never refuses one is corrected, Walk.swift's comment with it, and the fix is logged under Open in tech-debt-tracker.md. Sminos-Session: cursor235#b93055dd (cua on macbook)
…nd check a collapsed container's cut children container-only (refs #301) Ruling 66f90453 on the hosted A/B (run 42231389508): the guard checked 100% of points on every cut page in Chrome and Safari, and seedPromoted was 0 in 56 of 56 rows at a p95 of 250 ms. Removed: the trigger and its distinct-element count, the hit-test grid and cap, the source's hit-test and parent seams, the seed timings and the seeding's tests. The stated limit replaces the grid's: a visible control under a container reporting a collapsed (1-pt) frame can still be cut (#304); its test found the guard's record treating a strip-framed container as framed, so a hit under it refused as interactiveHit, and screenshotNodes now counts such a node as frameless, checking the point container-only. The spec's #301 entries revised: the when-to-seed and cap entries superseded, a new entry for 66f90453 with the A/B's numbers, and the limits of #303's re-created Chromium columns and header groups and the read failures they cause. Sminos-Session: cursor235#b93055dd (cua on macbook)
…d which way the omitted lie, and the macOS paragraph states the new limits (refs #301) Ruling 66f90453: '[truncated: at least N elements omitted, above the visible area]', 'below the visible area' or 'above and below the visible area', a part placed neither way counting in the total with no direction. The fourth paragraph of docs/cua-api/agent-cursor.md drops the 80-pt grid and states the collapsed-container limit (#304) and Chromium's re-created table columns and headers (#303); docs-oracle, the core-documentation test and the surface inventory follow. Sminos-Session: cursor235#b93055dd (cua on macbook)
… to its parent in the guard's record (refs #301) From the re-review of 4e73574..b268504: a 1-pt scroll area or page-scrolling group clips its children to itself, so its missing children are its own; counting them against the parent had passed a new button elsewhere in the window as unrecordedDescendant. screenshotNodes now uses clipsDescendants, the predicate the walk cuts by, to tell a collapsed container from a clipping strip. A test for the clipping strip (interactiveHit); the collapsed-container test stays unrecordedDescendant; each fails with its half removed. Spec sentence amended. Sminos-Session: cursor235#b93055dd (cua on macbook)
…s parents pass through it (refs #301) From the re-review of b268504..c36c3c8 and the coordinator's ruling: the role cannot tell a collapsed container from a clipping strip (Chromium clips by overflow, so a 1-pt AXList can clip), so the guard stops inferring clipping. screenshotNodes keeps main's completeness rule and marks strips whose children the record lacks (thinGap); a verdict that would refuse an interactive hit, or an element route's target, reads that element's parents and passes it as unrecordedDescendant only when they run through such a strip. The clipsDescendants use added in StalePoint is gone. Tests: the hit under the collapsed container passes; an AXScrollArea strip and an AXList strip each with a new button elsewhere refuse (interactiveHit, pressedOther); each fails with its part of the rule removed. Spec sentence amended, with the climb's cost. Sminos-Session: cursor235#b93055dd (cua on macbook)
…ed subtree (refs #301) From the re-review of c36c3c8..9f5a045: every incomplete strip in the record counted, so a new button under a collapsed group, covering a fully recorded button there, passed as unrecordedDescendant on the coordinate path and the element route. screenshotNodes now gives each node the thin gaps of its recorded subtree (gapsBelow), and both verdicts consult only the chosen node's. The reviewer's case refuses on both paths and fails without the scoping; the collapsed-container test still passes. Spec sentence amended. Sminos-Session: cursor235#b93055dd (cua on macbook)
…without seeding, re-created Chromium columns) (refs #301) Sminos-Session: cursor235#b93055dd (cua on macbook)
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…uncation marker's wording (refs #301) Sminos-Session: cursor235#b93055dd (cua on macbook)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5954c4115d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| private func childClip(_ item: Selected) -> CGRect? { | ||
| guard let clip = item.clip else { return nil } | ||
| guard clipsDescendants(role: item.read.data.role, actions: item.read.actions), let frame = item.read.data.frame else { return clip } | ||
| return clip.intersection(frame) |
There was a problem hiding this comment.
Reset inherited clipping at popover and menu boundaries
When an AXPopover or AXMenu is nested under a scroll area but extends outside that area's frame, this intersection incorrectly carries the scroll area's clipping into the popup. screenshotNodes explicitly resets clipping at clipBoundaryRoles, and StalePointTests.testTheRecordCutsFramesByClippingAncestorsAndTakesTheDeepestNode already establishes that popup contents outside the enclosing scroll area remain visible. The new selection instead defers those visible contents, so another large subtree can exhaust the budget before they are read, dropping popup controls that the previous preorder reached. Reset clipping at these boundaries in both selection and the corresponding re-fetch traversal, and ensure the boundary itself is not deferred solely because it lies outside its ancestor's clip.
Useful? React with 👍 / 👎.
…every spot, so each refusal is seen on both heads; the report script Sminos-Session: cursor235#b93055dd (cua on macbook)
Summary
When a window's accessibility tree is larger than cua's 4,000-node budget, the engine now spends that budget on what the window shows, not on the top of the document. Before this, on long pages scrolled a quarter or more down:
The printed tree stays in document order. When the budget cuts, the tree says so and says which way the omitted elements lie. The budget is cua's own; the vendor has none, so this moves cua closer to the vendor's full tree. An observation the budget doesn't cut reads, prints and numbers exactly what main does.
Closes #301
The rule
The design session's rulings are aed3f041 and 66f90453, and the spec's #301 Decision Log entries hold the full text.
[truncated: at least N elements omitted, above|below|above and below the visible area]. The count is a lower bound. A part placed neither way counts in the total without a direction. The first-call docs and their mirrors (docs-oracle, core-documentation, the surface inventory) carry the wording.interactiveHit; this branch reads it container-only.Limits
Live proof (GitHub-hosted macOS runners, 2 reps, no clicks posted)
Evidence is in
docs/evidence/2026-11-06-visible-first/.The guard's share of clickable points checked, main against the branch without seeding (https://github.com/SSFSKIM/cua/actions/runs/42246731024):
belowat the top of every page, andabove and belowdeeper.Tests and review
Engine: 865 of 865, including
VisibleFirstTests. Each rule's test fails with the rule removed, checked by mutation.Node: the renderer, diff, observations, service, core-documentation, docs-oracle and repl-parity docs suites all pass.
Review: reviewer-high on c4057c3..effffce, then bounded re-reviews of every fix range. They found and fixed:
overflow:hiddenlist stays AXList), and gaps not scoped to the chosen node.The last re-review, 9f5a045..0c98f78, is CORRECT.
CI: ci-gate on the head 8572861 (0.27.0): four gates GREEN in https://github.com/SSFSKIM/cua/actions/runs/42255154288. parity-browser failed there on the known racy browser-cuaapi click and scroll cells and passed on re-run: https://github.com/SSFSKIM/cua/actions/runs/42259976395. On 0c98f78, the last code commit, all five gates are GREEN: https://github.com/SSFSKIM/cua/actions/runs/42249913745.
Follow-up: #305 (P1) checks live whether #296's guard refuses ordinary clicks on still pages on main. The #301 A/Bs emulated that on GitHub's code view, Safari's toolbar and Finder's title bar.
Sminos-Session: cursor235#b93055dd (cua on macbook)