Update interactive.go
cleaner comment
- commit
- b0a07d33699279796749efb9ffb30e792b7308a7
- author
- Raymond Gasper · · 2026-09-29 13:47 UTC
- committer
- GitHub · · 2026-09-29 13:47 UTC
- parent
- c63bfd3
- signature
- GPG Unverified
B5690EEEBB952194The key is unknown
1 file · +1 -3
M packages/agent/modes/interactive.go +1 -3
| @@ -5788,13 +5788,11 @@ func (i *Interactive) swapModel(prov, model string, builder func(string, string) | |||
| 5788 | 5788 | // Same provider AND not a rescue retry: just swap the model on | |
| 5789 | 5789 | // the existing agent. Mixed-API providers dispatch from model metadata, | |
| 5790 | 5790 | // so the client remains reusable. Rescue retries always rebuild so a stale | |
| 5791 | - | // auth header / base URL can't carry over. | |
| 5791 | + | // auth header / base URL can't carry over. Update the MaxOutput tokens to match the new model's configuration. | |
| 5792 | 5792 | if !rescue && i.agent != nil && m.Provider == i.cfg.Provider { | |
| 5793 | 5793 | i.mu.Lock() | |
| 5794 | 5794 | i.cfg.Model = m.ID | |
| 5795 | 5795 | i.agent.Model = m.ID | |
| 5796 | - | // The output budget is per model; keeping the previous model's | |
| 5797 | - | // value can truncate responses (or exceed the new model's cap). | |
| 5798 | 5796 | i.agent.MaxTokens = m.MaxOutput | |
| 5799 | 5797 | i.statusOK = "model: " + m.ID | |
| 5800 | 5798 | i.statusErr = "" | |
| @@ -5788,13 +5788,11 @@ func (i *Interactive) swapModel(prov, model string, builder func(string, string) | |||||
| 5788 | // Same provider AND not a rescue retry: just swap the model on | 5788 | // Same provider AND not a rescue retry: just swap the model on | ||
| 5789 | // the existing agent. Mixed-API providers dispatch from model metadata, | 5789 | // the existing agent. Mixed-API providers dispatch from model metadata, | ||
| 5790 | // so the client remains reusable. Rescue retries always rebuild so a stale | 5790 | // so the client remains reusable. Rescue retries always rebuild so a stale | ||
| 5791 | - | // auth header / base URL can't carry over. | 5791 | + | // auth header / base URL can't carry over. Update the MaxOutput tokens to match the new model's configuration. |
| 5792 | if !rescue && i.agent != nil && m.Provider == i.cfg.Provider { | 5792 | if !rescue && i.agent != nil && m.Provider == i.cfg.Provider { | ||
| 5793 | i.mu.Lock() | 5793 | i.mu.Lock() | ||
| 5794 | i.cfg.Model = m.ID | 5794 | i.cfg.Model = m.ID | ||
| 5795 | i.agent.Model = m.ID | 5795 | i.agent.Model = m.ID | ||
| 5796 | - | // The output budget is per model; keeping the previous model's | |||
| 5797 | - | // value can truncate responses (or exceed the new model's cap). | |||
| 5798 | i.agent.MaxTokens = m.MaxOutput | 5796 | i.agent.MaxTokens = m.MaxOutput | ||
| 5799 | i.statusOK = "model: " + m.ID | 5797 | i.statusOK = "model: " + m.ID | ||
| 5800 | i.statusErr = "" | 5798 | i.statusErr = "" | ||