fix: [no-ticket] harbor - scoring integrity (dead attempts, best-rank monotonicity, strict reward key)#32
Open
shehabyasser-scale wants to merge 2 commits into
Conversation
1. Dead attempts count 0.0 in mean aggregation (n_dead in metrics). Attempts dying before the verifier scored were silently dropped from the mean, so the score estimated P(pass | attempt survived): measured live, a no-retry candidate won selection at an inflated 0.233 while its retry-hardened successors measured an honest ~0.19 and lost. All-dead samples error loudly instead of scoring 0.0 (an outage must stay visible). 2. 'best' trial ranking is monotone in the reward. The rank was (clean, has_rewards, recency), so with concurrent attempts 'best' meant 'last clean attempt to finish' and a later clean 0.0 clobbered an earlier clean 1.0, violating the never-clobber-a-passing-trial invariant the loader documents. Reward now precedes recency in the key. 3. Strict reward_key extraction. A configured reward_key missing from a rewards dict no longer falls back to 'pass'/'reward' (attempts within one mean could be scored on different metrics), and several unrecognized keys are refused instead of averaged (emitting easy auxiliary metrics beside the real one inflated the average). Sole-key dicts stay accepted. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…follow-up) Co-Authored-By: Claude Fable 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.
What
Three scoring-integrity fixes in
HarborRunner, each closing a channel a live optimizer exploited or could exploit:n_deadmetric). Attempts dying before the verifier scored were silently dropped from the mean, so the score estimated P(pass | attempt survived). Measured live in the Pawn replication: a no-retry candidate won selection at an inflated 0.233 while its retry-hardened successors measured an honest ~0.19 and lost; the optimizer documented the artifact in its own notes ("retry HELPS true quality but can LOWER measured train score"). All-dead samples error loudly instead of scoring 0.0._load_trials. Reward now precedes recency in the key.Tests
tests/test_harbor_runner.py: 48 pass, including new pins for zero-fill (0.5 not 1.0), all-dead-errors, rank monotonicity, strict key, and refuse-to-average.Stack
Based on #31 (
harbor-4-mode-config-split). Part of the pre-paper hardening series; found by an 18-agent adversarial code sweep + live optimizer behavior.🤖 Generated with Claude Code
Greptile Summary
This PR closes three scoring-integrity gaps in
HarborRunnerthat a live optimizer was actively exploiting. The changes are well-motivated by empirical evidence and thoroughly covered by 48 tests.P(pass | attempt survived)bias. All-dead samples surface as an error (falling through to the existing "No verifier rewards" path) rather than scoring 0.0. A newn_deadmetric lets operators distinguish infra noise from scored failures._trial_rank: Reward is now a rank key ahead of recency, so a later clean 0.0 can no longer silently replace an earlier clean 1.0 underbestaggregation. The method was also converted from@staticmethodto an instance method so it can callself._extract_reward._extract_reward: A configuredreward_keymissing from a rewards dict now returnsNone(unscorable) instead of silently falling back topass/reward; multiple unrecognized keys are refused rather than averaged, preventing score inflation via auxiliary metrics. A sole-key unambiguous dict is still accepted.Confidence Score: 5/5
The changes close three well-documented scoring-integrity gaps with minimal risk of regression; each fix is backed by at least one pinning test.
All three changes are narrowly scoped, internally consistent, and directly tested. The _trial_rank conversion from static to instance method is safe. The _extract_reward return-type widening to float | None is handled at every call site in the diff. No risky control flow or silent failures introduced.
No files require special attention — both changed files are straightforward and well-tested.
Important Files Changed
Reviews (2): Last reviewed commit: "test(harbor): pin reward-key-mismatch ze..." | Re-trigger Greptile