Wrong agent used after compaction #3000

Closed
opened 2026-02-16 17:38:11 -05:00 by yindo · 5 comments
Owner

Originally created by @conradkoh on GitHub (Nov 20, 2025).

Description

When compaction happens, it resets the model to the build agent. This problem is aggravated because the switching of the agent might grant it access to extra tools or have missing tools that it was supposed to have to perform the task.

For example, I have a browse agent that has access to the browser. The build tool does not. Halfway while browsing, after compaction, the tool reverts to the build tool and starts using webfetch instead, giving nonsense results in the research.

OpenCode version

1.0.80

Steps to reproduce

  1. Create a browse agent
  2. Use it to access the browser
  3. When compaction happens, the build agent is used
  4. The continued task is now executed using the build agent

Screenshot and/or share link

No response

Operating System

Tahoe 26.1

Terminal

VSCode

Originally created by @conradkoh on GitHub (Nov 20, 2025). ### Description When compaction happens, it resets the model to the build agent. This problem is aggravated because the switching of the agent might grant it access to extra tools or have missing tools that it was supposed to have to perform the task. For example, I have a browse agent that has access to the browser. The build tool does not. Halfway while browsing, after compaction, the tool reverts to the build tool and starts using webfetch instead, giving nonsense results in the research. ### OpenCode version 1.0.80 ### Steps to reproduce 1. Create a browse agent 2. Use it to access the browser 3. When compaction happens, the build agent is used 4. The continued task is now executed using the build agent ### Screenshot and/or share link _No response_ ### Operating System Tahoe 26.1 ### Terminal VSCode
yindo added the opentuibug labels 2026-02-16 17:38:11 -05:00
yindo closed this issue 2026-02-16 17:38:12 -05:00
Author
Owner

@conradkoh commented on GitHub (Nov 20, 2025):

This might be a duplicate of https://github.com/sst/opencode/issues/3099 but I'm not sure if it is exactly the same. That one is about the AGENTS.md, this one is that wrong agent itself is being used after compaction.

@conradkoh commented on GitHub (Nov 20, 2025): This might be a duplicate of https://github.com/sst/opencode/issues/3099 but I'm not sure if it is exactly the same. That one is about the AGENTS.md, this one is that wrong agent itself is being used after compaction.
Author
Owner

@emincangencer commented on GitHub (Nov 20, 2025):

Something similar happens. /compact command creates next steps from the chat history and build agent gets triggered to do them. Expected behavior should be to disable any action after compact report is given. there's:

`

User

`
Which shouldn't exist there, clearly it thinks user made an action, but there was none.

Chat:
`

Assistant

Summary of Conversation

What Was Done

  • Tamagui Setup for Expo: Installed Tamagui packages (tamagui, @tamagui/config, @tamagui/babel-plugin, etc.) and configured the app for Expo. This included creating babel.config.js for Babel plugin integration, tamagui.config.ts with default Tamagui configuration, and tamagui-web.css for web styles. Updated tsconfig.json to include Tamagui types and wrapped the root layout (app/_layout.tsx) with TamaguiProvider.
  • Component Refactoring: Updated components/themed-text.tsx and components/themed-view.tsx to use Tamagui's Text and View components instead of React Native's, leveraging Tamagui's theming for consistency.
  • App Screen Updates: Refactored app/(tabs)/index.tsx to use Tamagui components like YStack, Card, and Button, replacing old styled views. Simplified the home screen to a clean "Welcome to the Starter Kit" layout with a centered button, removing the parallax scroll, React logo, and edit instructions. Updated app/modal.tsx to use Tamagui's View instead of React Native's.
  • Navigation Changes: Modified app/(tabs)/_layout.tsx to hide the bottom tab bar (tabBarStyle: { display: 'none' }) for a web-app-like layout. Removed the explore tab and deleted app/(tabs)/explore.tsx.
  • Git Management: Staged all changes, unstaged the generated .tamagui/tamagui.config.json file, added .tamagui/ to .gitignore to exclude generated configs, and committed the relevant files.

What Is Currently Being Worked On

  • The Expo app is fully set up with Tamagui as the UI framework, with navigation hidden and a minimal starter kit home screen. No active modifications in progress; the app is in a ready state for further development.

Which Files Were Modified/Created

  • Created: babel.config.js, tamagui.config.ts, tamagui-web.css.
  • Modified: package.json (added dependencies), tsconfig.json (added types), app/_layout.tsx (added TamaguiProvider), app/(tabs)/_layout.tsx (hid tabs), app/(tabs)/index.tsx (refactored to Tamagui layout), app/modal.tsx (updated to Tamagui View), components/themed-text.tsx and components/themed-view.tsx (refactored to Tamagui components), .gitignore (added .tamagui/).
  • Deleted: app/(tabs)/explore.tsx.
  • Unstaged/Ignored: .tamagui/tamagui.config.json (generated file, now ignored).

What Needs to Be Done Next

  • The app is now a clean Tamagui-based starter kit. Potential next steps include adding custom navigation (e.g., a sidebar or header menu), integrating more Tamagui components, implementing routing for additional screens, or building out features like forms, data fetching, or authentication. If you have a specific direction (e.g., adding a new page or feature), let me know to continue development. Run expo start to test the current setup.

User


Assistant

Tool: read

Assistant

Tool: read

Assistant

Tool: write

Assistant

Tool: read

Assistant

Tool: edit

Assistant

Tool: read

Assistant

Tool: read

Assistant

Tool: read

Assistant

Tool: read

Assistant

Tool: edit

Assistant


`

I canceled after that.

