Skip to content

fix(retry): bound context-overflow negation matching - #8980

Merged
lidge-jun merged 1 commit into
lidge-jun:devfrom
luvs01:codex/bound-overflow-negation-matching
Nov 21, 2026
Merged

lidge-jun merged 1 commit into
lidge-jun:devfrom
luvs01:codex/bound-overflow-negation-matching

Conversation

@luvs01

@luvs01 luvs01 commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Match curated negation asides at a word or comma and consume their surrounding whitespace once. The shared context-overflow classifier keeps its existing lookbehind, clause boundaries and retry decisions. The English, Spanish and Korean Combo guides and the owning structure documents describe the change.

The regressions cover ordinary negation and punctuation, the start of each aside match, classification near the accepted diagnostic limit, and cancellation through an in-memory transient retry. The matcher-start assertion distinguishes the previous and updated behavior using two short ordinary sentences.

Verification

Validated on Windows x64 with Bun 1.4.4 at 5b2c7f3e955ddcb8781ca8213ca3dd5641d92c6c:

  • bun scripts/test.ts --no-env-file --no-install --isolate --parallel=1 tests/lib/definite-overflow-verdict.test.ts tests/lib/upstream-retry.test.ts passed all 137 tests.
  • bun scripts/test.ts --no-env-file --no-install --isolate --parallel=1 tests/routing/router-combo-failover-classification.test.ts tests/ci-workflows/docs-spanish-localization.test.ts tests/ci-workflows/file-size-ratchet.test.ts passed all 249 tests.
  • bun run typecheck checked 2,681 files. bun run structure:check, bun run privacy:scan and git diff --check passed.
  • The first Astro invocation timed out while loading its Vite configuration. The same installed Astro CLI completed under Node 24.18.0, building 820 pages and checking 126,212 internal links.
  • Shared Windows validation was limited to the five affected suites. The full local suite was omitted.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Summary by CodeRabbit

  • Bug Fixes
    • Improved context-window error detection when provider messages contain extra whitespace or negation phrases.
    • Improved responsiveness when inspecting long error messages or retry responses.
  • Documentation
    • Updated the context-window error guides and runtime documentation to clarify how these errors are identified.

Match negation asides at their semantic tokens, then fold surrounding whitespace in one forward pass. Preserve the bounded classification window and retry decisions. Add boundary, matcher-start and in-memory retry coverage.
@github-actions github-actions Bot added the bug Something isn't working label Nov 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The context-overflow detector now matches negation asides separately from surrounding whitespace. New tests cover clause boundaries, long diagnostics, and abort-timer responsiveness. The English, Spanish, and Korean guides and runtime documentation describe the matching behavior.

Changes: Context overflow verdict

Layer / File(s) Summary
Negation-aside folding and validation
src/lib/context-overflow-verdict.ts, tests/lib/definite-overflow-verdict.test.ts, docs-site/src/content/docs/*/guides/combos.md, structure/data-planes/error-detail.md, structure/runtime.md, structure/transports/responses-combo-boundaries.md
The detector now matches negation asides without including adjacent whitespace, then folds the aside and surrounding whitespace separately. Tests cover negation scope, aside matching, bounded-response classification, and abort-timer responsiveness. The documentation describes these matching rules.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Possibly related PRs

Merge Risk: Minimal · up to 5b2c7

This change makes context-overflow negation matching more bounded while keeping existing classification and retry decisions. No actionable merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(retry): bound context-overflow negation matching" names the main change. The changeset bounds negation-aside matching in the context-overflow verdict (src/lib/context-overflow-verdict.t…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(retry): bound context-overflow negation matching" names the main change. The changeset bounds negation-aside matching in the context-overflow verdict (src/lib/context-overflow-verdict.ts). It also updates the docs and adds tests for the bounded 120-character lookbehind and whitespace handling. The title is specific, short, and uses a conventional commit prefix. It does not list files or use vague terms.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between d61cca1 and 5b2c7f3.

Files selected for processing: 8

  • docs-site/src/content/docs/es/guides/combos.md
  • docs-site/src/content/docs/guides/combos.md
  • docs-site/src/content/docs/ko/guides/combos.md
  • src/lib/context-overflow-verdict.ts
  • structure/data-planes/error-detail.md
  • structure/runtime.md
  • structure/transports/responses-combo-boundaries.md
  • tests/lib/definite-overflow-verdict.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@lidge-jun

Copy link
Copy Markdown
Owner

Maintainer integration into dev (MAINTAINERS.md maintainer-integration exception; lane fb2101-queue-b).

  • Exact head: 5b2c7f3e955ddcb8781ca8213ca3dd5641d92c6c
  • Checks on this head: all completed checks pass (ci aggregate with gates and test changed, CodeRabbit, enforce-target, hygiene); none pending or failing.
  • Review: terra review APPROVE-WITH-NITS after round 2, no correctness regression; definite-overflow/upstream-retry/combo/overflow suites 346 pass, typecheck, structure:check and file-size ratchet exit 0; the matcher-start regression fails on origin/dev source (10 pass / 1 fail). The one nit (a hostile-whitespace performance case) was measured by the maintainer: 15.8K whitespace-heavy input costs 7.0 ms on origin/dev vs 0.3 ms on this head, too small for a stable test, so it is accepted as non-blocking.
  • Review threads: 0 unresolved.
  • Scope: bounded matcher fix in src/lib/context-overflow-verdict.ts plus docs; no auth, workflow, release, dependency or provider-preset surface.

This is maintainer integration, not an independent approval.

@lidge-jun
lidge-jun merged commit 8ec6fdb into lidge-jun:dev Nov 21, 2026
33 checks passed
lidge-jun added a commit that referenced this pull request Nov 21, 2026
…#9028)

* docs(structure): keep error-detail.md within its line budget

Join the sentence added by #8980 onto the preceding line of its paragraph;
the rendered text is unchanged and the doc returns to 600 lines.

* docs(es): translate the Claude Code MCP round-trip section

Restore parity with #8949: the Spanish messaging reference carries the same
claude mcp add example and external link as English, so the Spanish
localization test passes again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants