Skip to content

fix: point dashscope host at real alibaba catalog provider, drop comfly dead-end (#1434) - #1438

Merged
ranxianglei merged 1 commit into
masterfrom
2026-09-26_registry-host-provider-fix
Sep 27, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-09-26_registry-host-provider-fix

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

What

HOST_TO_PROVIDER (src/registry.ts) mapped two hosts to provider ids that do not exist in the models.dev catalog:

  • coding.dashscope.aliyuncs.com → "dashscope" — no dashscope/ prefix in the catalog (verified against both the bundled snapshot AND the live models.dev fetch on 2026-09-26: 428 keys / 44 providers). All Qwen/DashScope listings live under plain alibaba/ (51 models).
  • ai.comfly.org → "comfly" — no comfly/ prefix either; comfly has no catalog counterpart at all.

Because providerFromHost() returned a defined id for both, lookups took the known-provider path (exact candidates only, cross-provider suffix scan skipped by design per #736), both candidates missed, and resolution fell through to the built-in table/floor — losing the model's declared window, and (once #1285 lands) its actual price stamp.

Fix (option a + option b from the issue)

  • coding.dashscope.aliyuncs.com → "alibaba": first-party endpoint whose models are all listed under alibaba/. Exact provider scoping is safer than a relay max-scan (a cross-provider max could overestimate if another provider listed the same bare name) and yields exact price stamps once feat: expose compress.priceProfile {w,r,q} for cache-economics reports #1285 merges.
  • ai.comfly.org entry dropped: relay semantics are strictly better than a known-provider dead end — absent hosts take the cross-provider suffix scan (窗口溢出报错 #736) with max-window / first-listing-price + conflict warning.

Note on the issue's suggested id: the live catalog has NO alibaba-cn / alibaba-coding-plan(-cn) providers — only plain alibaba exists today, so that is the correct target.

Behavior change (flagged per policy)

  • coding.dashscope.aliyuncs.com: registry hit rate goes from "always miss" → exact hit for every Qwen model listed under alibaba/ (declared window instead of built-in table/floor; real price profile after feat: expose compress.priceProfile {w,r,q} for cache-economics reports #1285). Models genuinely unlisted under alibaba/ still miss, as before.
  • ai.comfly.org: resolution goes from known-provider dead end → relay suffix scan (max declared window across providers; one-time conflict warning when several providers list the same name differently). Strictly more registry hits than before.

No other host's mapping changed; boundary-safe matching semantics untouched (covered by new test).

Overlap note (hot file)

#1285 (2026-09-24_compress-price-profile) edits the same HOST_TO_PROVIDER region of src/registry.ts and adds the price lookup that consumes providerFromHost(). This fix is compatible with it as-is (the host map is the single choke point for both lookups); whichever PR merges second needs a trivial textual rebase of this hunk. Merging this first also means #1285's price stamps work correctly for these hosts from day one.

Regression tests

tests/registry.test.ts:

  • providerFromHost("coding.dashscope.aliyuncs.com") === "alibaba" (+ boundary case evil-coding.… stays undefined);
  • providerFromHost("ai.comfly.org") === undefined (relay path);
  • end-to-end against the bundled snapshot: bundledSnapshotLookup("qwen3-coder-plus", …) returns 1_048_576 for BOTH hosts — before this fix both returned undefined (the dead end).

Minor finding (reported, not bundled)

The bundled snapshot is stale relative to the live catalog (fetchedAt 2026-09-16, 400 models vs 428 live). Refreshing would churn a ~1MB generated file in this diff — intentionally left out; can be a routine npm run registry:snapshot refresh separately.

Pre-flight

  • npm run typecheck ✓
  • npm test ✓ (2842 pass / 0 fail / 12 skipped gated-e2e)
  • npm run build ✓

Fixes #1434

@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-09-26_registry-host-provider-fix (9a756d6)

Option A — Install from npm PR tag (recommended)

npm install -g billion-context@pr-1438

Each push to this PR publishes a new version under the pr-1438 npm tag.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr1438.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 PR #1438 reviewed — mergeable. Direction verified against #1434, full regression inventory, code, test teeth, CI.

① 原 issue 与方向 — Root cause correctly identified: the static HOST_TO_PROVIDER data points at provider ids absent from the catalog bili actually consumes; the lookup split (known-provider exact candidates vs relay suffix scan, #736) works as designed and is untouched. I re-verified the catalog facts today against both sources bili uses:

  • Bundled snapshot (src/registry-snapshot.json, fetchedAt 2026-09-16, 400 models): 0 dashscope/, 0 comfly/, only plain alibaba/ (49 models); alibaba/qwen3-coder-plus = 1_048_576 ctx / 65536 out.
  • Live models.dev/models.json (fetched today): 428 keys / 44 providers — exactly the PR body's numbers; same absences; alibaba/qwen3-coder-plus present; exactly ONE */qwen3-coder-plus listing, so the comfly relay scan finds a single match (no conflict warning in practice).
  • Clarification for future readers: models.dev/api.json (a different, larger dataset — 223 providers) does contain alibaba-cn, alibaba-coding-plan(-cn), alibaba-token-plan(-cn). Bili never loads api.json — both the snapshot script (scripts/update-registry-snapshot.mjs:24) and the runtime fetch (src/registry.ts:10) use models.json — so "no alibaba-* variants exist" is correct for the consumed key space, and plain alibaba is the right exact target. Watch item: if models.dev ever adds those variants to models.json, revisit at the next snapshot refresh.

② 回归清点 (existing behaviors on the touched paths):

  • The other 10 host mappings: byte-identical → preserved.
  • Boundary-safe suffix matching in providerFromHost (src/registry.ts:218-230): logic untouched; new test pins evil-coding.dashscope.aliyuncs.com → undefined → preserved.
  • Known-provider vs relay-scan split (窗口溢出报错 #736) in registryLookup (src/registry.ts:334-372): untouched → preserved.
  • coding.dashscope.aliyuncs.com (+ subdomains): context-window resolution "always miss → table/floor" → exact alibaba/ hits. Intended, flagged by author. Same-class side effect worth stating explicitly: the [Question] preflight 摘要为空就判定"上游没返回内容" —— thinking 默认模型的 reasoning_content 是否有意不参与? #853 output-ceiling path (peekRegistryOutputLimit at src/preflight.ts:276 and src/server.ts:2104) also flips from "undefined → default clamp" to "min(default, declared output)" for alibaba-listed models — min() guarantees it is never looser than before. And feat: expose compress.priceProfile {w,r,q} for cache-economics reports #1285's price stamps (pending) consume the same map — correct for these hosts from day one, as claimed.
  • ai.comfly.org: dead end → relay max-scan. Intended, flagged. Residual caveat (accepted 窗口溢出报错 #736 semantics): a relay max can overestimate one particular deployment's real window; the one-time conflict warning fires only when listings disagree (it won't, for qwen3-coder-plus today — single listing).
  • Snapshot staleness (400 vs 428 live models): author-disclosed, deliberately excluded; a routine npm run registry:snapshot follow-up is enough — no separate issue needed.

③ 代码 — Two-line data change plus two explanatory comments citing #1434/#736; zero logic edits. Right layer: fixes the producer (bad map data), not a symptom mask.

④ 测试有效性 — Teeth present: exact mapping assertions (any revert to "dashscope" fails), the boundary case, and end-to-end bundledSnapshotLookup("qwen3-coder-plus", host) === 1_048_576 for BOTH hosts against the shipped snapshot (returned undefined pre-fix). Minor non-blocking gap: no pin on the output field (bundledSnapshotOutputLimit) — same code path, low risk.

⑤ Diff 整洁度 — +24/−2 over src/registry.ts + tests/registry.test.ts; every line purpose-related; no lockfile/version/generated churn. Base is fresh (merge-base = current master tip), single linear commit.

CI — all 12 checks green on head 9a756d6f (test matrix ubuntu/windows × node 22/24, build-artifact, version-guard, hermetic registry e2e, real-client lanes). Local spot-check on the same head: typecheck ✓, tests/registry.test.ts 22/22 ✓.

Overlap with #1285 (open, same HOST_TO_PROVIDER hunk): disclosed accurately; whichever merges second needs a trivial textual rebase. Merging this first is the better order (price stamps correct from day one).

Auto-merge gate: all conditions met (single-module pure fix:, regression tests, green on rebased head, no wire/schema/persistence/cross-repo changes, clean diff, Fixes #1434). Merge is human-only — please merge at your convenience: #1438

中文摘要:审查了 HOST_TO_PROVIDER 映射修复(dashscope→alibaba、删除 comfly 走 relay 扫描)——方向打中根因(静态映射数据错误,而非查找逻辑),目录事实已独立复核(bili 实际消费的是 models.json 而非 api.json,其中确实只有裸 alibaba),回归清点未发现意外行为漂移(含 #853 输出上限的同向受益),测试有牙、CI 全绿、diff 干净,可以合并。

@ranxianglei
ranxianglei merged commit eca1603 into master Sep 27, 2026
12 checks passed
@ranxianglei ranxianglei mentioned this pull request Sep 27, 2026
@ranxianglei
ranxianglei deleted the 2026-09-26_registry-host-provider-fix branch October 15, 2026 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HOST_TO_PROVIDER maps dashscope/comfly hosts to provider ids absent from the models.dev catalog → no registry window/price stamps for those hosts

1 participant