Repository navigation
fix(computer-use): read elements reported at infinity without a frame instead of crashing the helper - #10034
Merged
Conversation
… instead of crashing the helper
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
[Medium impact] The PR appears safe to merge. SummaryThe helper now reads Accessibility elements with non-finite frames without including their coordinates.
Reviews (1) · Last reviewed commit: "fix(computer-use): read elements reporte..." · Reviewed by Greptile |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
JSONSerializationraises an Objective-C exception on a non-finite number, which Swift cannot catch, so the helper aborted and every laterget_app_stateon that app crashed it againaxRectnow treats a non-finite position or size as no frame, so those elements come back without coordinates and the rest of the state is read normallyencodeReplychecksJSONSerialization.isValidJSONObjectfirst and throwsreply_unencodable, which the main loop sends as an error reply, so no value can abort the helper againType of Change
Testing
accessibilityFrameis at infinity;tests/live.pyasserts it comes back without a frame. Passes on this branch's helper; with the pre-fix helper the same test aborts at the firstget_app_statewithInvalid number value (infinite) in JSON writeaxRectwith finite and infinite values andencodeReplyrefusing a non-finite number (pass)get_app_state(with and without screenshot) now succeeds, and typing into the field afterwards works with the helper still running; before, the helper aborted every time (the pre-batch helper did too, so this predates the recent computer-use changes)Checklist
test-auditauthoring gate)