@emincangencer commented on GitHub (Nov 20, 2025): Something similar happens. /compact command creates next steps from the chat history and build agent gets triggered to do them. Expected behavior should be to disable any action after compact report is given. there's: ` ## User ` Which shouldn't exist there, clearly it thinks user made an action, but there was none. Chat: ` ## Assistant ### Summary of Conversation #### What Was Done - **Tamagui Setup for Expo**: Installed Tamagui packages (`tamagui`, `@tamagui/config`, `@tamagui/babel-plugin`, etc.) and configured the app for Expo. This included creating `babel.config.js` for Babel plugin integration, `tamagui.config.ts` with default Tamagui configuration, and `tamagui-web.css` for web styles. Updated `tsconfig.json` to include Tamagui types and wrapped the root layout (`app/_layout.tsx`) with `TamaguiProvider`. - **Component Refactoring**: Updated `components/themed-text.tsx` and `components/themed-view.tsx` to use Tamagui's `Text` and `View` components instead of React Native's, leveraging Tamagui's theming for consistency. - **App Screen Updates**: Refactored `app/(tabs)/index.tsx` to use Tamagui components like `YStack`, `Card`, and `Button`, replacing old styled views. Simplified the home screen to a clean "Welcome to the Starter Kit" layout with a centered button, removing the parallax scroll, React logo, and edit instructions. Updated `app/modal.tsx` to use Tamagui's `View` instead of React Native's. - **Navigation Changes**: Modified `app/(tabs)/_layout.tsx` to hide the bottom tab bar (`tabBarStyle: { display: 'none' }`) for a web-app-like layout. Removed the explore tab and deleted `app/(tabs)/explore.tsx`. - **Git Management**: Staged all changes, unstaged the generated `.tamagui/tamagui.config.json` file, added `.tamagui/` to `.gitignore` to exclude generated configs, and committed the relevant files. #### What Is Currently Being Worked On - The Expo app is fully set up with Tamagui as the UI framework, with navigation hidden and a minimal starter kit home screen. No active modifications in progress; the app is in a ready state for further development. #### Which Files Were Modified/Created - **Created**: `babel.config.js`, `tamagui.config.ts`, `tamagui-web.css`. - **Modified**: `package.json` (added dependencies), `tsconfig.json` (added types), `app/_layout.tsx` (added TamaguiProvider), `app/(tabs)/_layout.tsx` (hid tabs), `app/(tabs)/index.tsx` (refactored to Tamagui layout), `app/modal.tsx` (updated to Tamagui View), `components/themed-text.tsx` and `components/themed-view.tsx` (refactored to Tamagui components), `.gitignore` (added `.tamagui/`). - **Deleted**: `app/(tabs)/explore.tsx`. - **Unstaged/Ignored**: `.tamagui/tamagui.config.json` (generated file, now ignored). #### What Needs to Be Done Next - The app is now a clean Tamagui-based starter kit. Potential next steps include adding custom navigation (e.g., a sidebar or header menu), integrating more Tamagui components, implementing routing for additional screens, or building out features like forms, data fetching, or authentication. If you have a specific direction (e.g., adding a new page or feature), let me know to continue development. Run `expo start` to test the current setup. --- ## User --- ## Assistant ``` Tool: read ``` --- ## Assistant ``` Tool: read ``` --- ## Assistant ``` Tool: write ``` --- ## Assistant ``` Tool: read ``` --- ## Assistant ``` Tool: edit ``` --- ## Assistant ``` Tool: read ``` --- ## Assistant ``` Tool: read ``` --- ## Assistant ``` Tool: read ``` --- ## Assistant ``` Tool: read ``` --- ## Assistant ``` Tool: edit ``` --- ## Assistant --- ` I canceled after that.
Author
Owner

@wolfie82 commented on GitHub (Nov 20, 2025):

I believe this is related to https://github.com/sst/opencode/issues/4475 and https://github.com/sst/opencode/issues/4431

@wolfie82 commented on GitHub (Nov 20, 2025): I believe this is related to https://github.com/sst/opencode/issues/4475 and https://github.com/sst/opencode/issues/4431
Author
Owner

@rekram1-node commented on GitHub (Nov 21, 2025):

Should be fixed in next release

@rekram1-node commented on GitHub (Nov 21, 2025): Should be fixed in next release
Author
Owner

@jcowles commented on GitHub (Jan 12, 2026):

I just pulled latest and can confirm that this is fixed in the simple case, but is still happening when the sub-agent accidentially overruns the context size:

When this error occurs:

litellm.ContextWindowExceededError: litellm.BadRequestError: ContextWindowExceededError: OpenAIException - This model's maximum context length is 32000 tokens. However, your request has 56121 input tokens. Please reduce the length of the input messages. (parameter=input_tokens, value=56121) None
model=glm-4.7-fp8. context_window_fallbacks=None. fallbacks=None.
Set 'context_window_fallback' - https://docs.litellm.ai/docs/routing#fallbacks. Received Model Group=glm-4.7-fp8
Available Model Group Fallbacks=None

After this error, it continues processing in the primary agent context, as reported in the bug above.

@jcowles commented on GitHub (Jan 12, 2026): I just pulled latest and can confirm that this is fixed in the simple case, but is still happening when the sub-agent accidentially overruns the context size: When this error occurs: ``` litellm.ContextWindowExceededError: litellm.BadRequestError: ContextWindowExceededError: OpenAIException - This model's maximum context length is 32000 tokens. However, your request has 56121 input tokens. Please reduce the length of the input messages. (parameter=input_tokens, value=56121) None model=glm-4.7-fp8. context_window_fallbacks=None. fallbacks=None. Set 'context_window_fallback' - https://docs.litellm.ai/docs/routing#fallbacks. Received Model Group=glm-4.7-fp8 Available Model Group Fallbacks=None ``` After this error, it continues processing in the primary agent context, as reported in the bug above.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3000