Skip to content

[Feature] Clear session model override on /new and /reset #64475

@zhuyankarl

Description

@zhuyankarl

Problem

When a user sets a per-session model override (via /model or session_status(model=...)), the override persists in the session store across:

  • /new and /reset commands
  • Gateway restarts

This causes the new session to start with the stale override instead of the configured agents.defaults.model.primary or agent-level model.primary.

Related Issues

Current Workaround

Users must manually call session_status(model="default") after each /new or gateway restart to clear the stale override. This is not intuitive and most users dont know about it.

Proposed Solution

Option A: Auto-clear on /new (Recommended)

In the session reset path, do NOT persist modelOverride and providerOverride when resetTriggered is true:

// Current (buggy):
if (resetTriggered && entry) {
  persistedModelOverride = entry.modelOverride;        // ← bug
  persistedProviderOverride = entry.providerOverride;  // ← bug
}

// Proposed fix:
if (resetTriggered && entry) {
  // Do NOT persist model/provider override on reset
  // This ensures the new session starts with the configured default
}

Option B: Config-level option

Add a config option to control this behavior:

{
  "session": {
    "clearModelOverrideOnReset": true
  }
}

Option C: Distinguish intentional vs stale overrides

Track whether the override was set intentionally (via /model) vs inherited from a previous session. Only clear inherited ones on /new.

Why This Matters

  • Users change agents.defaults.model.primary in config and expect it to take effect
  • After /new, users expect a truly fresh session, not one with hidden stale state
  • The current behavior silently undermines config changes, causing confusion and debugging time

Suggested Behavior

After /new or /reset:

  1. Session starts with NO model override
  2. Model resolves to the agent's configured model.primary
  3. If no agent-level primary, falls back to agents.defaults.model.primary
  4. The reset banner shows the correct resolved model

This would make /new a true "fresh start" as users expect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    close:duplicateClosed as duplicatededupe:childDuplicate issue/PR child in dedupe cluster

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions