Skip to content

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

Closed
luvs01 wants to merge 3 commits into
devfrom
fix/context-overflow-linear
Closed

luvs01 wants to merge 3 commits into
devfrom
fix/context-overflow-linear

Conversation

@luvs01

@luvs01 luvs01 commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

A bounded upstream error could spend seconds in context-overflow negation matching because optional whitespace groups repeatedly repartitioned the same whitespace. The retry helper performs this classification on the shared event loop, delaying unrelated work and cancellation timers.

  • Start curated-aside matches at their words or commas, then consume surrounding whitespace in a deterministic pass within the existing 120-character lookbehind.
  • Preserve newline and comma boundaries, the curated aside vocabulary, overflow/negation decisions, accepted envelope sizes, send budgets and original error responses.
  • Exercise the public classifier and the production transient-retry helper with an injected in-memory 503. Update the owning contracts and English, Spanish and Korean Combo guidance.

Addresses the Daybreak finding.

Verification

Current integration — 2026-11-19

Current head: 42a03581941cf61390130658b16dfa75c16b877f. Actual target-repository dev: 0dc315b95a2493ed1fc6193a555f36d645ea186b, included by a normal merge (zero commits behind at publication). The published GitHub tree exactly matches the locally verified tree 4c5cb2181456fac9a6096102933b40cab78a1895.

This normal merge brings the branch forward from 73 commits behind the actual target branch. The reviewed context-overflow classifier and its regression file are byte-for-byte unchanged; merged guidance preserves the current Combo/runtime contracts and the bounded matching behavior.

  • bun test tests/lib/definite-overflow-verdict.test.ts tests/lib/upstream-retry.test.ts tests/routing/router-combo-failover-classification.test.ts: 321 passed / 0 failed / 2,711 assertions.
  • Runs used the normal repository preload, its unmodified network-egress guard, isolated temporary filesystems and local fixtures. No live provider, live SSH endpoint or installed application was exercised.
  • bun run typecheck: 2,589 files, no errors. Structure validation, privacy scan, file-size ratchet and whitespace checks against actual dev passed.
  • bun test tests/ci-workflows/docs-spanish-localization.test.ts tests/ci-workflows/file-size-ratchet.test.ts: 57 passed / 0 failed / 3,388 assertions.
  • Documentation build passed: 784 pages / 119,870 internal links, with per-process Astro/Vite caches. Dependency declarations and frozen lockfiles match the reused installation.

Independent read-only review checked the word-first aside matching, deterministic surrounding-whitespace folding, unchanged 120-character negation window and clause boundaries. No concrete blocker was found.

The repository's focused-validation exception applies to this integration and concurrent worktrees. The full local suite and broad test:changed were not run; hosted CI provides broader PR coverage. Native macOS/Windows and live-provider acceptance are not claimed.

Hosted CI and review — 2026-11-19 03:22 UTC

Main CI completed successfully; Catalog async contracts completed successfully. These statuses refer to the exact current head above. A queued, running, skipped, cancelled or neutral check is not being represented as a passed test.

Current-head Devin Review completed successfully. CodeRabbit's current-head check is skipped because that app requires a manual review request; its earlier completed review remains historical coverage. All existing inline review threads remain resolved. No new external review comment or review-request message was posted.

The PR remains Ready for review. Successful required CI, maintainer security approval and applicable native-platform acceptance remain separate merge requirements.

Earlier evidence

The earlier exact head 2f486c1c55dc21acd5a74a98b2bef631bf7b32cb passed main CI, attempt 2 and Catalog async contracts. The original validation also made both responsiveness regressions fail before the fix while the clause-boundary control passed, and found no classification differences across 23,400 synthetic combinations. These are historical evidence, not new runs on this head.

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.

The security checkbox records implementation and independent source review; it does not claim maintainer approval.


Devin Review

Summary by CodeRabbit

  • Bug Fixes
    • Context-overflow detection handles whitespace and negation in provider errors more consistently while respecting clause boundaries and repeated negation.
    • Checking lengthy error messages and bounded retry responses remains responsive to timers, and retry responses remain readable.
  • Documentation
    • Updated the context-window refusal guidance in English, Spanish, and Korean to describe provider error handling, whitespace behavior, and clause boundaries.

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The context-overflow detector now folds whitespace around negation asides and applies existing lookbehind and clause-boundary rules. Tests cover verdict classification and timer responsiveness during retry inspection. English, Spanish, and Korean documentation describes the handling.

Changes: Context-overflow detection

Layer / File(s) Summary
Negation-aside folding and verdict boundaries
src/lib/context-overflow-verdict.ts, tests/lib/definite-overflow-verdict.test.ts, structure/runtime.md, structure/transports/responses-combo-boundaries.md, docs-site/src/content/docs/guides/combos.md, docs-site/src/content/docs/es/guides/combos.md, docs-site/src/content/docs/ko/guides/combos.md
The detector folds whitespace around matched negation asides. Tests cover negation across selected asides and its behavior at clause boundaries. The documentation describes whitespace handling and the existing lookbehind and verdict rules.
Bounded-response and timer tests
tests/lib/definite-overflow-verdict.test.ts, structure/data-planes/error-detail.md
Tests check timer responsiveness during inspection of repeated diagnostic text and a bounded 503 response. The retry test also checks that one request is sent and the original response body remains readable.

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Bug fix

Suggested reviewers: lidge-jun, omar391

Merge Risk: Minimal · up to 42a03

The change bounds whitespace handling in context-overflow negation matching, with matching tests and documentation. No concrete merge-blocking risk was found.

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 PR objectives say it bounds negation matching so that repeated whitespace repartitioning no longer delays th…
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 PR objectives say it bounds negation matching so that repeated whitespace repartitioning no longer delays the event loop. The raw summary covers the verdict logic in src/lib/context-overflow-verdict.ts, the new tests for negation asides and a 10 ms timer, and the Combo documentation updates. The title is specific and accurate, and it uses the conventional fix(scope) form.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • 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 2f486c1 and 42a0358.

Files selected for processing: 3

  • docs-site/src/content/docs/es/guides/combos.md
  • docs-site/src/content/docs/guides/combos.md
  • structure/data-planes/error-detail.md

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

@github-actions github-actions Bot added the bug Something isn't working label Nov 16, 2026
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

✅ Deterministic PR hygiene checks passed.

@devin-ai-integration devin-ai-integration 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

luvs01 commented Nov 16, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

luvs01 commented Nov 16, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Preserve the reviewed security fix while integrating dev c36793a.
Focused regressions, typecheck, structure, privacy, size, documentation and independent integration review passed.
@luvs01
luvs01 marked this pull request as ready for review November 18, 2026 00:21
@luvs01

luvs01 commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner Author

No description provided.

@luvs01

luvs01 commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@luvs01

luvs01 commented Nov 20, 2026

Copy link
Copy Markdown
Owner Author

Continued upstream in lidge-jun/opencodex#8980 at 5b2c7f3e955ddcb8781ca8213ca3dd5641d92c6c, based on d61cca122d00899b0a917162875c7c2c659f4952. I checked the published eight-file diff. The classifier file is byte-identical to this PR's head (Git blob 1286a6bce564eb8e2c0f8bb7d99a61a4f32e8677). The updated tests cover clause boundaries, bounded classification and caller cancellation through the retry helper. They use ordinary diagnostic fixtures and add a short matcher-start check that distinguishes the previous implementation.

The five affected suites passed 386 tests. Type checking and the documentation build also passed. The upstream PR is open for review, so this tracking PR can close.

@luvs01 luvs01 closed this Nov 20, 2026
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.

1 participant