Skip to content

fix(tier3): withhold behavior scores built on cut final answers - #503

Merged
rng1995 merged 2 commits into
mainfrom
naren/fix-234
Nov 13, 2026
Merged

rng1995 merged 2 commits into
mainfrom
naren/fix-234

Conversation

@rng1995

@rng1995 rng1995 commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #234.

PR #259 fixed half of this: the bundle no longer claims omitted.truncated=false when a long final answer was cut. But it only fixed the reporting. The judge still scored the shortened evidence, so an evidence-loss artifact could still be graded as a behavior failure — which is the half the reporter said mattered: "Raising the limit alone is insufficient."

This PR closes the rest.

The final answer now fits. _DEFAULT_BEHAVIOR_FINAL_RESPONSE_LIMIT goes 800 → 8000, with the total budget reconciled to a still-finite 12000. Both env vars (SKILL_EVAL_BEHAVIOR_FINAL_RESPONSE_LIMIT, SKILL_EVAL_BEHAVIOR_CHECK_BUDGET) keep working. The user request section no longer carries its own hardcoded 800-character cap either, so the request is reserved ahead of optional exploration output rather than competing with it.

Completeness is now measured against the complete source, not against another budgeted rendering. The behavior_check bundle's omitted dict gains required_complete, required_missing and incomplete_sections, which reach reports through the existing metric-details path.

The judge is gated. When required evidence is incomplete, judge_behavior_check returns an evaluation error with no score, before any model call, and also refuses when the judge's own compaction would cut accounted evidence a second time.

Verification of the core behaviors

The issue's own reproduction, run against this branch:

