Skip to content

fix(claude): avoid repeated disabled model scans at launch - #8946

Merged
lidge-jun merged 4 commits into
lidge-jun:devfrom
oliver-mee:fix/claude-catalog-timeout
Nov 20, 2026
Merged

lidge-jun merged 4 commits into
lidge-jun:devfrom
oliver-mee:fix/claude-catalog-timeout

Conversation

@oliver-mee

@oliver-mee oliver-mee commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • ocx claude can skip automatic [1m] marking when a large model catalogue makes its startup read miss the 3-second deadline. The launch view now skips dashboard-only previews, and both the dashboard and shared picker filter use direct exclusion lookups instead of scanning the whole list for each row.
  • Raw and encoded exclusions, combo aliases, selected model policy and context metadata keep their existing behavior. The context warning is in English and names the deadline when it times out. The deadline is unchanged.

Closes #8945

Verification

  • bun run test tests/claude-integration/claude-cli.test.ts tests/claude-integration/claude-management-api.test.ts tests/codex-integration/codex-catalog.test.ts tests/providers/provider-antigravity-family-catalog.test.ts: 529 passed. The warning assertions failed on unmodified dev. The HTTP regression covers the authenticated launch response, dashboard previews and picker, including slash-bearing exclusions and [1m].
  • bun run typecheck, bun run privacy:scan, bun run structure:check, and cd docs-site && bun install --frozen-lockfile && bun run build: passed.
  • bun scripts/test.ts --changed=upstream/dev on macOS: 58,538 passed, 297 skipped, 6 failed. A paired rerun of the five affected files on this head and pristine ca96ead01 reproduced the same six failures on both, with 84 passes and one skip on each. The failures cover npm update recovery, connected runtime fallback, the child binary prerequisite, native catalog omission, and two composed Codex-off cases.
  • The full unfiltered suite was not run: changed-mode already exercised 2,508 files and took about 13 minutes, and the focused coverage above exercises the changed behavior. Full and cross-platform coverage remains with upstream CI.

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. No auth or admission change; the warning does not print raw errors.

Developed with AI agents, with a human in the loop. Model: gpt-6.2-sol.

Maintainer follow-up commits (lidge-jun)

  • 1bf54d9f12 moves the exclusion case byte for byte into the registered sibling tests/codex-integration/codex-catalog-exclusions.test.ts. codex-catalog.test.ts had grown past its file-size cap (7,985).
  • ef9dcf04d1 adds a behavioral fail-before. With the merge-base agent-settings-routes.ts, GET /api/claude-code?view=launch calls the alias builders 2 times; with this fix it calls them 0 times.
  • Validation on ef9dcf04d1: claude-management-api, claude-cli, codex-catalog, codex-catalog-exclusions and the file-size ratchet: 537 pass, 0 fail. The independent terra review re-ran 569 focused tests, typecheck and structure:check (all exit 0). Full local suite: NOT RUN (resource exception); CI covers it.

Maintainer refresh (lidge-jun)

7fd83f6e74 merges current dev (28 commits behind) into the branch with a merge commit; the only auto-merge was structure/gui-and-management-api.md, with no conflicts. Validation on 7fd83f6e74: claude-management-api, claude-cli, codex-catalog-exclusions, ratchet and layout guards: 228 pass, 0 fail. Typecheck and structure:check pass.

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • Required local validation passed; commands, results, and any full-suite exception are documented.

  • I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

Summary by CodeRabbit

  • Bug Fixes

    • Disabled-model exclusions now consistently hide matching routed models from availability lists, aliases, and pickers.
    • Claude Code warnings distinguish context-loading timeouts from other failures and clarify that automatic [1m] marking was skipped—not that the provider reduced the model’s context limit.
  • Documentation

    • Clarified timeout behavior and which previews and checks the Claude Code launch view skips.

Keep the authenticated launch view out of dashboard-only preview work and
check raw and encoded exclusions through the existing set. Report a context
read timeout explicitly without changing its deadline.
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Disabled-model filtering now recognizes raw and routed slugs in the catalog and Claude Code settings route. Claude Code context-fetch warnings distinguish timeouts from other failures. The launcher retains an empty context-window map when fetching fails.

Changes: Model visibility and Claude Code context loading

