Skip to content

fix(context): compute require_citations gate after max_chars budget#268

Open
Yurii214 wants to merge 1 commit into
vouchdev:testfrom
Yurii214:fix/174-require-citations-after-budget
Open

fix(context): compute require_citations gate after max_chars budget#268
Yurii214 wants to merge 1 commit into
vouchdev:testfrom
Yurii214:fix/174-require-citations-after-budget

Conversation

@Yurii214

Copy link
Copy Markdown

Summary

  • move the require_citations / uncited_items computation to after the max_chars budget step in build_context_pack, so the quality gate only considers claims actually returned in the pack
  • add regression tests covering both the subset invariant (uncited_items ⊆ returned ids) and the case where budget trimming removes all uncited claims before the gate runs

fixes #174.

Why

before this change, uncited was computed over the full pre-budget item list. tail items dropped by max_chars could still appear in quality.uncited_items and trigger a require_citations failure even though the caller never received those claims.

Test plan

  • pytest tests/test_context.py -q
  • ruff check src tests
  • mypy src (CI)

Made with Cursor

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3f3021d9-e780-42e0-bff8-583777b00e24

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@Yurii214

Yurii214 commented Jun 29, 2026

Copy link
Copy Markdown
Author

@plind-junior Hi — gentle ping on this when you have a moment.

Fixes #174require_citations / uncited_items are now computed after the max_chars budget trim in build_context_pack(), so the quality gate only considers claims actually returned to the caller.

Rebased onto latest test (eda296b) and CI is green. Happy to adjust if you’d prefer a different approach.

Thanks for maintaining vouch 🙏

the citation gate and uncited_items listed claims dropped by the max_chars
budget, so a pack could fail require_citations for items the caller never
received. evaluate uncited only over the returned item list.

fixes vouchdev#174.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Yurii214 Yurii214 force-pushed the fix/174-require-citations-after-budget branch from 02f4673 to eda296b Compare June 29, 2026 02:37
@github-actions github-actions Bot added docs documentation, specs, examples, and repo guidance retrieval context, search, synthesis, and evaluation tests tests and fixtures size: S 50-199 changed non-doc lines labels Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs documentation, specs, examples, and repo guidance retrieval context, search, synthesis, and evaluation size: S 50-199 changed non-doc lines tests tests and fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants