Repository navigation
fix(cursor-approve): clamp an over-long axis headline instead of failing the axis - #398
Merged
Merged
Conversation
…ing the axis #395 made `headline` required and capped at 100 characters, and rejected an over-long one. The cap is enforced in `extract`, which the axis job's "Extract the verdict" step runs, so a model that wrote a few extra words (106 and 113 characters on cloud PR #12748) exited 1 there and turned the whole axis job red. Model output length is not deterministic, so neither the prompt nor a retry can guarantee the cap. Enforce it deterministically instead: `validate_output` clamps the folded headline to HEADLINE_MAX at a word boundary with "…" (hard cut for a single long token), and `extract` writes the clamped value into the artifact. A missing or empty headline is still untrusted.
Contributor
|
Warning Review limit reached
This review includes 4 billable files and costs up to $1.00.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 35 minutes for your next included review. View limit detailsLimit details: You’ve used the included review currently available. Your 131 included PR review attempts over the past 7 days set your current allowance at 1 review per hour. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (4)
Comment |
There was a problem hiding this comment.
🔍 Cursor Review — Consolidated panel
Triggered by @mattmillerai.
Found 4 finding(s).
| Severity | Count |
|---|---|
| 🟡 Medium | 1 |
| 🟢 Low | 1 |
| ⚪ Nit | 2 |
Panel: 6/6 reviewers contributed findings.
…reason on an early space
- A headline that clamps to nothing but separators ("-" * 101) now raises
instead of returning a bare "…", so the axis is untrusted as before.
- The word-boundary cut falls back to the hard cut when the last fitting space
is in the first half ("Fix: <long path>" no longer clamps to "Fix…").
- The boundary search now sees a space at index HEADLINE_MAX - 1, so a word
that fits exactly with "…" is kept.
- docs/callers/cursor-approve.md describes the clamp instead of the old reject.
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.
ELI-5
Each cursor-approve reviewer writes a one-line "headline" explaining its verdict, capped at 100 characters. When a reviewer wrote a slightly longer line (106 or 113 characters), the whole check went red, even though the verdict was fine. The model can't reliably count characters, so this PR shortens an over-long headline to fit, cutting at a word and adding "…", instead of failing.
What changed
aggregate.py:validate_outputnow clamps the whitespace-folded headline toHEADLINE_MAX(100) with a newclamp_headline. It cuts at the last space that fits and appends…, and trims trailing,;:-. It falls back to a hard cut when that space is in the first half, for example one long token orFix: <long path>. If nothing but separators survives, it raises, so the axis stays untrusted instead of showing a bare…. It used to raiseheadline is N characters, over the 100 limit.cmd_extractwrites the clamped headline into the uploaded artifact, so the artifact is always within the cap.docs/callers/cursor-approve.md: the rule now reads clamp, not reject.Why
extractruns in each axis job's Extract the verdict step. When a headline was over the cap, it exited 1 there and the axis job (axis: conformanceandaxis: correctness) failed on length alone. A prompt instruction or a retry can't guarantee a length limit on model output. Only enforcing it in code makes it deterministic.Testing
python3 -m unittest discover -s .github/cursor-approve/tests: 205 tests, OK.test_an_overlong_headline_is_rejected_not_truncatedwith tests that cover:decidedecideextractCLI artifactCallers that pin a SHA, like cloud, pick this up through the bump-callers flow once it merges.
Provenance
python3 -m unittest discover -s .github/cursor-approve/tests: 205 tests, OKpython3 -m unittest discover -s .github/cursor-review/tests: OKcheck_workflow_pins.py,check_agents_md.py --root .andcheck-org-repo-literals.sh: pass🤖 Generated with Claude Code