Skip to content

Custom model context window requires a second save to persist #4755

Description

@liuxiaocs7

What happened

Editing the declared context window for a custom model and clicking Save once can persist the previous value instead of the value currently shown in the input. As a result, the usage view can still report that the context limit is unknown or continue using the stale limit.

Expected behavior: the value displayed in the context-window input is persisted by the first Save click.

How to reproduce

  1. Open Settings → Models and select a custom OpenAI-compatible connection.
  2. Add a custom model with a context window such as 128000.
  3. Open that model's capability settings.
  4. Change the context window to 258000.
  5. Without clicking elsewhere first, click Save once.
  6. Read the connection snapshot or reopen the settings.

The saved relayModelProfiles[modelId].contextWindow remains 128000. A second Save persists 258000.

Environment

  • Maka commit: 2bdabbe62
  • OS: macOS 15.7.3
  • Surface: Desktop
  • Node.js: v24.14.0

Logs, screenshots, or additional context

NumberInput already buffers text and commits it on blur/Enter. DeclaredContextWindowField adds another local draft and commit boundary, so the blur caused by clicking Save updates only the inner draft while the row-level Save reads the previous value.

A deterministic Electron E2E reproduces the defect by changing 128000 to 258000, clicking Save once, and asserting the persisted connection snapshot.

Submitted with Codex assistance on behalf of @liuxiaocs7.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions