Skip to content

fix(cursor-approve): clamp an over-long axis headline instead of failing the axis - #398

Merged
mattmillerai merged 2 commits into
mainfrom
matt/cursor-axis-clamp-headline
Oct 9, 2026
Merged

mattmillerai merged 2 commits into
mainfrom
matt/cursor-axis-clamp-headline

Conversation

@mattmillerai

@mattmillerai mattmillerai commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

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_output now clamps the whitespace-folded headline to HEADLINE_MAX (100) with a new clamp_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 or Fix: <long path>. If nothing but separators survives, it raises, so the axis stays untrusted instead of showing a bare …. It used to raise headline is N characters, over the 100 limit.
  • cmd_extract writes the clamped headline into the uploaded artifact, so the artifact is always within the cap.
  • A missing or empty headline is still untrusted. The "card says WHY" guarantee from feat(cursor-approve): make the card say WHY, and split "nothing to judge" out of yellow #395 holds, because the first 100 characters carry the reason.
  • README and docs/callers/cursor-approve.md: the rule now reads clamp, not reject.

Why

extract runs 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: conformance and axis: 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.
  • Replaced test_an_overlong_headline_is_rejected_not_truncated with tests that cover:
    • clamping in decide
    • the word-boundary cut, including a word that fits exactly at 100
    • the hard cut for one long token or an early-only space
    • trimming trailing punctuation
    • rejecting a separator-only headline, both directly and via decide
    • the clamped value appearing in the extract CLI artifact

Callers that pin a SHA, like cloud, pick this up through the bump-callers flow once it merges.

Provenance

  • Authored by: agent-work loop
  • Verified:
    • python3 -m unittest discover -s .github/cursor-approve/tests: 205 tests, OK
    • python3 -m unittest discover -s .github/cursor-review/tests: OK
    • check_workflow_pins.py, check_agents_md.py --root . and check-org-repo-literals.sh: pass
  • Deviations:
    • The cursor-review panel's 4 findings are addressed in fc94283: separator-only fail-closed, early-space fallback, the off-by-one boundary, and the caller-guide docs.

🤖 Generated with Claude Code

…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.
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

  • Run on-demand review

This review includes 4 billable files and costs up to $1.00.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

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.

Check out review usage here.

View limit details

Limit 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.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Team
  • Run ID: aec1616b-4f0c-43b4-af42-42a318f41f4b

📥 Commits

Reviewing files that changed from the base of the PR and between d38bd7e and fc94283.


📒 Files selected for processing (4)
  • .github/cursor-approve/README.md
  • .github/cursor-approve/aggregate.py
  • .github/cursor-approve/tests/test_aggregate.py
  • docs/callers/cursor-approve.md


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@mattmillerai mattmillerai added the cursor-review Multi-model cursor review label Oct 9, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔍 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.

Comment thread .github/cursor-approve/aggregate.py Resolved
Comment thread .github/cursor-approve/aggregate.py Resolved
Comment thread .github/cursor-approve/aggregate.py Resolved
Comment thread .github/cursor-approve/README.md Resolved
…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>
@mattmillerai
mattmillerai merged commit 937a5ac into main Oct 9, 2026
8 checks passed
@mattmillerai
mattmillerai deleted the matt/cursor-axis-clamp-headline branch October 9, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cursor-review Multi-model cursor review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants