GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(routing): let fallback skip a candidate the request cannot fit by lidge-jun · Pull Request #1850 · lidge-jun/opencodex

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Aug 16, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Owner

Summary

An oversized request was never silently sent — checkInputAdmission (src/server/responses/input-admission.ts:159) already refuses it before any upstream I/O, and it runs on every concrete retry. The defect #1524 describes is what happens next: that local 413 was classified request_too_large, which comboFailureDecision treats as stop, so the first candidate whose context window was too small ended the fallback chain. A larger-window candidate sitting behind it was never tried.

The local preflight refusal now carries its own code, input_admission_refused, and that code is hop-eligible. The distinction is the point:

  • input_admission_refused is our verdict about this candidate, so another candidate may well fit.
  • Upstream context_length_exceeded, and a generic 413 with no structured code, still stop — retrying those elsewhere is guesswork.

The code is read from the structured field, the classified error, and the body text, because the generic classifier maps 413 to its own code and would otherwise swallow the signal on the text path.

Nothing here truncates history or drops images to force a fit; an incompatible candidate is skipped, not squeezed.

Scope note. This is the half of #1524 that is provably wrong today and safe to fix now. The broader "re-evaluate every fallback candidate against fresh request evidence" work needs a model-independent context estimate threaded into PolicyRequestEvidence (which currently leaves request size unknown) and has to reconcile evaluator exact-fit semantics with ADMISSION_TOLERANCE = 2.5; that design is written up in devlog/_plan/260816_wave34_closeout/090_1524_capability_preflight.md and is not in this PR.

Refs #1524.

Verification

  • bun test tests/combos.test.ts — 37 pass / 0 fail, including a new case pinning that input_admission_refused hops while upstream context_length_exceeded and a bare 413 still stop. Driven red with the branch disabled.
  • bun test tests/policy-execution.test.ts tests/routing-profile.test.ts — green.
  • bun x tsc --noEmit — clean.

Checklist

  • Focused regression test added near the existing failover tests
  • Typecheck clean
  • Targets dev
  • No user-facing config surface added

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of requests rejected before processing due to input limits, allowing eligible failover behavior.
    • Distinguished local input-admission refusals from upstream context-length errors.
    • Preserved terminal handling for upstream context-length and generic request-size errors.
    • Maintained the existing HTTP 413 response and explanatory message for locally rejected requests.
  • Tests

    • Added coverage for local refusals, upstream context-limit errors, and generic 413 responses.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@lidge-jun
fix(routing): let fallback skip a candidate the request cannot fit
d18781c
An oversized request was never silently sent -- `checkInputAdmission` already
refuses it before any upstream I/O. The defect is what happens next: that local
413 was classified `request_too_large`, which `comboFailureDecision` treats as
`stop`, so the FIRST candidate whose context window was too small ended the
fallback chain. A larger-window candidate sitting behind it was never tried.

The local preflight refusal now carries its own code, `input_admission_refused`,
and that code is hop-eligible. The distinction is the whole point:

- `input_admission_refused` is OUR verdict about THIS candidate, so another
  candidate may well fit.
- upstream `context_length_exceeded`, and a generic 413 with no structured
  code, still stop -- retrying those elsewhere is guesswork.

The code is read from the structured field, the classified error and the body
text, because the generic classifier maps 413 to its own code and would
otherwise swallow the signal on the text path. Driven red with the branch
disabled.

Nothing here truncates history or drops images to force a fit; an incompatible
candidate is skipped, not squeezed.

Refs #1524.
@lidge-jun
lidge-jun requested review from Ingwannu and Wibias as code owners August 16, 2026 16:04
@github-actions

github-actions Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

coderabbitai Bot commented Aug 16, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e844a5d3-e77d-4d19-87ed-0df63d699b2e

📥 Commits

Reviewing files that changed from the base of the PR and between 73440d4 and d18781c.

📒 Files selected for processing (3)
  • src/combos/failover.ts
  • src/server/responses/core.ts
  • tests/combos.test.ts

