Harden non-success trajectory truncation

This commit is contained in:
2026-08-07 01:40:36 +08:00
parent c6c583dcee
commit ba7d619624
10 changed files with 360 additions and 171 deletions
+35 -3
View File
@@ -10,7 +10,9 @@ contracts.
- Replaced the single-call trajectory audit with two isolated model calls:
boundary selection followed by prefix-only quality scoring.
- The boundary call receives an outcome-blind and patch-blind trajectory view.
- The boundary call receives an outcome-blind and reference-patch-blind view.
It does receive the trajectory's own final model patch to check coverage and
final diff pollution.
Long trajectories are presented as ordered blocks targeting 32 turns, with
absolute turn IDs and immediate assistant/tool-result pairs kept together.
- Python materializes the exact prefix before the selected assistant turn. The
@@ -27,16 +29,46 @@ contracts.
because no truncation is needed.
- Kept an explicit list of erroneous and inefficient assistant actions as a
quality surrogate; Python recomputes its counts locally.
- Each listed issue records whether it was recovered. Python rejects a model
response that claims a prefix is safe while also listing an unrecovered
major/critical issue.
### Validation
- A boundary must be an assistant turn inside the selected block.
- Boundary evidence must include an exact quote grounded in that assistant
turn.
- Boundary evidence must include that assistant turn ID; Python attaches the
exact immutable source excerpt rather than trusting model-copied quotes.
- The model does not repeat a block ID or prefix-safe boolean. Python derives
the containing block from the validated boundary turn, while the isolated
second call judges the materialized prefix itself.
- `KEEP_FULL` now requires explicit review of task coverage, exact interfaces,
final repository state, user scope constraints, and claim/tool consistency;
passing tests alone are not treated as proof.
- Complete-trajectory scoring receives the final model patch, while truncated
prefix scoring remains suffix-isolated.
- Failed and unverified (`resolved=0/-1`) records are capped before the first
statically detected state-changing assistant turn. The earlier of that cap
and the GLM boundary is materialized, preferring shorter safe investigation
traces over late cuts.
- Removed redundant model-written prefix-validity booleans. Python derives
safety directly from unrecovered major/critical behavior issues.
- A prefix scorer cannot cite a turn outside the materialized prefix.
- `HIGH`, `MEDIUM`, `LOW`, and `REJECT` are computed locally rather than trusted
from model output.
### Stress pilot
- A difficulty-weighted 15-record set was used to expose late-boundary errors;
it is not an estimate of the full dataset acceptance rate.
- Raw semantic boundaries were often too late or incorrectly returned
`KEEP_FULL`. After applying the non-success stateful cap, two independent
human reviewers found all 15 effective prefixes safe and no late boundary.
- Retained-turn ratios ranged from 11.14% to 39.74%, with an 18.73% median.
The final quality distribution was 10 `HIGH` and 5 `MEDIUM`.
- The final low-reasoning, five-worker run completed 15/15 records without an
error in 90.05 seconds. High-reasoning mode was substantially slower and had
gateway timeouts, so it is not the practical batch default.
### Motivation
- In the previous 500-record pilot, 360 of 423 prefix candidates included