Commit e94eb20
* feat(snowflake-cortex): close model-coverage gap vs Snowflake docs (#851)
Closes #851. altimate-code hardcodes the Snowflake Cortex model list in
`provider.ts` (it doesn't auto-discover via `/v1/models` — Snowflake's
endpoint has non-standard semantics that break standard clients). The
list had drifted behind Snowflake's regional availability matrix, so
several models that work on Cortex couldn't be selected from the
picker — most visibly `claude-opus-4-7`, which prompted the report.
Adds the 8 missing models per Snowflake's current regional availability
matrix:
- Claude: `claude-opus-4-7` (toolcall: true)
- OpenAI: `openai-gpt-5.1`, `openai-gpt-5.2` (toolcall: true)
- Llama: `llama4-scout`, `llama3.3-70b`, `snowflake-llama-3.1-405b`
(toolcall: false)
- Mistral: `mixtral-8x7b` (toolcall: false)
- Gemini: `gemini-3.1-pro` (toolcall: false — tool calling unverified
on Cortex; conservative default per the rule that only Claude+OpenAI
reliably support tools today)
Also updates `TOOLCALL_MODELS` in `snowflake.ts` to include the new
Claude and OpenAI entries so request transform doesn't strip tools.
Documents the config-extension escape hatch for the next drift cycle:
users can add a model under `provider['snowflake-cortex'].models` in
`opencode.json` and it merges into the built-in list (mechanism wired
at provider.ts:1320-1399). New section in
`docs/docs/configure/providers.md` shows the pattern so users don't
need to fork or wait for a release when Snowflake adds a model.
Tests:
- `models added per Snowflake regional availability docs (issue #851)`
asserts every newly-added model is defined with the right toolcall
capability.
- `user can register a model not in the hardcoded list via opencode.json`
exercises the config-extension path end-to-end.
50 → 52 tests pass in `test/provider/snowflake.test.ts`; typecheck clean.
Longer-term, true auto-discovery (a Snowflake-specific shim around
`POST /api/v2/cortex/v1/models` or the GET-with-body variant) would
eliminate drift entirely — flagged on the issue for maintainer input.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(snowflake-cortex): consensus review fixes — limits + escape hatch
Addresses the consensus code review on PR #866. Two critical bugs found
by independent verification against Snowflake's regional availability
docs (https://docs.snowflake.com/en/user-guide/snowflake-cortex/aisql-regional-availability):
1. **Correct context/output limits on every newly-added model.** The
initial commit inferred limits from sibling models; cross-check
against the doc showed most were wrong, and `snowflake-llama-3.1-405b`
was off by 16× on context (would silently fail any prompt above 8k
tokens). Updated values:
- `claude-opus-4-7`: 200000/32000 → 1000000/128000
- `openai-gpt-5.1`: 1047576/32768 → 272000/8192
- `openai-gpt-5.2`: 1047576/32768 → 272000/8192 (not in restrictions
table; using gpt-5 family defaults with a comment)
- `llama4-scout`: 1048576/4096 → 128000/8192
- `llama3.3-70b`: 128000/4096 → 128000/8192
- `snowflake-llama-3.1-405b`: 128000/4096 → 8000/8192
- `mixtral-8x7b`: 32000/4096 → 32000/8192
- `gemini-3.1-pro`: 1048576/8192 → 1000000/64000
2. **Fix the documented opencode.json escape hatch for tool-capable
user-added models.** The `TOOLCALL_MODELS` hardcoded set in
`snowflake.ts` was a second source of truth that the picker
capability had to be kept in sync with. Worse, the docs change in
the first commit told users they could mark a custom model
`"tool_call": true` — but the request transform consulted only the
static set, so user-added models had `tools` silently stripped at
request time even though the picker advertised them as tool-capable.
Replaced the hardcoded set with `buildToolCapableSet(models)` —
the loader walks `provider.models` (which already includes any
models the user registered via `opencode.json`) and derives the
allowlist from `capabilities.toolcall`. Single source of truth;
the picker and the transform can't drift; the escape hatch works.
`transformSnowflakeBody` now takes an explicit allowlist parameter;
the loader passes the dynamically-built set. Existing call sites
updated to pass a shared `TOOLCAPABLE_FIXTURE`.
Also folded into this commit:
- Comments distinguishing `llama3.3-70b` (upstream Meta) from
`snowflake-llama-3.3-70b` (Snowflake-hosted variant).
- Doc note clarifying the `tool_call` snake_case field maps to
`capabilities.toolcall`.
- The "models added per Snowflake regional availability docs (issue
#851)" regression test now asserts `limit.context` and `limit.output`
per model in addition to identity and toolcall capability.
- New tests:
- `buildToolCapableSet derives the allowlist from provider model
capabilities` — parity between picker and transform.
- `escape-hatch model with tool_call: true retains tools through
transformSnowflakeBody` — end-to-end check the escape hatch
actually works for tool-capable user models.
- `escape-hatch model with tool_call: false has tools stripped
through transformSnowflakeBody` — the inverse, mirroring the
built-in Llama/Mistral behavior for user-registered non-tool models.
Deferred (per maintainer guidance pending @anandgupta42's input on
the long-term auto-discovery question):
- Removing the legacy `claude-3-7-sonnet`, `claude-3-5-sonnet`,
`openai-gpt-5-chat` entries — kept per the original PR description.
- Auto-discovery shim around Snowflake's `/api/v2/cortex/v1/models` —
out of scope until maintainer green.
Tests: typecheck clean across all 5 packages; 55/55 in
`test/provider/snowflake.test.ts` (was 52, +3 net for new coverage).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs: use canonical `altimate-code.json` config filename
Reviewer caught my providers.md addition referring to `opencode.json`
(and `.opencode/opencode.json`). Both names are accepted by the config
loader (config.ts:1541 candidates: `altimate-code.json`, `opencode.jsonc`,
`opencode.json`, `config.json`) but the rest of the docs standardize on
`altimate-code.json` — `docs/docs/configure/config.md` uses the canonical
name 9× and `opencode.json` 0×. My section was the inconsistent one.
Root cause: I used `opencode.json` because that's the upstream project's
name and what the snowflake tests happen to use. But this is the
altimate-code fork; user-facing docs use the fork's canonical name.
Updates `providers.md` "Adding a model not in the list" section and the
three `altimate_change`-introduced comments in `snowflake.ts` to use
`altimate-code.json` consistently. Tests left using `opencode.json`
literals — they're exercising the loader (which accepts both) and
swapping them would be churn without behavior change.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: use tmpdir({ config }) helper instead of manual Bun.write in init
Bot review nit from CodeRabbit on the second review pass: tests added
in this PR were calling `tmpdir({ init: async (dir) => Bun.write(...) })`
to seed a project config, but the fixture already exposes a dedicated
`config` option that does exactly that. Switching to the helper is
shorter, matches the codebase guideline, and centralizes the
`$schema` boilerplate.
Affects the 5 tests added by this PR:
- models added per Snowflake regional availability docs (issue #851)
- buildToolCapableSet derives the allowlist from provider model
capabilities
- user can register a model not in the hardcoded list via
altimate-code.json (also renamed from `via opencode.json` for
canonical consistency with the docs)
- escape-hatch model with tool_call: true retains tools through
transformSnowflakeBody
- escape-hatch model with tool_call: false has tools stripped through
transformSnowflakeBody
Pre-existing tests in the same file follow the old pattern; left
out of scope to avoid churn in unrelated code.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix: bot-review findings on snowflake-cortex PR
Three valid findings from cubic + a human reviewer's auto-discovery
documentation request, addressed in one commit:
1. **`snowflake-llama-3.1-405b` output > context (cubic P2 on
provider.ts:1110).** Snowflake's docs list output=8192 for this
model, but its context is 8000. Output can never physically exceed
the total token budget, so a max_tokens=8192 request would either
be rejected or implicitly capped by the gateway. Capped at 4096
(the original sibling default), with a comment explaining the
apparent doc inconsistency.
2. **Aliased models bypass the tool-call allowlist (cubic P2 on
snowflake.ts:19).** `buildToolCapableSet` indexed by the picker map
key, but the request body sends `model: <api.id>`. A user
registering an alias like:
"my-claude-alias": { "id": "claude-opus-4-7", "tool_call": true }
would have tools silently stripped because "my-claude-alias" !=
"claude-opus-4-7" in the set. Updated the helper to also include
`m.id` and `m.api?.id` so the lookup matches whichever form the
transform sees. Added a regression test that exercises the alias
path end-to-end (config registration → loader-built set → request
transform with the api.id form).
3. **Document why auto-discovery isn't used (web-researcher
suggestion on provider.ts:1050).** Added a comment near the
snowflake-cortex registration explaining that Cortex's models
endpoint (`GET /api/v2/cortex/v1/models`) has non-standard
semantics (requires JSON body on GET) that break standard
OpenAI-compatible clients — so the hardcoded list is the source of
truth until a probe-able shim exists.
Skipped:
- "CVE-2026-12345" comment from the web-researcher reviewer — the
CVE id is a placeholder/fake (no such advisory exists), suggestion
body is vague. Not actioned.
- Schema-validation hardening for user-provided model configs —
reasonable but broader than this PR's scope.
CI status: the one TypeScript failure on this branch
(`S27: sql_analyze with parse error`) is pre-existing on `main`
HEAD `6ad8b47` — unrelated to snowflake-cortex.
Tests: 55 → 56 in `test/provider/snowflake.test.ts`; typecheck clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Haider <haider@altimate.ai>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e12cac3 commit e94eb20
5 files changed
Lines changed: 441 additions & 49 deletions
File tree
- docs/docs/configure
- packages/opencode
- src
- altimate/plugin
- provider
- test
- altimate
- provider
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
292 | 316 | | |
293 | 317 | | |
294 | 318 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
14 | 39 | | |
15 | 40 | | |
16 | 41 | | |
| |||
29 | 54 | | |
30 | 55 | | |
31 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
32 | 61 | | |
33 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
34 | 66 | | |
35 | 67 | | |
36 | 68 | | |
| |||
41 | 73 | | |
42 | 74 | | |
43 | 75 | | |
44 | | - | |
| 76 | + | |
45 | 77 | | |
46 | 78 | | |
47 | 79 | | |
| |||
97 | 129 | | |
98 | 130 | | |
99 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
100 | 140 | | |
101 | 141 | | |
102 | 142 | | |
| |||
134 | 174 | | |
135 | 175 | | |
136 | 176 | | |
137 | | - | |
| 177 | + | |
138 | 178 | | |
139 | 179 | | |
140 | 180 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1015 | 1015 | | |
1016 | 1016 | | |
1017 | 1017 | | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
1018 | 1026 | | |
1019 | 1027 | | |
1020 | 1028 | | |
| |||
1023 | 1031 | | |
1024 | 1032 | | |
1025 | 1033 | | |
| 1034 | + | |
1026 | 1035 | | |
1027 | 1036 | | |
1028 | 1037 | | |
| |||
1049 | 1058 | | |
1050 | 1059 | | |
1051 | 1060 | | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
1052 | 1071 | | |
1053 | 1072 | | |
1054 | 1073 | | |
| |||
1070 | 1089 | | |
1071 | 1090 | | |
1072 | 1091 | | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
1073 | 1107 | | |
1074 | 1108 | | |
1075 | 1109 | | |
1076 | | - | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
1077 | 1121 | | |
1078 | 1122 | | |
1079 | 1123 | | |
| |||
1113 | 1157 | | |
1114 | 1158 | | |
1115 | 1159 | | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
1116 | 1166 | | |
1117 | 1167 | | |
1118 | 1168 | | |
1119 | 1169 | | |
1120 | 1170 | | |
1121 | 1171 | | |
1122 | 1172 | | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
1123 | 1180 | | |
1124 | 1181 | | |
1125 | 1182 | | |
| |||
Lines changed: 11 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
33 | 40 | | |
34 | 41 | | |
35 | 42 | | |
| |||
375 | 382 | | |
376 | 383 | | |
377 | 384 | | |
378 | | - | |
| 385 | + | |
379 | 386 | | |
380 | 387 | | |
381 | 388 | | |
| |||
388 | 395 | | |
389 | 396 | | |
390 | 397 | | |
391 | | - | |
| 398 | + | |
392 | 399 | | |
393 | 400 | | |
394 | 401 | | |
| |||
403 | 410 | | |
404 | 411 | | |
405 | 412 | | |
406 | | - | |
| 413 | + | |
407 | 414 | | |
408 | 415 | | |
409 | 416 | | |
| |||
416 | 423 | | |
417 | 424 | | |
418 | 425 | | |
419 | | - | |
| 426 | + | |
420 | 427 | | |
421 | 428 | | |
422 | 429 | | |
| |||
0 commit comments