Layer / File(s) Summary
Routed-slug matching and catalog visibility
src/providers/slug-codec.ts, src/codex/catalog/model-visibility.ts, tests/codex-integration/codex-catalog-exclusions.test.ts
The new hasRoutedSlug helper checks raw slugs and encoded routed slugs for model IDs containing /. Catalog disabled-model filtering uses the helper while retaining its public combo-alias exclusion. Tests cover raw, encoded, and alias exclusions.
Claude settings filtering
src/server/management/agent-settings-routes.ts, tests/claude-integration/claude-management-api.test.ts, structure/gui-and-management-api.md
The /api/claude-code route filters routed models once and reuses the available list for selectors and aliases. Integration tests check launcher, management, and picker results, and verify that the launcher view skips alias previews. The management API description reflects the skipped previews.
Context-fetch warnings and documentation
src/cli/claude.ts, tests/claude-integration/claude-cli.test.ts, docs-site/src/content/docs/guides/claude-code.md
Timeout failures report the configured duration; other failures use a generic warning. Both warnings state that automatic [1m] marking is skipped, and both paths return an empty context-window map. Tests check that warnings omit raw error text. The troubleshooting guide describes the timeout case.

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

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

  • lidge-jun/opencodex#8951 concerns a separate static-catalogue bottleneck. This diff does not change the catalogue builder’s policy merge.
Merge Risk: Minimal · up to 7fd83

This change speeds up the model-catalogue filtering that runs when ocx claude starts, and it adds an English timeout warning. No 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(claude): avoid repeated disabled model scans at launch" matches the main change. The linked issue and PR objectives describe repeated exclusion-list scans during ocx claude launch, and …
Linked Issues check Passed Only direct linked issue #8945 applies. Its coding requirements are: (1) keep the Claude context read within the existing 3 s deadline when about 2,400 routed models and about 2,400 disabled entries a…
Out of Scope Changes check Passed Each changed area maps to #8945 or to supporting work:
- src/server/management/agent-settings-routes.ts: skips dashboard previews on the launch view and reuses one filtered list. This implements the…
Full details: Title check

Explanation

The title "fix(claude): avoid repeated disabled model scans at launch" matches the main change. The linked issue and PR objectives describe repeated exclusion-list scans during ocx claude launch, and the changeset replaces those scans with a direct lookup via hasRoutedSlug in model-visibility.ts, slug-codec.ts, and agent-settings-routes.ts. The title is concise, specific, and follows conventional-commit style. It does not cover the timeout warning or the skipped previews, which is acceptable.

Full details: Linked Issues check

Explanation

Only direct linked issue #8945 applies. Its coding requirements are: (1) keep the Claude context read within the existing 3 s deadline when about 2,400 routed models and about 2,400 disabled entries are present, (2) honor raw and encoded exclusions, including namespaced IDs with inner slashes, and (3) emit an English timeout warning.

