Repository navigation
feat(harness): refuse browser, computer-use and crawler agents #224
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
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
7fb8051
feat(harness): refuse browser, computer-use and crawler agents
khushalsonawat 15f74f3
test(harness): stop depending on MCP internals in the write-failure test
khushalsonawat b874c14
fix(harness): address review of the browser agent refusal
khushalsonawat 7e977c6
fix(harness): keep test folders out of the scan and its reuse honest
khushalsonawat a89d71c
fix(harness): make the second look hold on both loops, and harden the…
khushalsonawat 880f9a2
fix(harness): end the second look, and read what the scan missed
khushalsonawat fd72686
fix(harness): close a regex literal's bracket at its line end
khushalsonawat 4435f0e
fix(harness): bound record reads across folders, and keep one look pe…
khushalsonawat d2c3229
fix(harness): keep record rows relative to their folder, and rescan o…
khushalsonawat 134ff1c
fix(harness): ask only the nearest record folders, and drop a flag th…
khushalsonawat b9bda58
fix(harness): read each record once, skip slow codecs, and give every…
khushalsonawat 35fd0c9
fix(harness): find the codec name whatever bytes follow it, and count…
khushalsonawat 4060c6e
fix(harness): count browser names in source left unread, and read wha…
khushalsonawat 7726ded
fix(harness): decide a test folder without following links, and read …
khushalsonawat 39e5ae8
fix(harness): decode unicode-escape as Python does, and count only wh…
khushalsonawat 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
Some comments aren't visible on the classic Files Changed page.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| """The failure a build leaves for the platform before it exits non-zero.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import json | ||
| import os | ||
| import tempfile | ||
| from pathlib import Path | ||
|
|
||
| from .job import HarnessFailure | ||
|
|
||
| FAILURE_FILE = "failure.json" | ||
|
|
||
|
|
||
| def _write_in_place(path: Path, body: str) -> None: | ||
|
khushalsonawat marked this conversation as resolved.
Resolved
|
||
| """For a disk with no hard links: still first-wins, but a reader could catch it part-written. | ||
|
|
||
| A disk that refuses ``chmod`` keeps the umask's mode: a whole file beats none. | ||
| """ | ||
| try: | ||
| descriptor = os.open(path, os.O_CREAT | os.O_EXCL | os.O_WRONLY, 0o644) | ||
| except FileExistsError: | ||
| return | ||
| try: | ||
| with os.fdopen(descriptor, "w", encoding="utf-8") as file: | ||
| file.write(body) | ||
| except OSError: | ||
| path.unlink(missing_ok=True) | ||
| raise | ||
| try: | ||
| os.chmod(path, 0o644) | ||
| except OSError: | ||
| pass | ||
|
|
||
|
|
||
| def write_failure_file(failure: HarnessFailure, output: Path) -> Path: | ||
| """Write ``failure``. The first failure of a build stands. | ||
|
|
||
| Whole, in one step, on a disk with hard links. On one without, it's written in place, where a | ||
| reader could catch it part-written. | ||
| """ | ||
| output = Path(output) | ||
|
khushalsonawat marked this conversation as resolved.
Resolved
|
||
| output.mkdir(parents=True, exist_ok=True) | ||
| path = output / FAILURE_FILE | ||
| body = json.dumps(failure.model_dump(mode="json"), indent=2, sort_keys=True) + "\n" | ||
| temporary = tempfile.NamedTemporaryFile( | ||
| "w", dir=output, prefix=".failure-", suffix=".tmp", encoding="utf-8", delete=False | ||
| ) | ||
| try: | ||
| with temporary: | ||
| temporary.write(body) | ||
| try: | ||
| os.chmod(temporary.name, 0o644) | ||
| os.link(temporary.name, path) | ||
| except FileExistsError: | ||
| pass | ||
| except OSError: | ||
| # No file reads as a crash, which pays for another full run to reach this same failure. | ||
| _write_in_place(path, body) | ||
| finally: | ||
| os.unlink(temporary.name) | ||
| return path | ||
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
Oops, something went wrong.
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.