Included review availability: Your plan includes up to 10 reviews per rolling hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The response layer now emits input_admission_refused for local context-window admission failures. Combo failover recognizes this code, classified error, or message text as hop-worthy. Tests preserve terminal handling for upstream context-limit and generic 413 errors.

Changes

Input admission failover

Layer / File(s) Summary
Admission refusal error classification
src/server/responses/core.ts:1972-1979
Local context-window admission failures return HTTP 413 with error code input_admission_refused instead of request_too_large.
Combo failover behavior and regression coverage
src/combos/failover.ts:127-136, tests/combos.test.ts:360-367
comboFailureDecision returns "hop" for structured, classified, or message-based input_admission_refused failures. Upstream context_length_exceeded and generic 413 errors still return "stop".

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

Merge Risk: ⚪ Minimal · up to d1878

This localized change lets fallback skip a candidate rejected by local input admission while preserving stop behavior for upstream context errors; the reported tests and typecheck are clean, and no actionable merge-blocking risk remains beyond normal checks.

Possibly related PRs

  • lidge-jun/opencodex#1003: Related changes to response error classification and combo failover handling.
  • lidge-jun/opencodex#1281: Related combo failure classification and failover behavior.

Suggested reviewers: wibias, ingwannu

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main routing change: fallback can skip candidates that cannot fit the request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fallback-input-admission-hop

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
  • X
  • Mastodon
  • Reddit
  • LinkedIn

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot]
chatgpt-codex-connector Bot reviewed Aug 16, 2026
View reviewed changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d18781cca9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/server/responses/core.ts
return formatErrorResponse(
413,
"request_too_large",
"input_admission_refused",

@chatgpt-codex-connector chatgpt-codex-connector Bot Aug 16, 2026

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

P1 Badge Preserve the admission code in the emitted error

When this preflight rejects an oversized non-compaction request, formatErrorResponse passes the message through classifyError; because the message contains “context window,” the formatter emits code: "context_length_exceeded" rather than input_admission_refused. The combo and policy fallback layers therefore receive the existing stop code and never try the larger candidate. Preserve the explicit local-admission code in the serialized response and add focused coverage using the actual formatter or handler output rather than a hand-written error body.

AGENTS.md reference: src/AGENTS.md:L24-L26

Useful? React with 👍 / 👎.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/combos/failover.ts
Comment on lines +132 to +134
if (options?.code === "input_admission_refused"
|| error.code === "input_admission_refused"
|| message.includes("input_admission_refused")) {

@chatgpt-codex-connector chatgpt-codex-connector Bot Aug 16, 2026

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

P1 Badge Honor the structured admission code before message inference

Even if the response is changed to preserve input_admission_refused, the real admission message still contains “context window,” so classifyError infers context_length_exceeded and the earlier stop branch returns before this new structured-code check runs. Consequently, comboFailureDecision(413, <real admission body>, { code: "input_admission_refused" }) still returns stop; check the authoritative structured code before the inferred context error and cover the real admission message in the regression test.

AGENTS.md reference: src/AGENTS.md:L24-L26

Useful? React with 👍 / 👎.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@lidge-jun
lidge-jun merged commit 8f7a22f into dev Aug 16, 2026
26 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai coderabbitai Bot mentioned this pull request Aug 16, 2026
fix(combos): let a local input-admission refusal actually hop the fallback chain #1864
Merged
4 of 5 tasks
@lidge-jun
lidge-jun deleted the codex/fallback-input-admission-hop branch August 17, 2026 10:52
agentHits pushed a commit to agentHits/opencodex that referenced this pull request Sep 17, 2026
@lidge-jun
Merge pull request lidge-jun#1850 from lidge-jun/codex/fallback-input…
845f622
…-admission-hop

fix(routing): let fallback skip a candidate the request cannot fit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@chatgpt-codex-connector chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] left review comments
@Ingwannu Ingwannu Awaiting requested review from Ingwannu Ingwannu is a code owner
@Wibias Wibias Awaiting requested review from Wibias

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

bug Something isn't working

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@lidge-jun
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.