Requirement (1) [#8945]: The launch view in src/server/management/agent-settings-routes.ts (GET /api/claude-code) skips dashboard-only previews. The route filters routed models once into availableRouted and reuses that list. The per-row scans in src/codex/catalog/model-visibility.ts now call hasRoutedSlug (src/providers/slug-codec.ts). Helper confirmed at head: hasRoutedSlug performs set has() lookups on provider/id and, for slash-bearing IDs, on routedSlug(provider, id). The author reports Linux arm64 runs with 2,400 mock models and 2,459 exclusions: launcher time fell from 7.0–9.6 s to 1.6–2.4 s, and context requests fell from 6.0–9.7 s to 0.27–0.29 s. These timings are author-reported; I did not re-run them. The maintainer fail-before (ef9dcf04d1) reports alias builders called 2 times on the merge base and 0 times with the fix.

Requirement (2) [#8945]: hasRoutedSlug covers raw and encoded forms. Tests in tests/codex-integration/codex-catalog-exclusions.test.ts and tests/claude-integration/claude-management-api.test.ts cover raw and encoded exclusions and slash-bearing IDs.

Requirement (3) [#8945]: The PR reports that src/cli/claude.ts now emits an English timeout warning naming the deadline, and that claude-cli.test.ts asserts it. I read the warning text only through the change summary; the fetchClaudeCodeState hunk was beyond the read limit.

Residual limit: The PR reports that a config-declared 2,400-model stress run still timed out. The PR assigns that path to #8952 and calls it a separate bottleneck. The issue reproduction uses a discovered routed catalogue, so this PR meets the issue's stated shape. The issue does not cover the config-declared path.

Full details: Out of Scope Changes check

Explanation

Each changed area maps to #8945 or to supporting work:

  • src/server/management/agent-settings-routes.ts: skips dashboard previews on the launch view and reuses one filtered list. This implements the performance requirement.
  • src/providers/slug-codec.ts: adds hasRoutedSlug, the lookup helper that replaces scans.
  • src/codex/catalog/model-visibility.ts: switches disabled-model matching to hasRoutedSlug and keeps the public-alias exclusion for non-native combo aliases, as the PR states.
  • src/cli/claude.ts: changes the timeout warning to English and names the deadline. This implements requirement (3).
  • tests/*: regression coverage for the changed behavior. The exclusion test moved to a registered sibling file for the file-size cap. This is a supporting change.
  • docs-site/src/content/docs/guides/claude-code.md and structure/gui-and-management-api.md: document the launch-view behavior and the warning.

I found no hunk unrelated to #8945. Uncertainty: the whole-PR base is efd711e76e, and the PR merged dev at 7fd83f6e74. I did not inspect the full merged diff. The file list in the change summary contains only related files. The six failing tests in the changed-mode run reproduce on the pristine base and are not attributed to this PR.

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 e6b9db2 and 7fd83f6.

Files selected for processing: 2

  • tests/claude-integration/claude-management-api.test.ts
  • tests/codex-integration/codex-catalog-exclusions.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.

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

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ READY

  • all PR quality gates passed; the review readiness checklist is complete.

Review readiness checklist

  • ✅ Required local validation passed; commands, results, and any full-suite exception are documented.
  • ✅ I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
  • ✅ I resolved all correct Codex and CodeRabbit findings.
  • ✅ My PR is ready for review.

✅ 4/4 boxes ticked.

This pull request is already Ready for Review.
The review-ready label marks this PR as ready; review automation runs independently.
Maintainers: @lidge-jun @Ingwannu

Hygiene

✅ Deterministic PR hygiene checks passed.

@github-actions
github-actions Bot marked this pull request as ready for review November 19, 2026 08:33
@oliver-mee

oliver-mee commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

I ran ocx claude --version three times per build on Linux (arm64), using Claude Code 2.1.328 and a warmed local proxy. Both builds used the same fixture: 2,400 models discovered from mock providers, 2,459 exclusions, and an empty picker cache before each launch. Base: ca96ead01. PR head: e6b9db2dd.

What was measured Base PR head
Launcher through Claude Code exit 7.0 to 9.6 s 1.6 to 2.4 s
Context metadata request, timed separately 6.0 to 9.7 s 0.27 to 0.29 s
Picker request, timed separately 2.0 to 2.4 s 0.21 to 0.25 s

On base, all three launches printed both warnings, passed an unmarked model to Claude Code, and left the picker cache unwritten. On the PR head, all three reached the real Claude Code binary without either warning, passed the selected model with [1m], and wrote a fresh cache with 331 entries.

A separate stress run with all 2,400 models declared directly in config still hit timeouts on the PR head. The separate static-catalogue bottleneck is addressed in #8952. These results establish the improvement for the discovered catalogue fixture, not a latency guarantee for every large config. No interactive session or inference request was used.

codex-catalog.test.ts is capped at 7985 lines by the file-size ratchet; the
added case grew it past the cap. Move the case byte for byte into the existing,
already-registered codex-catalog-exclusions.test.ts.
@github-actions
github-actions Bot marked this pull request as draft November 20, 2026 18:31
…#8945)

On the base, GET /api/claude-code?view=launch built every dashboard alias
before its early return; the launcher never reads them. Spy the alias builders
and require zero calls for the launch view.
@github-actions
github-actions Bot marked this pull request as ready for review November 20, 2026 19:27
@lidge-jun

Copy link
Copy Markdown
Owner

Maintainer integration (lidge-jun, dev) on exact head 7fd83f6e74a6b619ac499ca22b6cecd5f1c7e084.

  • Independent review: terra reviewer (gpt-6.1-terra) APPROVE in round 2 after maintainer follow-ups. 1bf54d9f12 moved the exclusion case to the registered sibling codex-catalog-exclusions.test.ts to stay under the file-size cap. ef9dcf04d1 adds a behavioral fail-before: with the merge-base route, ?view=launch calls the alias builders 2 times; with the fix, 0. 7fd83f6e74 merges current dev.
  • Required checks, all successful on this head: gates, test changed, Catalog async contracts, enforce-target, hygiene, label, CodeRabbit (runs: PR gates 44802923404, PR gates 44802297970, Catalog async contracts 44796214858, ocx-ci-v1 lane=all sha=16abf5ffb4c06a54b4bc6345db6f110add75f0d0 44796214850).
  • Union check against current dev (git merge-tree --write-tree origin/dev 7fd83f6e74): clean. No touched file exceeds its file-size cap in the merged tree.
  • Fork CI approval: the diff changes no .github/**, workflow-executed scripts or install hooks. Approval-gated workflows run on pull_request with read-only permissions and no secrets.

Verification

  • Focused on 7fd83f6e74: claude-management-api, claude-cli, codex-catalog-exclusions, ratchet and layout guards: 228 pass, 0 fail. The reviewer ran 569 focused tests. Typecheck and structure:check pass.
  • Batch gate: dev batch run 44797426884 completed 43/43 jobs green apart from two Windows shards cancelled by timeout on unrelated files; the coordinator authorized resuming merges.
  • Full local suite: NOT RUN (resource exception; parallel lane worktrees on one host). CI test changed covers import-connected tests, and the batched dev dispatch covers the full and cross-platform suites.

@lidge-jun
lidge-jun merged commit 5c008e0 into lidge-jun:dev Nov 20, 2026
39 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working review-ready

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] ocx claude times out loading model context with a large disabled model list

2 participants