#11593

Bug: Cached models disappear after remote catalog metadata is reset to zero

Openleni8ecopened 9d ago

What happened?

Model openai-codex/gpt-6.1-terra intermittently disappears from pi --list-models, apparently after system sleep or VPN connectivity issues (or wrong country selection).

❯ pi --list-models | Select-String -Pattern "terra"

openai         gpt-5.6-terra                       272K     128K     yes       yes
openai-codex   gpt-5.6-terra                       272K     128K     yes       yes

The model is still present in ~/.pi/agent/models-store.json, but its catalog metadata changes:

FieldBeforeAfter
lastModified17931938790000
checkedAt17932403516351793295007994
etagPresentMissing
gpt-6.1-terra in cached modelsYesYes
Model visible in PiYesNo

Even with PI_OFFLINE=1, the model remains hidden.

Running pi update --models restores it immediately. This has happened repeatedly.

Suspected cause

In withRemoteCatalog(), HTTP 404/501 responses reset lastModified to 0 and clear etag, while preserving stored.models.

remoteModels() then rejects the cached models because their timestamp is older than the built-in catalog.

A successful response missing the Last-Modified header is another possible cause.

Source: remote-catalog-provider.ts (v1.4.0)


  • Pi 1.4.0
  • Node.js 26
  • Windows 11

Steps to reproduce

  1. Run pi update --models and verify gpt-6.1-terra is listed.
  2. Allow a periodic catalog refresh, potentially during unstable VPN connectivity.
  3. Observe that the model disappears while remaining in the stored model array.
  4. Run pi update --models again. The model reappears.

The network trigger is intermittent; the exact HTTP response has not been captured.

Expected behavior

A transient catalog endpoint failure should not invalidate a previously valid cached catalog or hide working models. The last known good catalog should remain available until a valid replacement is received.

❯ pi --list-models | Select-String -Pattern "terra"

openai         gpt-5.6-terra                       272K     128K     yes       yes
openai-codex   gpt-5.6-terra                       272K     128K     yes       yes
openai-codex   gpt-6.1-terra                       500K     128K     yes       yes

Version

1.4.0

Activity

0

No activity yet.