Skip to content

[Bug]: manual opencode-go modelContextWindows entries are reset after update #1409

Description

@RanceLee233

Client or integration

Codex App

Area

Catalog / models / config persistence

Current status

This issue remains open, but its scope is narrower than the original report suggested.

Current dev contains config-rebase work that fixed at least one confirmed management/save path which could lose provider configuration. However, the broader whole-document writer fix attempted in #1462 was closed without merge, and the original upgrade + later unrelated-write reproduction has not been proven fully covered.

Do not close this issue based only on the presence of the newer rebase-on-save machinery. The close condition is that the original user override survives the actual lifecycle described below, including upgrade/restart and an unrelated later save.

The architectural ambiguity behind stale-config rebasing is tracked separately in #1478.

Problem

An explicit user value under:

providers.opencode-go.modelContextWindows

was removed after upgrading and then performing a later unrelated config/provider write. The provider fell back to registry-seeded context metadata.

Registry defaults may seed missing values, but they must not overwrite or delete explicit user overrides.

Original reproduction

  1. Configure:
{
  "providers": {
    "opencode-go": {
      "modelContextWindows": {
        "deepseek-v4-flash": 900000
      }
    }
  }
}
  1. Run OpenCodex 2.11.0 and verify the override is effective.
  2. Upgrade to 2.11.1 and restart the daemon/app.
  3. Perform an unrelated provider/config write.
  4. Inspect config.json.
  5. The explicit deepseek-v4-flash entry was gone and opencode-go.modelContextWindows contained only registry-seeded values.
  6. The generated catalog then fell back to its default context window.

The separate deepseek provider's context-window configuration was not affected in the original report.

Required behavior

  • Explicit user modelContextWindows values survive upgrade and restart.
  • Registry defaults only fill genuinely missing values.
  • An unrelated management/API/provider save must not remove an override that the writer did not intend to change.
  • A deliberate deletion of an override must still remain possible and must not be resurrected by a rebase.
  • Concurrent or independently loaded config writers must not silently erase unseen keys.

The last two requirements interact with the provenance problem in #1478. Fixing one by blindly treating every absent key as deletion, or every absent key as ignorance, is not sufficient.

Acceptance test

A regression should exercise the complete lifecycle rather than only a single helper:

seed explicit opencode-go modelContextWindows override
        ↓
load/start server
        ↓
perform registry/default reconciliation if applicable
        ↓
perform an unrelated management/config write
        ↓
reload from disk
        ↓
explicit override is still present and effective

Also cover deliberate deletion so the persistence fix does not make stale values impossible to remove.

Close condition

Close only when the original lifecycle is covered on current dev by a regression proving both preservation of explicit user overrides and intentional deletion semantics.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcatalogModel catalog, slugs, visibility, routed entries

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions