Repository navigation
feat(judge): the always_on judge reads what the harness's context guard did - #991
Merged
Merged
Conversation
…rd did The PSI neutral harness v14's context guard hides older tool results behind stubs, cuts new ones, compacts inside a wake and resends a call refused as too long. turn_events skipped its harness.guard spans as the harness's own, so the judge graded models on text they were never shown, and read a reply the harness set aside (harness.call.resent) as the model's. - Each harness.guard span (mask, compact, cut, retry) is a note with its facts (guard). - A TOOL span's harness.guard.shown_as / shown_chars put shown on its call; staging writes it as shown_to_assistant, and the judge is told to grade on what the assistant was shown. - An LLM span marked harness.call.resent adds no text or thinking. - A compaction inside a wake reads calls_summarized and mid_wake, not "0 wakes summarized". - Staging lists guard actions in index.md and counts them in the record (context_guard_actions, results_shown_not_whole). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… line stays readable whole With "guard" an identity field, fit could not move it, so one guard action over hundreds of results (a mask, a refused call's retry) left a harness_note line of about 4,000 characters, past LINE_CHARS, even after its text moved; the mask's index.md entry ran to 3,700. - fit moves the long parts of an identity field (_LONG_PARTS: a guard's handles and tools) as it moves a line's own fields, leaving <part>_file and <part>_preview in "guard", which keeps its action, wake, call and counts inline. - index.md shows a guard's lists by their start, as it shows an argument; the wake file has them whole. Test: test_a_guard_note_over_hundreds_of_results_stays_inside_the_line_limit_its_lists_in_a_file (mask, retry). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…md still says it failed "compaction" is an identity field too, and its error and save_error hold the provider's own text: a 3,000-character error left a harness_note line of about 3,500 characters even after its text moved, and an index.md entry of 3,200. - _LONG_PARTS also names a compaction's error and save_error, so fit moves a long one to a file and leaves error_file / error_preview in "compaction", whose written_by and counts stay inline. - index.md words a compaction from its error's preview when it was moved (_index_facts), so it still says the compaction (or its save turn) failed; it shows as much of an error as of a message, and a guard's lists as an argument. Test: test_a_compaction_s_long_provider_error_goes_to_a_file_and_the_index_still_says_it_failed (compaction failed, save turn failed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The line limit held only for fields fit was told it could move. A made-up 2,000-character tool name or a plug-in's 2,000-character outcome stayed inline as an identity field (lines of 2,684 and 2,518 characters); a user sim read with six long fields went over on its previews alone (2,577); and a line of dozens of short fields grew to 7,188, since fit moved even values shorter than the preview they left. - Inside guard and compaction every part can move but those that say what the note is (_IDENTIFYING_PARTS: a guard's action, wake and call; a compaction's written_by and mid_wake). This replaces the list of known-long parts. - fit moves only a value longer than a preview. A line still too long then moves its longest values left inline, identity fields included; then cuts its previews, longest first (dropped under MIN_PREVIEW_CHARS); and failing that goes whole to a file of its own, leaving event, wake and line_file. Nothing is dropped. - index.md reads a moved field from its preview, or names its file when the preview was cut away. Tests (each failed before): test_a_made_up_tool_name_too_long_for_a_line_goes_to_a_file, test_a_user_sim_plug_in_s_long_outcome_goes_to_a_file, test_a_line_with_many_fields_in_files_cuts_their_previews_to_fit, test_a_line_of_dozens_of_short_fields_goes_whole_to_a_file_of_its_own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… kept whole in a file
fit now shortens or leaves out a preview to keep a line under 1,800 characters, and puts a line too long even then
whole in a file of its own ({event, wake, line_file}). The judge's files note says both, so it reads the file for the
whole value.
Test: test_the_files_note_says_a_preview_can_be_cut_and_a_line_too_long_to_show_is_in_a_file_of_its_own. The two
pinned always_on judge inputs (always_on_staged, always_on_atif_staged) are re-recorded: only their prompt changed,
by the 195 characters added.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- index.md's header says a too-long line names each long field's file and keeps a preview of each, shortened or left out when the line needs it, and that a line of only event, wake and line_file is kept whole in its file. - The note on searching before a "never happened" claim says events.jsonl has at most the first 300 characters of a long text. The pinned always_on judge inputs (always_on_staged, always_on_atif_staged) are re-recorded: their prompt grew by the 3 characters and index.md by the 163 characters these edits add, nothing else. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AhmedArifK
approved these changes
Dec 2, 2026
williamloo-scale
approved these changes
Dec 2, 2026
…uard Conflicts, each resolved so both sides survive: - always_on_agent_verifier.py: the files note adds #981's _FAILURE_NOTE for a run with harness_failures and this branch's _GUARD_NOTE for one the context guard acted in. - always_on_staging.py: _IDENTITY has both "guard" and #981's "failure" and "failed_turn_notice", with this branch's _IDENTIFYING_PARTS and _KEPT; a harness_note carries guard and failure; the record keeps context_guard_actions, results_shown_not_whole and harness_failures; index.md has the compaction (mid_wake, _index_facts), guard and failure lines; imports guard_words, is_infra_failure and shown_words. - judge_utils/turn_events.py: TurnEvents and the span comment describe both failure and guard; the harness.guard, harness.error and harness.call.resent handling all stay; the guard helpers and #981's failure helpers both stay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… like guard and compaction "failure" (#981) is an identity field, so fit moved none of its parts in its first pass: a failed wake whose failure held a long part (what was running) moved the note's text to a file first, and the long part only went in the last step. _IDENTIFYING_PARTS now names failure's kind as what says what the note is; fit moves its other parts like the line's own fields, longest first, so the text the judge reads stays in the line. The comment saying failure "stays inline" now says how it does. Test: test_a_failure_note_keeps_its_kind_and_its_text_inline_while_a_long_part_of_its_failure_moves_aside (failed before: the note's text had moved). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts, each resolved so #980's thinking filter, #981's failure notes and this branch's guard notes and line-limit guarantee all survive: - always_on_staging.py: the module docstring says a turn's thinking is staged only when the judge's filter asks for it (stages_thinking) and that a harness_note can carry failure or guard; the stager keeps #980's thinking, thinking_left_out and as_recorded beside guard_actions and shown; the record keeps thinking_left_out and thinking_unfiltered_wakes beside context_guard_actions and results_shown_not_whole. - test_always_on_staging.py: imports both TrajectoryFilter (#980) and TurnEvents (this branch). - tst/data/verifier_golden/judge_inputs.json: always_on_staged and always_on_atif_staged re-recorded on the merge. Against main they differ only by this branch's text: the prompt by 198 characters (the files note's preview and line_file sentence, "at most the first 300") and index.md by 163 (its header sentence). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
Harness v14's context guard keeps each model call inside the model's context window. It hides older tool results behind stubs, cuts new results short, compacts inside a wake, and resends a call that was refused as too long. The judge's reader skipped the guard's
harness.guardspans as the harness's own. So the judge graded models on result text they were never shown. It also read a reply the harness set aside (harness.call.resent) as the model's claim.What changes
harness.guardspan (mask, compact, cut, retry) becomes a harness note that says what the guard did, with its facts underguard.harness.guard.shown_asandharness.guard.shown_charssays the model was shown the result cut or as a stub. Staging writes this asshown_to_assistant. The judge is told to grade on what the assistant was shown.harness.call.resentadds no text or thinking.mid_wakeandcalls_summarized. Its note says which wakes and how many of this wake's tool calls are now in the summary, not "0 wakes summarized".index.mdlists the guard's actions. The staging record counts them (context_guard_actions,results_shown_not_whole). A run the guard never acted in gets no new judge text.LINE_CHARS(1,800), whatever it holds. Insideguardandcompaction, every part can go to a file inwakes/results/except those that say what the note is (_IDENTIFYING_PARTS: a guard's action, wake and call; a compaction'swritten_byandmid_wake). That covers a guard's long lists of handles and tools and a compaction's provider error. A line still too long then moves its longest remaining values, identity fields included (a made-up tool name, a plug-in's outcome). Next it cuts its previews, longest first, and as a last step it goes whole to a file of its own (line_file). Each moved value leaves<field>_fileand, while it fits,<field>_preview, and nothing is dropped.index.mdreads a moved value from its preview, so it still says a compaction failed. The judge's files note says a preview can be shortened or left out and that a{event, wake, line_file}line is kept whole in its file.Tests
tst/unit/task_step/verifiers/judge_utils/test_turn_events_harness_guard.pybuilds spans in the harness's own shape (_psi_harness_span,_psi_guard_span, the guard'sharness.compaction). It covers each guard action and each retry outcome, results shown cut, as a stub and whole, a set-aside reply for "empty" and "cut", a compaction inside the first wake and after two wakes, and the staged files and judge note.tst/unit/task_stepplus the always_on CLI and judge-config tests: 4737 passed, 6 failed. The 6 also fail onmain(computer_exec_test×4,test_mcp_cli_builder×2).ruff checkis clean. Six tests check the line limit; each failed before its fix. They cover a guard over 400 results (mask and retry), a compaction with a 3,000-charactererrororsave_error, a 2,000-character tool name, a user-sim plug-in's 2,000-character outcome, a line whose previews alone overflow, and a line of 40 short fields. They check that every wake, events and index line stays underLINE_CHARSand that the side files hold the whole text. After those changes,tst/unit/task_step: 4740 passed, the same 6 failed.Pairs with
Harness v14's next release, which adds
harness.guard.shown_asandharness.guard.shown_charsto tool spans. The guard spans,harness.call.resentand the mid-wake compaction fields are in v14's code now.This PR touches the same files as #980 and #981. Merge order: #980, then #981, then this one. Each later one merges
mainand re-runs its tests.🤖 Generated with Claude Code
Confidence Score: 5/5

The PR appears safe to merge; no actionable new defect remains.Summary
The judge now reads context-guard actions, marks results the assistant did not see whole, skips discarded model replies, and describes compaction inside a wake.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR Spans[Recorded spans] --> Reader[Turn events] Reader --> Notes[Guard notes and shown-result labels] Notes --> Staging[Wake files] Staging --> Long[Side files for long values] Staging --> Index[Wake index] Long --> Judge[Judge reads recorded evidence] Index --> JudgeReviews (11) · Last reviewed commit: "Merge origin/main (#980) into sarahchitt..." · Reviewed by Greptile