Skip to content

Fix broken env scanner - #45

Merged
pipmc merged 8 commits into
mainfrom
fix/broken-env
Feb 2, 2026
Merged

pipmc merged 8 commits into
mainfrom
fix/broken-env

Conversation

@pipmc

@pipmc pipmc commented Jan 30, 2026 •

Copy link
Copy Markdown
Contributor

This PR addresses the following issues:

  • Tool calls and reasoning were being stripped out of the messages sent to the scanner, leading to spurious positives
  • The scanner wasn't citing errors appropriately (was giving them them an [E1] citation), prompt improvements to prevent this
  • We capture a list of tools available to the agent from each run (needed so scanner can see if required tools are missing), but inappropriate use of context var to store this list meant the list was bleeding between different scans - now stored in a regular variable per-scan

Sample scan here: https://inspect-ai.internal.metr.org/scan/broken-env-test-bub5zi5f9p12op66

pipmc and others added 6 commits January 21, 2026 21:33
(The context var is bleeding between different scans, meaning the wrong tools are shown to the scanner model)
The broken_env scanner now receives error events from the transcript
and includes error information (message and traceback) in the prompt
sent to the LLM. This helps the scanner understand when a run failed
due to an error, especially for runs that fail early before any
model events are generated.

Changes:
- Add "error" to the events list in the scanner decorator
- Add _get_error_info() function to extract error messages and tracebacks
- Include error section in the prompt when errors are present
- Update tests to verify error info is included in prompts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@pipmc
pipmc requested a review from bsnodin January 30, 2026 20:18
@pipmc pipmc self-assigned this Jan 30, 2026
@bsnodin

bsnodin commented Jan 30, 2026 •

Copy link
Copy Markdown
Contributor

@pipmc am I right to think that the changes in packages/scanners/src/metr_scanners/scanner.py apply to all scanners not just broken_env?

In particular, fixing this

Tool calls and reasoning were being stripped out of the messages sent to the scanner, leading to spurious positives

(excited to see this!)

@bsnodin bsnodin left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pipmc
pipmc merged commit 3f89a84 into main Feb 2, 2026
3 checks passed
@pipmc
pipmc deleted the fix/broken-env branch February 2, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants