Skip to content

Background subagent result resets the main session model #28735

Closed as not planned

Description

@wanyaoluo

Description

When a background subagent finishes and its result is delivered back into the current main session, the active model in the main session appears to be reset to the agent/default model.

This is not just a case where I changed the selector but had not sent anything yet. I switch the main session model first, for example from a GLM model to a GPT model, then send at least one normal main-session message with that new model. Later, while work is ongoing, an async/background subagent result returns and the main session is switched back to the previous/default model.

This feels related to older model-state issues such as #6636 and #21728, but the important detail here is that the newly selected model had already been used for a main-session message before the async subagent result arrived.

Plugins

No plugin is required for this behavior. The issue appears on the native background subagent/session model path; plugins do not appear to affect the repro.

OpenCode version

1.15.6

Steps to reproduce

  1. Start a session with the default model set to model A, for example GLM.
  2. Launch a background subagent/task that will return later.
  3. Switch the main session to model B, for example GPT.
  4. Send at least one normal main-session message using model B.
  5. While work continues, wait for the background subagent result to be delivered back into the main session.
  6. Observe that the main session model is switched back to model A/default.

Expected: once the main session has sent a message with model B, an async subagent result should not overwrite the active main-session model back to model A/default.

Screenshot and/or share link

N/A for now.

Operating System

Ubuntu 24.04.4 LTS on WSL

Terminal

Not terminal-specific.

Activity

  1. github-actions commented on May 21, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is distinct from these, feel free to clarify the differences.

  2. wanyaoluo commented on May 21, 2026

    @wanyaoluo
    Author

    Thanks, I checked #21728 and #21351. This looks related, but I don't think it is the same repro.

    I'm using the experimental native background subagents path (task(background=true) / task_status), not a direct POST /session/:id/prompt_async notification and not a Plan/Build mode switch.

    The main session had already switched to the new model and sent a normal message with it. Later, when the background subagent result was injected back into the main session, the main session model reset to the default.

  3. github-actions commented on Jul 21, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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