Skip to content

Fix the install break in write_models_tsv (main is broken for new users) - #19

Open
BeLazy167 wants to merge 1 commit into
mainfrom
fix/models-tsv-install-break
Open

Fix the install break in write_models_tsv (main is broken for new users)#19
BeLazy167 wants to merge 1 commit into
mainfrom
fix/models-tsv-install-break

Conversation

@BeLazy167

Copy link
Copy Markdown
Member

A fresh install from main fails right now — exit 1 immediately after "default model". Reproduced deterministically; two bugs.

1. The install-breaking one

[ -n "$id" ] && [ -n "$context" ] && printf '%s\t%s\n' "$id" "$context"

That compound is the last statement in the loop body, so when the final row has no context window it returns non-zero → the while returns non-zero → set -e aborts the installer. A row without a context window is normal, not an error.

Same class as the json-extractor and strings | grep -q bugs — a construct that fails on an ordinary outcome, under set -euo pipefail.

2. The one that re-creates the compaction bug

write_models_tsv was fed API_BODY left over from the Anthropic surface (/v1/models), whose entries are {id, created_at, display_name, type} — no context windows at all. So even without the crash, every model would fall back to the hardcoded table, and that table omits gpt-5.6-luna, gpt-5.6-terra, gpt-5.5, gpt-5.3-codex. Those four would inherit Claude Code's 200k assumption for unknown ids and re-compact every turn — precisely the reported symptom, on precisely the reported model (luna).

Now fetches the OpenAI-compat surface (/models), which publishes _qbraid.maxTokens.

Verified

install.sh exit 0
models.tsv all 12 correct: gpt-5.6-*/gpt-5.5 = 1,050,000 · gpt-5.4*/codex = 400,000 · claude-* = 1,000,000 / 200,000
default session (sonnet, 1M)
--model gpt-5.6-sol (1M class)
--model gpt-5.4-mini (400k class)

Also resolves the [1m] question: Claude Code strips the suffix before the request, so the gateway never sees claude-sonnet-4-6[1m] — which it does 404 if sent directly. The [1m] branch is safe as written.

… right surface

A fresh install from main currently FAILS (verified: exit 1, right after
"default model"). Two bugs:

- The row loop's last statement is `[ -n id ] && [ -n ctx ] && printf`, which
  returns non-zero when the final row has no context window. That makes the
  whole `while` non-zero and `set -e` aborts the installer. A row without a
  context window is normal, not an error.

- write_models_tsv was fed the Anthropic surface's body (/v1/models), which
  publishes no context windows at all — so even without the crash every model
  would fall back to the hardcoded table. That table omits gpt-5.6-luna,
  gpt-5.6-terra, gpt-5.5 and gpt-5.3-codex, which would then inherit Claude
  Code's 200k assumption and re-compact on every turn: exactly the reported
  symptom, on exactly the model reported (luna). Now fetches the OpenAI-compat
  surface (/models), which carries `_qbraid.maxTokens`.

Verified: install exits 0, models.tsv has all 12 correct windows
(gpt-5.6-* = 1_050_000, gpt-5.4* = 400_000, claude-* = 1_000_000/200_000),
and default / gpt-1M / gpt-400k sessions all answer.

Also confirms the [1m] suffix is safe: Claude Code strips it before the
request, so the gateway never sees claude-sonnet-4-6[1m] (which it 404s).
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.

1 participant