Skip to content

fix(tier2): share a repeated text only when that shortens the review prompt - #346

Merged
rng1995 merged 3 commits into
mainfrom
naren/followup-338-share-when-shorter
Nov 5, 2026
Merged

rng1995 merged 3 commits into
mainfrom
naren/followup-338-share-when-shorter

Conversation

@rng1995

@rng1995 rng1995 commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #338, which merged before its last review round. #338 lets Tier 2 send a large repeated-content cluster to the LLM by listing each exactly repeated text once and pointing to it from every member. It shares every repeated text once the request is over budget. A reference line costs 18 characters and a shared block adds a 23-character header, so a short body repeated under long headings gets longer when shared.

That can refuse a cluster that would fit with the short bodies inline. Example on main: 270 sections with long headings and the body See guide., plus 14 sections sharing a 920-character body. The scan stops with llm_prompt_size_limit.

  • build_user_prompt now shares a repeated text only when its block and its references are shorter than its inline copies. The cost is measured with the same helpers that render the block and the reference.
  • docs/tier2-deduplication.mdx, its defaults table and the fix(tier2): review large repeated-content clusters within the prompt budget #338 CHANGELOG entry (Unreleased / Fixed) now say that repeated text is listed once only when that shortens the request.

Why

#338's goal is to finish scans of skills with heavily repeated content instead of marking deduplication incomplete. Sharing that makes the request longer works against that goal, and it fails exactly on skills with many short, repeated sections.

Kept from public

Tests

  • New cases in tests/deduplication/intra_skill/test_intra_llm_analyzer.py and test_intra_skill_validator.py:
    • sharing is skipped when it does not shorten the prompt;
    • a repeated text is shared only when that saves characters;
    • short repeated bodies under long headings stay inline, and the cluster completes through the validator.
  • tests/deduplication, tests/test_ci_workflows.py and tests/test_accuracy_arithmetic.py on current main plus this change: 365 passed, 1 skipped.
  • ruff check and ruff format --check are clean on the changed files, and scripts/check_oss_boundary.py passes.

🤖 Generated with Claude Code

rng1995 and others added 2 commits November 5, 2026 10:27
build_user_prompt shared every exactly repeated text once the request was
over budget. A reference line costs 18 characters and a shared block adds
a 23-character header, so a short body repeated under long headings got
longer when shared. That could push a cluster that fits with the short
bodies inline over the 64,000-character budget: 270 sections with long
headings and the body "See guide." plus 14 sections sharing a
920-character body stopped with llm_prompt_size_limit.

Each repeated text is now shared only when its block and references are
shorter than its inline copies. The cost is measured with the same
helpers that render the block and reference.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The review prompt docs, the defaults table and the CHANGELOG entry now say
that repeated text is listed once only when that shortens the request.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@rng1995
rng1995 marked this pull request as ready for review November 5, 2026 21:40
@rng1995
rng1995 enabled auto-merge (squash) November 5, 2026 21:41
@rng1995
rng1995 merged commit c55ffb8 into main Nov 5, 2026
22 checks passed
@rng1995
rng1995 deleted the naren/followup-338-share-when-shorter branch November 5, 2026 22:23
@rng1995

rng1995 commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

Post-merge review: 3 finding(s) (P3). Follow-up PR: #361.

🤖 Generated with Claude Code

@rng1995 rng1995 mentioned this pull request Nov 6, 2026
7 of 8 tasks
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.

1 participant