[PR #8951] fix: keep primary model after subagent runs #12923

Closed
opened 2026-02-16 18:17:48 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/8951

State: closed
Merged: Yes


Summary

Prevents subagent model from overriding primary agent model in TUI.

Fixes #8946
Fixes #7430

Reasoning

The existing isPrimaryAgent guard already prevents subagent names from overriding the primary agent selection. Model and variant appear to have been unintentionally left outside this guard, causing the leak. This fix moves them inside the same guard for consistency.

There is an existing PR #7428 that proposes a config option to opt-in to isolation. This would work but I think this is a bug and not a feature?

Verification

Tested according to repro steps in #8946: configured subagent with different model, invoked it, interrupted during work, navigated back to primary agent, the primary agent model was retained.

Note: the web app (packages/app/src/pages/session.tsx) may have the same bug but is not addressed here.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/8951 **State:** closed **Merged:** Yes --- ## Summary Prevents subagent model from overriding primary agent model in TUI. Fixes #8946 Fixes #7430 ## Reasoning The existing `isPrimaryAgent` guard already prevents subagent names from overriding the primary agent selection. Model and variant appear to have been unintentionally left outside this guard, causing the leak. This fix moves them inside the same guard for consistency. There is an existing PR #7428 that proposes a config option to opt-in to isolation. This would work but I think this is a bug and not a feature? ## Verification Tested according to repro steps in #8946: configured subagent with different model, invoked it, interrupted during work, navigated back to primary agent, the primary agent model was retained. Note: the web app (`packages/app/src/pages/session.tsx`) may have the same bug but is not addressed here.
yindo added the pull-request label 2026-02-16 18:17:48 -05:00
yindo closed this issue 2026-02-16 18:17:48 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12923