Answer size Marker retained truncated required_complete Judge
4,028 chars (the issue's repro) yes false true scores normally
400,000 chars no true false withholds, returns an error

The withheld score stays None and is not averaged in as zero: with all five other signals at 1.0, overall_score_from_metrics returns None rather than the 0.83 that silently treating it as 0.0 would produce. This reuses the _judge_error → status="error" path from PR #240, which _normalize_required_judge_result, combine_behavior_check and overall_score_from_metrics already fail closed on. Bundles written before this change (no required_complete key) do not gate, so older artifacts are unaffected.

Judgement calls for reviewers

  1. Only the final answer gates the judge. File changes and tool history are deliberately excluded: their sources are unbounded (file-change evidence alone emits up to 1,800 characters per write), so any finite budget shortens them on a long run, and gating there would convert many currently-scoring evaluations into hard failures. The user request is excluded too, because it reaches the judge twice — its own reserved section plus the head of the compact history — so a gate there would mostly produce false positives. All four sections still report completeness via incomplete_sections. Widening or narrowing this is a one-tuple change at _BEHAVIOR_REQUIRED_EVIDENCE, with the rationale in a comment above it.
  2. The gate fails the whole trial. A behavior_check judge error already flows into evaluation_status: "failed" and SystemExit(1) in the verifier. That is what the issue asked for — "an explicit evaluation error with no behavior score" — and at an 8,000-character allowance it should be rare, but it is a harder failure mode than before and deserves a deliberate ack before merge.
  3. The standalone default budget grows 4,000 → 9,600 for direct callers of build_behavior_evidence with no max_chars. Finite, and necessary to hold the larger answer, but it is a bigger default prompt.
  4. Two tests pinned the old 800 default as load-bearing. test_behavior_bundle_final_answer_split_across_history_and_section now pins the limit to 800 via monkeypatch, because at the 8,000 default the split arithmetic it exercises no longer occurs; it doubles as env-override coverage. Two cap-loss tests moved from 4,028- to 16,028-character answers, and positive counterparts were added asserting the issue's original 4,028-character case now survives intact.

Verification

  • I am familiar with the Contributing Guidelines
  • Touched test files: 204 passed. eval_core-adjacent files plus tests/evaluation: 796 passed, 1 skipped.
  • Full tests/tier3 + tests/reporting + test_llm_judge.py + test_character_facts.py: 14563 passed, 28 failed, 5 skipped, 7 errors. A like-for-like re-run of every failing file against a pristine copy of the same tree produced an identical failure set (diff clean) — zero new failures. 3 of the 28 pass in isolation and match the project's known xdist/load flake pattern; the 7 errors are a pre-existing ModuleNotFoundError from a local Harbor version mismatch.
  • Gate behavior verified directly: incomplete evidence yields status="error" with score=None, and a None behavior score propagates as None through the overall-score composition rather than as zero.
  • Host/verifier parity: the template delegates evidence building to the shared helper and adapter.py stages it into the container; the judge gate is mirrored in the template's own copy, and existing parity tests cover the new code.
  • No new test needs a model call or Docker
  • ruff check src tests passes
  • Did not add credentials, private datasets, or proprietary benchmark content

Release Impact

  • No user-visible release note needed
  • Updated CHANGELOG.md

🤖 Generated with Claude Code

Issue #234 reported that behavior-check evidence dropped grading-relevant
text from the middle of a long final answer. PR #259 fixed the false
reporting half, so the omission is now recorded, but the judge still scored
the shortened evidence and the resulting evidence-loss artifact was graded
as a behavior failure.

Raise the final-response allowance from 800 to 8,000 characters so an
ordinary answer survives, and keep the total behavior budget finite by
reconciling it to 12,000 with the existing tool-history headroom. Reserve
the user request at the same allowance instead of a fixed 800, ahead of the
optional exploration output in the compact tool history. Both
SKILL_EVAL_BEHAVIOR_FINAL_RESPONSE_LIMIT and SKILL_EVAL_BEHAVIOR_CHECK_BUDGET
still override these.

Record completeness beside the existing omission accounting: each behavior
evidence section is compared against its complete source, not against another
budgeted rendering, so the bundle reports whether the REQUIRED evidence
survived rather than only whether something was dropped. The judge gates on
it and returns an explicit evaluation error with no behavior score instead of
scoring an answer a limit shortened, and refuses a second cut of its own on
evidence the accounting already covers. The error reuses the existing judge
error path, so a missing behavior score stays missing through declarative
check combination, judge-result normalization and the dimension mean rather
than becoming a zero.

Host and Harbor verifier stay in parity: the template delegates the evidence
builder and the new helpers to the shared module and mirrors the judge gate.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review of the raised behavior-evidence budget, the completeness accounting, and the new judge gate.

9 findings (5 P2, 4 P3). Each was produced by a reviewer, then checked by a separate adversarial pass that re-ran the claim and corrected or discarded what it could not reproduce; unsupported findings were dropped before posting.

These threads are resolved for triage. Resolution records that the finding has been read and routed, not that it is fixed — anything still open is listed in the PR description or carried to follow-up work.

Comment thread CHANGELOG.md Resolved
Comment thread CHANGELOG.md Resolved
Comment thread tests/tier3/test_behavior_evidence.py Resolved
Signed-off-by: Narendran Raghavan <[email protected]>
@rng1995
rng1995 merged commit c2f5a02 into main Nov 13, 2026
27 checks passed
@rng1995
rng1995 deleted the naren/fix-234 branch November 13, 2026 17:31
rng1995 added a commit that referenced this pull request Nov 13, 2026
Resolve the CHANGELOG conflict with #503 by putting its entry at the top
of Unreleased > Fixed, above the moved #475 entry it merged after.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
rng1995 added a commit that referenced this pull request Nov 13, 2026
main now carries PR #503 squash-merged as c2f5a02, so both sides added the
same behavior-evidence change. Resolved the four source conflicts in favour of
this branch, which is that change plus the review fixes; only c2f5a02 touched
those files on main, so nothing of it is lost.

The CHANGELOG auto-merge left both copies of the entry. Dropped main's
original and kept the corrected one in main's position, because correcting
that entry — it claimed the env vars still override, and omitted that a gated
case has no overall score at all — is one of the review findings. Every
released section is byte-identical to main.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
rng1995 added a commit that referenced this pull request Nov 13, 2026
…ing (#511)

Follow-ups to the review of PR #503, which merged as c2f5a02 before these
landed.

The evidence gate voided behavior_check — and with it the case's whole
overall score — whenever the final-response limit cut the answer, with no
regard for whether the expected behaviors needed that answer. A case whose
one expectation is a path the deterministic verified facts already mark
OBSERVED lost its score because its summary ran long. The bundle now reports
expected_behaviors_verified, and behavior_evidence_gap withholds nothing when
every expectation is settled by those facts; an expectation naming nothing
checkable still keeps the gate, and an absent flag means "not known", so
older and hand-written records keep it too.

Giving the USER REQUEST section the whole 8,000-character final-response
allowance bought a duplicate: build_conversation_summary already opens the
compact tool history with the question. On a 5,006-character prompt the
history fell from 6,181 to 1,961 characters and lost every tool call, which
is the only place a non-file behavior is observable. Cap it at 2,000, never
above the final-response limit.

incomplete_sections compared file changes and the tool history against their
own per-entry-clipped renderings, so a 4,033-character write whose middle
2,230 characters never reached the judge was reported complete. Both are now
rendered with full=True for the comparison, matching the docstring's premise.

SKILL_EVAL_BEHAVIOR_CHECK_BUDGET is honoured exactly as set in either
direction instead of being silently floored at the final-response limit plus
4,000 — an operator pins it to cap the judge prompt, so raising it past what
they asked for defeats the only reason to set it. A value too small to hold
the answer beside some tool history is logged as a warning naming both
settings. Only the default is still reconciled upwards. Unparseable and
non-positive values are not budgets and keep the reconciled default.

CHANGELOG and docs now describe what the code does: the raised defaults, the
new omitted keys, the user-request cap, and that a gated case has no overall
score at all.

Tests: the two final_response_limit cases went vacuous when the default rose
to 8,000 (a 2,231-character answer fits either way) — re-pointed at a
4,031-character answer so the per-call and env limits discriminate in both
directions. Adds coverage for the user-request allowance, for
incomplete_sections on the non-required reporting path and on per-entry caps,
for the honoured budget and its warning, and for the narrowed gate.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
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.

[BUG]: Behavior evidence drops final-answer text while reporting no truncation

1 participant