Repository navigation
fix(openrouter): bound provider diagnostic body reads - #560
vincent-peng wants to merge 1 commit into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesKeep OpenRouter provider-diagnostic deadlines active through response-body reads and remove the unused header-only timeout helper. Example: A free-preset routing failure triggers a provider lookup with --timeout 500ms, but its JSON body takes 1,500ms.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current timeout defect with a focused change; no actionable correctness or security findings remain. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherAfter named-model routing fails, the summary engine fetches optional OpenRouter provider metadata and combines available hints with the original failure guidance. flowchart TD
A[Named model request] --> B[Routing failure]
B --> C[Summary engine]
C --> D[Provider metadata lookup]
D --> E[Deadline covers headers and body]
E --> F[Best effort provider hints]
F --> G[CLI routing guidance]
Technical reviewBest possible solution: Merge the focused deadline fix while retaining best-effort provider hints and the original routing failure. Do we have a high-confidence way to reproduce the issue? The base source clearly ends the deadline before JSON parsing, and the contributor supplies exact-base/head built-CLI traces using a delayed real HTTP body; no reproduction was run during this read-only review. Is this the best way to solve the issue? The native timeout signal fixes the lifetime error at the existing diagnostic owner, removes an obsolete private wrapper, and preserves fast hints, routing guidance, and the original error cause. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against aaccb7c9c30e. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 7, 2026, 8:08 PM ET / November 8, 2026, 01:08 UTC. |
Summary
Named OpenRouter presets such as
freecan wait beyond the configured timeout while fetching optional provider suggestions: the old deadline ended when headers arrived, before JSON parsing.Keep the timeout signal active through the response body. Remove the now-unused private header-only wrapper and replace its unit tests with HTTP and CLI regressions. Routing errors, their original cause, and free-preset guidance remain intact.
Behavior proof
Normal built
dist/cli.jsprocesses at the exact base and head, using a local HTTP fault fixture and a synthetic key. The transport preload rewrites request URLs only; source modules run unchanged.The fixture returns HTTP 404 with
No allowed providers are available for the selected model.for the model request. Its metadata response sends HTTP 200 headers and partial JSON immediately, then delays the remaining JSON for 1,500 ms. The fast control sends complete JSON immediately.Save the self-contained fixture below as
reproduce.mjs. With Node 24 or newer and a built checkout, run:Use the base and head builds for the first command; the second is the fast-response control. The script creates and removes its own HOME, config, input file, transport preload and HTTP server.
Complete standalone fixture
Captured standalone-fixture output on Node 24.22.0 below, annotated with the source commits.
metadataOperationMsmeasures the fixture metadata response, not total CLI duration. Node 26.11.1 reproduced all three outcomes. Each run made one model request and one metadata request; addresses and local paths are normalized.Captured before/after CLI output
[ { "source": "base", "commit": "aaccb7c9c30e9d7a4440fe3a2aa6e8c28c777507", "node": "v24.22.0", "fast": false, "modelRequests": 1, "metadataHeadersSent": true, "metadataBodyCancelled": false, "metadataOperationMs": 1504, "exit": 1, "stdout": "", "stderr": "OpenRouter could not route any models with this API key (no allowed providers). Tried: openrouter/vendor/model:free. Providers to allow: Slow Provider. Hint: increase --timeout (e.g. 10m) and/or use --debug/--verbose to see per-model failures. (OpenRouter: Settings \u2192 API Keys \u2192 edit key \u2192 Allowed providers.)\nTip: run \"summarize refresh-free\" to refresh the free model candidates (writes ~/.summarize/config.json).\n" }, { "source": "fixed", "commit": "e9a153cc00cead592ded714708b0e349fc919b21", "node": "v24.22.0", "fast": false, "modelRequests": 1, "metadataHeadersSent": true, "metadataBodyCancelled": true, "metadataOperationMs": 504, "exit": 1, "stdout": "", "stderr": "OpenRouter could not route any models with this API key (no allowed providers). Tried: openrouter/vendor/model:free. Hint: increase --timeout (e.g. 10m) and/or use --debug/--verbose to see per-model failures. (OpenRouter: Settings \u2192 API Keys \u2192 edit key \u2192 Allowed providers.)\nTip: run \"summarize refresh-free\" to refresh the free model candidates (writes ~/.summarize/config.json).\n" }, { "source": "fixed", "commit": "e9a153cc00cead592ded714708b0e349fc919b21", "node": "v24.22.0", "fast": true, "modelRequests": 1, "metadataHeadersSent": true, "metadataBodyCancelled": false, "metadataOperationMs": 0, "exit": 1, "stdout": "", "stderr": "OpenRouter could not route any models with this API key (no allowed providers). Tried: openrouter/vendor/model:free. Providers to allow: Fast Provider. Hint: increase --timeout (e.g. 10m) and/or use --debug/--verbose to see per-model failures. (OpenRouter: Settings \u2192 API Keys \u2192 edit key \u2192 Allowed providers.)\nTip: run \"summarize refresh-free\" to refresh the free model candidates (writes ~/.summarize/config.json).\n" } ]Validation
pnpm run buildpnpm run check: 3,903 passed, 43 skipped; formatting, localization, lint, type checks and coverage passedNo configuration, cache-format, public API, dependency or model-default changes.