Repository navigation
fix(redteam): carry run stats to the report via environment_state part of RedTeam Graduation Part 1 #415
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
Open
nhungbi
wants to merge
4
commits into
strands-agents:main
Choose a base branch
from
nhungbi:handle_run_data
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
fix(redteam): carry run stats to the report via environment_state part of RedTeam Graduation Part 1 #415
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1b628f7
fix(redteam): carry run stats to the report via environment_state
bce80b1
feat(redteam): deprecate run_meta in RedTeamReport.from_evaluation_re…
1d04b66
refactor(redteam): add AttackRunResult.to_environment_state and RUN_R…
9db588f
Merge branch 'main' into handle_run_data
nhungbi 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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue:
to_environment_state()emits the entiremetadatadict ({**self.metadata, "pruned_branches": ...}), butRedTeamReport._run_results()only reads three keys:turns_used,backtracks,pruned_branches. For GOAT/Crescendo,metadataalso carriestarget_calls,parse_failures,attacks_used, and — whenstore_reasoning=True— the full per-turnreasoning_trace(the attacker's chain-of-thought).Because the base
Experimentcopies this intoactual_environment_state, andcompose_test_prompt(..., uses_environment_state=True)stringifies the whole thing into the judge prompt, any environment-state-aware evaluator (e.g.OutputEvaluator) now sees the attacker's internal reasoning. That risks biasing the judge (it reveals how the attack was constructed) and inflates token usage. The PR's trade-off note only mentions "run stats" reaching the judge, not reasoning traces.Suggestion: Emit only what the report consumes, e.g.
state={"turns_used": self.metadata.get("turns_used"), "backtracks": self.metadata.get("backtracks"), "pruned_branches": self.pruned_branches}. If passing full metadata through is intentional, please document the judge-prompt exposure explicitly in the docstring and the PR trade-off section so downstream users ofuses_environment_state=Trueevaluators aren't surprised.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We pass the full metadata through because it's documented as free-form, and public options like GoatStrategy(store_reasoning=True) rely on their keys reaching the report and to_file(). An allowlist turns those options into silent no-ops and forces an edit to to_environment_state() for every new strategy field. Filtering also no longer protects anything: the old key-collision risk went away with the case/run metadata merge, and the judge only sees this data when an evaluator opts in with uses_environment_state=True, which we'll document.