Skip to content

fix(evaluation): preserve full tool results in judge transcripts - #4771

Merged
melmennaoui merged 1 commit into
mainfrom
fix/eval-preserve-tool-evidence
Oct 30, 2026
Merged

melmennaoui merged 1 commit into
mainfrom
fix/eval-preserve-tool-evidence

Conversation

@melmennaoui

Copy link
Copy Markdown
Contributor

Summary

Closes #4770.

  • Preserve complete tool responses in the relevance judge's chronological transcript instead of silently retaining only the first 500 bytes.
  • Replace the existing test that required truncation with a preservation assertion.
  • Add deterministic regression coverage for empty responses, the 499/500/501-byte boundaries, decisive evidence at the end and in the middle, UTF-8 crossing the former boundary, and a large output. The tests verify exact content and ordering relative to the assistant response.

Why

The agent can correctly report evidence beyond byte 500 while the judge receives only a prefix and calls that evidence fabricated. Conversely, an error beyond the cutoff can be hidden from grading. Saved sessions and judge evidence should not disagree because of an implicit formatter limit.

This fixes transcript construction only: no changes to agent execution, rubric, tool-call matching, size checks, or score aggregation.

Tradeoff

Verbose tool results now produce larger judge inputs, potentially increasing tokens, cost, latency, or context-window pressure. This PR deliberately does not replace the arbitrary limit with another lossy cutoff or an LLM summary. A future explicit context-budget policy should preserve relevant evidence or surface insufficient evidence rather than silently turning omitted content into grading failures. This change does not claim an observed pass-rate improvement; measuring that requires regrading frozen transcripts.

Validation

  • Regression tests fail against the original implementation (including missing evidence and invalid UTF-8 at the former cutoff), then pass with the fix.
  • task test — passed.
  • task build — passed.
  • go test ./pkg/evaluation -count=1 — passed.
  • go test -race ./pkg/evaluation -count=1 — passed.
  • golangci-lint run --allow-parallel-runners --new-from-rev=HEAD — 0 new issues (run before committing, against the main baseline).
  • go run ./lint . — 2,759 files inspected, no offenses.
  • go mod tidy --diff and git diff --check — clean.
  • Full task lint is blocked by three existing errcheck findings in unchanged pkg/tools/lifecycle/supervisor_test.go at lines 376, 777, and 1075, using golangci-lint 2.15.0. Those files are not modified here.

No paid model calls or Docker eval runs are needed for these tests.

Remove the implicit 500-byte tool-result cutoff so relevance judges can assess the same evidence recorded for the agent. Cover boundary lengths, tail and middle evidence, UTF-8, and large outputs.

Closes #4770

Assisted-By: docker-agent
Signed-off-by: melmennaoui <mohamed.elmennaoui@docker.com>
@melmennaoui
melmennaoui requested a review from a team as a code owner October 29, 2026 22:02
@aheritier aheritier assigned Copilot and unassigned Copilot Oct 29, 2026
@aheritier
aheritier requested a balanced review from Copilot October 29, 2026 22:27

Copilot AI 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.

🟢 Approval recommended

No active review issues block the change to preserve complete tool responses in the relevance judge’s transcript.

No open issues 🎉

What changed in this PR

Fixes #4770 by preserving complete tool responses in the relevance judge’s transcript, so grading can use evidence beyond the former 500-byte cutoff.

Changes:

  • Removes tool-response truncation without changing agent execution or scoring logic.
  • Adds regression coverage for boundary lengths, middle and trailing evidence, UTF-8, large outputs, and transcript ordering.
  • Accepts larger judge inputs as an explicit tradeoff for preserving evidence.
File Description
pkg/​evaluation/​eval.go Preserves full tool responses in chronological judge transcripts.
pkg/​evaluation/​eval_test.go Replaces truncation expectations and tests exact evidence preservation and ordering.

Review effort: Balanced

@aheritier aheritier added area/core Core agent runtime, session management kind/fix PR fixes a bug (maps to fix:). Use on PRs only. labels Oct 29, 2026
@melmennaoui
melmennaoui added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit f269908 Oct 30, 2026
17 checks passed
@melmennaoui
melmennaoui deleted the fix/eval-preserve-tool-evidence branch October 30, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Core agent runtime, session management kind/fix PR fixes a bug (maps to fix:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Relevance judge loses tool-result evidence after 500 bytes

5 participants