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
A text-locator find replaces the session snapshot with a scoped tree, so earlier @refs stop resolving #4686
help workflow says refs "stay valid until you press/click/fill/type/scroll/back/wait-for-async-UI, or otherwise change app state". A text-locator read with find does not change app state, yet afterwards the refs from the previous snapshot no longer resolve. A selector read with get keeps them.
Observed on 0.21.39, iOS 27.2 simulator:
$ agent-device snapshot -i --session c39 # "4 items" is @e4
$ agent-device find "speakers" get text --session c39
Speakers (4)
$ agent-device get text @e4 --session c39
Error (COMMAND_FAILED): Ref @e4 not found. Not dispatched. Next: Snapshot refs expire when the UI changes. Run snapshot -i and retry with a fresh @ref.
$ agent-device snapshot -i --session c39 # @e4 again
$ agent-device get text 'label="4 items"' --session c39
4 items
$ agent-device get text @e4 --session c39
4 items
The UI did not change between these commands.
The cause: findFirstLocatorMatch in selector-read.ts scopes the capture to the query (findSnapshotScope) and passes updateSession: true. captureSelectorSnapshot therefore stores the scoped, partial tree as the session snapshot, and the earlier full tree's refs disappear. Since #1093, nothing is misread, but the agent re-snapshots for nothing, and the error points it at a UI change that did not happen.
Required behavior
A read-only find (get text, get attrs, exists) leaves the refs from the last full snapshot resolvable, as the help says.
Any @ref printed by a read-only find resolves to the node that the find read.
Completion conditions
snapshot -i, then find "<text>" get text, then get text @eN on a ref from that snapshot returns the same text as before the find.
The ref printed by find "<text>" get attrs still resolves to that node afterwards.
#4698 fixes the wrong-node part. A plain ref outside a partial frame's issuance set is now refused with ref_not_issued, as ADR 0014 already requires.
The first required behavior here, that earlier refs stay resolvable after a read-only find, conflicts with ADR 0014 "Partial issuance": publishing a partial frame intentionally supersedes the prior frame. Two ways to get it, both needing an ADR amendment:
B1:find … get text stops publishing a ref, so the frame is not superseded. The JSON ref and refsGeneration fields go away for get text.
B2: a read-only find's partial frame keeps the previous complete frame's tree for reads of refs outside its issuance set. That is one extra retained tree, which the ADR rejected for multiple trees.
Should either be pursued, or is #4698 enough and the help wording ("or find/diff print refs") the intended contract?
Decision: scope: #4698 fixed the part we need. A plain ref that the current frame did not issue is now refused instead of read from a newer tree.
We withdraw the first required behavior here (earlier refs stay resolvable after a read-only find) and the B1/B2 question. The current contract, where refs printed by find or a settled diff supersede earlier ones, works for us. Feel free to close this issue.
Activity
xiatiandeairen commentedon Nov 18, 2026
#4698 fixes the wrong-node part. A plain ref outside a partial frame's issuance set is now refused with
ref_not_issued, as ADR 0014 already requires.The first required behavior here, that earlier refs stay resolvable after a read-only find, conflicts with ADR 0014 "Partial issuance": publishing a partial frame intentionally supersedes the prior frame. Two ways to get it, both needing an ADR amendment:
find … get textstops publishing a ref, so the frame is not superseded. The JSONrefandrefsGenerationfields go away forget text.Should either be pursued, or is #4698 enough and the help wording ("or find/diff print refs") the intended contract?
fix(refs): refuse reads of refs a partial frame did not issue (#4698)
xiatiandeairen commentedon Nov 19, 2026
Decision: scope: #4698 fixed the part we need. A plain ref that the current frame did not issue is now refused instead of read from a newer tree.
We withdraw the first required behavior here (earlier refs stay resolvable after a read-only
find) and the B1/B2 question. The current contract, where refs printed byfindor a settled diff supersede earlier ones, works for us. Feel free to close this issue.xiatiandeairen commentedon Nov 19, 2026
Fixed by #4698.