Repository navigation
[TH-9448] fix: follow-ups from #224's last review of the browser-agent scan - #288
Merged
khushalsonawat merged 1 commit intoNov 11, 2026
Conversation
… scan (TH-9448)
- A WARNING line no longer prints a customer's source line or a file path.
- A .py file with a NUL byte after an indented block made the 3.12 and
3.13 tokenizer raise SystemError. The scan's skip handler logged it at
WARNING with its full traceback, which quoted the line holding the NUL.
- The tokenizer's SystemError is now caught with its other errors, at
DEBUG.
- The skip handler logs the error type only, once per scan, plus a count
line. The path and trace go to DEBUG.
- A folder holding exactly the same package records as one already read
shares that folder's rows, unread and never copied, for an eighth of
each record's size (at least 4 KiB each). 21 copies of a 160-package
environment now fit in the 16 MiB record budget, against 9 before.
- The scan's cache key sums every read file's modified and change times,
with the file count and size. Neither a restored mtime nor a file dated
in the future can hide an edit any more.
- New tests pin:
- the top folder's own modules;
- both 16 MiB record budgets and the 32 MiB Python total, at their real
values;
- a refused-codec file searched whole;
- folders that hold only a folder inside a test-named folder.
- Ruled out, each pinned by existing tests: items 2, 6, 8 and 9. Item 6b's
turn-limit bound is now in HOW-IT-WORKS.md.
Reviewed:
- a design review (two rounds);
- a plan review;
- one change review round;
each by two fresh reviewers, the last of each round CLEAR.
Refs: TH-9448
Signed-off-by: khushalsonawat <khushalsonawat@gmail.com>
cdileep23
approved these changes
Nov 11, 2026
khushalsonawat
merged commit Nov 11, 2026
bc5a363
into
feat/TH-8804-source-subfolder
11 checks passed
khushalsonawat
added a commit
that referenced
this pull request
Nov 11, 2026
…288) into TH-9491 - tests/test_harness_sandbox_server.py: both sides appended tests; kept both. - test_contract_writer's allow-list gains #269's two contract.json copies: reading_result.document's replace_if_unchanged (the saved contract's own bytes plus the reading record) and seed_contract.use_seed's _write_whole (the platform's seed, as written). - sandbox_server.py imports SecretResolutionError, which #284's resolver raises but the base never imports: seven sandbox-server tests fail with NameError on the base itself. Signed-off-by: khushalsonawat <khushalsonawat@gmail.com>
1 task done
khushalsonawat
added a commit
that referenced
this pull request
Nov 11, 2026
…total Brings in #269, #276 (through #283), #283 and #288. Three hunks against #288 (TH-9448) were resolved by hand, keeping both intents: - a skipped file logs its type once at WARNING, and its path and trace at DEBUG (#288); it is also counted as the scan's `skipped` cut, and that count is in the cut line, so #288's separate "skipped N files" line is not repeated (TH-9512); - #288's skip tests and its NUL-byte test now expect the cut line, which holds names and counts only. Tests on 3.12.3: test_agent_type_refusal 720, test_browser_scan_cut 59, test_contract_tools_subfolder 180, all passed. Signed-off-by: khushalsonawat <khushalsonawat@gmail.com>
15 of 16 tasks
5 of 10 tasks
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.
Description
These are follow-ups from the last review of #224, the check that refuses browser and computer-use agents (TH-8806), all in
agent_type_check.py.The one with real weight is a log leak, fixed here.
.pyfile with a NUL byte after an indented block makes the Python 3.12 and 3.13 tokenizer raiseSystemError. The scan's skip handler logged that at WARNING with its full traceback. The traceback quoted the customer's source line holding the NUL.--read-agent-onlyfalls back to Python's last-resort handler at WARNING.SystemErroris caught with its other errors, at DEBUG;Type of Change
Changes
_walked), never a file or a line.credentials.pylogs the same at WARNING.HOW-IT-WORKS.md; the ticket's "bounded by the first save" was wrong.dileepfix3-self-r1/r2) are missing. The items were rebuilt from the code, the TH-8806 ledger and fresh probes.Known limits (Lows, kept here and not as tickets)
whole = Falseon the budget break can't change an outcome, because no later folder can match once the budget is spent.except Exceptionis;ValueErrorandSyntaxErrorin the tokenizer catch.Narrowing either adds at most a type-only WARNING, never a leak. P3a (dropping
SystemError) is caught on 3.12 and 3.13 only, because 3.14 raisesTokenErrorthere.<unknown>, with no path or line. That is the shared reader's, in fix(harness): decode a Python file before searching it when its codec can spell a name (TH-9490) #276 and fix(harness): give a browser scan its limits cut a second look (TH-9512) #281.Testing
test_agent_type_refusaltest_contract_tools_subfoldertest_executor_completed_countstest_agent_readingtest_builder_chattest_hosted_authoring_entrypointtest_harness_architectureEach file ran on its own, and none failed.
Planted bugs: 35 one-token or one-line breaks, each run in a scratch copy with stale bytecode cleared, each turned its named test red. The reviewers re-ran them on the final code and added their own.
Stability: the timing and memory rows passed 10 of 10 repeat runs.
Review:
each by two fresh reviewers. All the final rounds were CLEAR, with nothing above Low in the change review.
Overlap with #281 (TH-9512)
exceptblock andtest_a_file_that_raises_something_unexpected_costs_only_that_fileclash with fix(harness): give a browser scan its limits cut a second look (TH-9512) #281. Whichever lands second rebases. Once both are in:cut by skipped Nline replaces this PR's count line;agent_type_check.py.Related Issues
Refs: TH-9448