Repository navigation
fix(computers): the probe tries a drag or a chord once more when a busy desk may have missed it #671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
fix(computers): the probe tries a drag or a chord once more when a busy desk may have missed it #671
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
0612eb9
fix(computers): the probe tries a drag or a chord once more when a bu…
earakely-scale 643b289
fix(computers): a drag tried again is judged by its own stroke, not t…
earakely-scale 7c4867c
test: the drag check's unit test has its desk record the stroke when …
earakely-scale File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
55 changes: 55 additions & 0 deletions
55
packages/agentenv-protocol/tests/test_computer_conformance_attempts.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| """A check whose effect a busy desk can miss is tried again before it fails, and a pass on a later try says what the | ||
| earlier one found; any other check is tried once.""" | ||
| from __future__ import annotations | ||
|
|
||
| from types import SimpleNamespace | ||
|
|
||
| import pytest | ||
|
|
||
| from agentenv_protocol.computer.conformance import checks | ||
|
|
||
| STARVED = "the stroke was [50, 50] to [300, 250] in 3 points" | ||
|
|
||
|
|
||
| def _probe() -> checks.Probe: | ||
| return checks.Probe(SimpleNamespace(params=lambda uri: {}), session=None, ready_timeout_s=1) | ||
|
|
||
|
|
||
| def _answering(*answers: str | None): | ||
| calls: list[int] = [] | ||
| pending = iter(answers) | ||
|
|
||
| async def test() -> str | None: | ||
| calls.append(len(calls) + 1) | ||
| return next(pending) | ||
|
|
||
| return test, calls | ||
|
|
||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_a_check_tried_again_passes_saying_what_its_first_try_found(): | ||
| probe, (drag, calls) = _probe(), _answering(STARVED, None) | ||
|
|
||
| assert await probe.check("P7", "a drag", drag, attempts=checks.BUSY_DESK_ATTEMPTS) | ||
|
|
||
| [result] = probe.results | ||
| assert (result.status, result.detail, calls) == ("passed", f"passed on try 2 of 2; before: {STARVED}", [1, 2]) | ||
|
|
||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_a_check_that_fails_every_try_fails_with_what_its_last_try_found(): | ||
| probe, (drag, calls) = _probe(), _answering(STARVED, "the stroke missed its waypoint (200, 100)") | ||
|
|
||
| assert not await probe.check("P7", "a drag", drag, attempts=checks.BUSY_DESK_ATTEMPTS) | ||
|
|
||
| [result] = probe.results | ||
| assert (result.status, result.detail, calls) == ("failed", "the stroke missed its waypoint (200, 100)", [1, 2]) | ||
|
|
||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_any_other_check_is_tried_once(): | ||
| probe, (test, calls) = _probe(), _answering("the fixture shows 'abc'", None) | ||
|
|
||
| assert not await probe.check("P6", "typed text arrives", test) | ||
|
|
||
| assert (probe.results[0].status, calls) == ("failed", [1]) |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.