Skip to content

fix(dedup): Allow reasoning tokens and report output limits - #540

Merged
gricha merged 1 commit into
mainfrom
codex/fix-dedup-token-budgets
Sep 30, 2026
Merged

gricha merged 1 commit into
mainfrom
codex/fix-dedup-token-budgets

Conversation

@gricha

@gricha gricha commented Sep 30, 2026

Copy link
Copy Markdown
Member

Raise the output budget for deduplication and cross-location comparisons from 512 to 8,192 tokens so reasoning models can finish their JSON responses. Truncation now reports output_limit with the model, finish reason, configured limit, and consumed tokens. Failed cross-location consolidation also emits a warning.

#531 started enforcing previously ignored token limits. On sentry-python#7780, Warden 0.50.0 exhausted the 512-token budget and fell back to hash matching, posting repeated findings despite the semantic-matching fix in #536.

Regression tests exercise all three comparison paths through the Pi adapter using captured findings, retain an independent bug, and check truncation diagnostics and telemetry. A local replay using the production auxiliary model completed all seven comparisons at 8,192 tokens; the 512-token control truncated five. The replay absorbed the 14 duplicate initial findings and reduced four follow-up comments to one new IPv6 finding, without posting to GitHub.

Raise finding comparison budgets to 8,192 tokens so reasoning models can
finish semantic comparisons instead of falling back to exact hashes.
Report truncation as output_limit with the model and token diagnostics,
and surface failed cross-location consolidation.

Cover the three comparison paths and truncation reporting with regression
tests based on findings from sentry-python#7780.

Refs getsentry/sentry-python#7780
Co-Authored-By: GPT-6 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
warden-prod Skipped Skipped Sep 30, 2026 5:35pm UTC

Request Review

@vercel
vercel Bot temporarily deployed to Preview – warden-prod September 30, 2026 17:35 Inactive
@gricha
gricha marked this pull request as ready for review September 30, 2026 17:39
@gricha
gricha merged commit 6897c3a into main Sep 30, 2026
19 checks passed
@gricha
gricha deleted the codex/fix-dedup-token-budgets branch September 30, 2026 17:40

@sentry-junior sentry-junior Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me. #531 is what started sending the 512 cap to the provider through the streamFunction wrapper, and a reasoning model can use up that whole budget before it writes any JSON. All three comparison paths now share FINDING_COMPARISON_MAX_TOKENS, and the new Pi tests fail if you put the old 512 back, so the regression is actually covered. I ran pi.test.ts, dedup.test.ts, and extract.test.ts locally and they pass.

One side effect to call out, even though I don't think it blocks: statusFromPiMessage also backs runSkill. Before this change, a length stop during hunk analysis was mapped to provider_error, and analyze.ts turned that into provider_unavailable. Now it becomes sdk_error. That means truncated hunk runs stop counting toward the provider circuit breaker and no longer get the provider-error context or the grouped fingerprint in action error reporting. I think that's the right call, since truncation isn't an outage. But the PR description doesn't mention it, and nothing tests it, so a short test in the analyze path would help lock it in. Also, the "Increase the budget" hint in that error message can't be acted on for skill runs, because runSkill never sets maxTokens. You could show that hint only when maxTokens was passed in.

This branch was successfully deployed

1 active and 1 inactive deployments
Preview – warden — 5ae83d9b Deployed Sep 30, 2026 by vercel[bot]
Preview – warden-prod — 5ae83d9b Deployed Sep 30, 2026 by vercel[bot]
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