GeezerVison is showing github.com — [Bug]: Grok refresh restores removed gateway models from cache · Issue #14349 · pingdotgg/t3code
[Bug]: Grok refresh restores removed gateway models from cache #14349DescriptionBefore submitting
- I searched existing issues and did not find a duplicate for Grok model removal.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- Connect Grok CLI to a third-party model gateway (CodexHub in this case) and let T3 discover its additional model IDs.
- Disconnect Grok CLI from that gateway and restore the official Grok configuration.
- Confirm
grok models and grok agent stdio ACP initialize._meta.modelState.availableModels no longer contain the gateway models.
- Refresh provider status in T3 and inspect the Grok model list in Settings or the model picker.
Expected behavior
A successful, complete Grok model discovery replaces the previously discovered inventory. Removed gateway models disappear from the client and persisted cache. Explicit custom models continue to follow current T3 settings; failed or incomplete discovery can retain the last known inventory.
Actual behavior
T3 still lists the disconnected gateway's models. This is a server inventory merge problem, not evidence that Grok CLI is still routed through the gateway.
Read-only verification on this machine:
- Grok's
config.toml no longer contains CodexHub references.
- T3's Grok instance has no custom models or instance environment overrides.
- Both
grok models and ACP initialize return exactly grok-4.7, grok-4.7-build-fast, grok-4.6, and grok-4.5.
- T3's persisted Grok snapshot still contains 17 rows: the four current models, the old
grok-build fallback, and 12 codexhub-* rows. The stale rows have isCustom: false because they were discovered from the CLI.
- Running the actual
mergeProviderModels function with that previous snapshot and the four freshly advertised models reproduces 17 merged rows, including all 12 removed gateway models, even with status: "ready" and authenticated/installed state.
Diagnosis and minimal reproduction
On current main, shouldRetainMissingProviderModels returns true unconditionally for Grok. mergeProviderModels then appends every previous non-custom model absent from the new list.
The Grok probe itself already receives the correct current list; it is the shared registry merge that restores removed rows.
A minimal regression case at the exported mergeProviderSnapshot seam:
const fresh = {
instanceId: ProviderInstanceId.make("grok"),
driver: ProviderDriverKind.make("grok"),
enabled: true,
installed: true,
status: "ready",
auth: { status: "authenticated" },
version: "1.0.44",
checkedAt: "2026-09-30T00:00:00.000Z",
models: [{ slug: "grok-4.7", name: "Grok 4.7", isCustom: false }],
} satisfies ServerProvider;
const previous = {
...fresh,
models: [
...fresh.models,
{ slug: "codexhub-removed-model", name: "Removed gateway model", isCustom: false },
],
};
// Expected only grok-4.7; current code returns both rows.
expect(mergeProviderSnapshot(previous, fresh).models.map((m) => m.slug))
.toEqual(["grok-4.7"]);
This affects the shared server inventory consumed by web, desktop, and mobile. A frontend-only filter would leave stale persisted entries behind.
Impact
Minor bug or occasional failure. The model picker advertises models that the current Grok configuration no longer exposes.
Version or commit
Source diagnosis and reproduction: main @ 0fcd5f90611451cca842689faea53b5450c022da (also checked against upstream main on 2026-09-30). This SHA describes the investigated source, not an asserted build SHA of the installed desktop app.
Environment
Linux; Grok CLI 1.0.44 (5b807183dd79) [stable]; Node v26.10.0; official Grok account; previously connected through CodexHub.
Related work
Current main still excludes Grok from successful-discovery replacement. I did not find a Grok-specific issue or an active fix for this path.
Workaround
No cache deletion or live state changes were attempted. Ordinary refresh still restores removed models through the merge logic.
Investigated and filed with GPT-6.1 Sol through the Codex harness in T3 Code. Activityfullheart commented on Oct 16, 2026 Still happening with the Pi driver on t3 0.1.0 (Linux x64, pi 1.3.0). #18086 was closed as a duplicate of this issue, so I'm adding the Pi case here.
Repro:
- Pi was logged in to openrouter, opencode-go and github-copilot. T3 discovered 459 models.
- I removed the opencode-go and github-copilot credentials from
~/.pi/agent/auth.json.
- A fresh
pi --mode rpc answers get_available_models with 392 models, all openrouter.
- I refreshed Pi in Settings and restarted the service with
t3 service restart. ~/.t3/caches/pi.json still had 459 models: 392 openrouter, 36 github-copilot, 30 opencode-go and 1 default. The picker still shows the removed providers.
As a workaround I stopped the server, filtered pi.json down to the providers that have a key in pi's auth.json, and restarted. That holds. Refresh never removes anything, though, so the cache grows again each time a provider goes away.
Adding pi to the drivers excluded in shouldRetainMissingProviderModels, as was done for codex and opencode in #9773 and #4095, would probably fix it. Pi's get_available_models returns the full list of models it can use, so T3 can treat it as authoritative. ybennaoum commented on Oct 16, 2026 Also reproducing on the desktop nightly, with a data point for the shrink / stale-inventory case and a workaround that survives restarts.
Environment: macOS arm64; T3 Code 0.1.1-nightly.20261016.3218; pi 1.3.0 (models come from npm:@router-for-me/pi-cliproxyapi-provider, a local gateway at 127.0.0.1:8317).
State at capture:
pi --mode rpc --no-session + get_available_models → 19 models, all cliproxyapi/*.
~/.t3/caches/pi.json → 126 rows: cliproxyapi/* 101, opencode-zen/* 11, cc-switch-sub-router/* 5, cc-switch-open-router/* 5, intern-ai/* 3, plus the synthetic default row. Every row is isCustom: false. 106 of them are not in Pi's advertised set.
- The file is rewritten from live server memory: emptying it while the service runs is a no-op —
checkedAt/mtime advanced seconds later and the full 126-row union came straight back.
Why "trim the cache, then restart" is racy: hydrateCachedProvider merges any surviving cached rows into the boot snapshot and writeProviderStatusCache persists the union, so a row only goes away if the file is empty/absent at boot and stays that way.
Workaround that held for me:
- Quit T3 fully (so the server stops writing the file).
ln -sf /dev/null ~/.t3/caches/pi.json (replacing the cached file).
- Start T3.
readProviderStatusCache treats an empty file as absent, and writeFileStringAtomically resolves the symlink target instead of replacing the link, so the stale inventory can never re-seed. After the restart, orchestrator_capabilities reported pi as default + the 19 currently advertised models — i.e. Pi's own probe is already authoritative and the shared merge is the only thing restoring removed rows.
Fix direction is unchanged from #18086: shouldRetainMissingProviderModels returns true for pi; add pi to the exemptions alongside codex (#9773) and opencode (#4095). Since hydrateCachedProvider re-applies the same union on boot, the cache also needs to stop carrying rows the driver no longer advertises. juliusmarminge commented on Oct 22, 2026 Triage environment: Linux, current main b5a226e. The Grok CLI is unavailable on PATH and no Grok configuration directory is present. The gateway-to-official-account transition could not be run here, so no real-app reproduction or fix is claimed. Leaving this open for verification in an environment with Grok and gateway access.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|