goose icon indicating copy to clipboard operation
goose copied to clipboard

Goose stops responding without any error message once conversation hits context limit on openrouter.

Open myevolve opened this issue 10 months ago • 5 comments

Describe the bug Goose will eventually just stop responding and not display the error message from the llm, in this case, openrouter using anthropic/claud-3.5-sonnet

To Reproduce Steps to reproduce the behavior:

  1. Build for long enough to exceed 200K context.

Expected behavior Expected behavior is that Goose would use the middle out transform and compress prompt to context limit or just below it so it doesn't fail.

Screenshots Trace from langfuse:
This endpoint's maximum context length is 200000 tokens. However, you requested about 201326 tokens (197771 of text input, 3555 of tool input). Please reduce the length of either one, or use the "middle-out" transform to compress your prompt automatically.

Please provide following information:

  • OS & Arch: [Ubuntu 24.04 x86]
  • Interface: [CLI]
  • Version: [v1.0.7]
  • Extensions enabled: [Developer,Computer Controller, Memory,Fetch,Git,Github]
  • Provider & Model: [openrouter:anthropic/claude-3.5-sonnet]

Additional context Add any other context about the problem here.

myevolve avatar Feb 20 '25 08:02 myevolve

@myevolve thanks for reporting it, previously we have some discussion about the truncate on goose for all providers, will update here later

yingjiehe-xyz avatar Feb 20 '25 17:02 yingjiehe-xyz

This has been ongoing and since 1.0.1 at least. I've reported it many times. Be nice to fix this once and for all, because the console (CLI and GUI) failure is not at all descriptive of the issue.

CyphrRiot avatar Feb 21 '25 00:02 CyphrRiot

@HunterR0se I believe this specific error is coming from OpenRouter - https://openrouter.ai/docs/features/message-transforms

However, in the case that OpenRouter doesn't handle context length errors, Goose should try to do a better job at truncating.

salman1993 avatar Feb 21 '25 14:02 salman1993

Bump. This is the biggest issue I'm having recently. It requires restarting a new goose session, and then having to get goose up to speed all over again.

pfergi42 avatar Mar 14 '25 17:03 pfergi42

Bump. This is the biggest issue I'm having recently. It requires restarting a new goose session, and then having to get goose up to speed all over again.

Exactly! And the amount of tokens and API calls to do this is both mentally (and financially) burdensome at the least and infuriating at most.

I love goose, but this really is a "show stopper" issue for the project.

CyphrRiot avatar Mar 14 '25 18:03 CyphrRiot

I've been working on an initial fix for this since it's a critical bug. Put up what I have so far: https://github.com/block/goose/pull/3635

Looking for testers, feedback, and/or contributions. Thanks!

kwsantiago avatar Jul 24 '25 20:07 kwsantiago

@michaelneale is this still the case? seems like we should make sure this works before we make openrouter a default if not

DOsinga avatar Jul 31 '25 12:07 DOsinga

I can confirm this still happens today, @DOsinga I use OpenRouter's Qwen3 Coder

igorgue avatar Aug 06 '25 16:08 igorgue

thanks @igorgue we will priotitize this then :-(

DOsinga avatar Aug 06 '25 16:08 DOsinga

@kwsantiago do you see your fix helping with openrouter?

michaelneale avatar Aug 06 '25 20:08 michaelneale

aside: I expect this is less of an issue with the new auto compact (ie just few days ago), but good to have it not just halt!

michaelneale avatar Aug 06 '25 20:08 michaelneale

@michaelneale it should, and middle-out support could also help.

However I don't have paid access to OpenRouter API, so ideally someone could test with it on the fix branch.

kwsantiago avatar Aug 06 '25 21:08 kwsantiago

I am trying out the middle-out stuff in OR as well, as it won't hurt I believe, so between all the above, we should be in a good place soon.

michaelneale avatar Aug 07 '25 04:08 michaelneale

ok middle-out seems to be great, easy too, so I think we can close this once that lands in https://github.com/block/goose/pull/3881

michaelneale avatar Aug 07 '25 05:08 michaelneale

closing this as that PR fixes that (along with other changes on main which are just coming out) - can re-open it if we need to revisit this, thanks everyone for all the angles and ideas.

michaelneale avatar Aug 07 '25 06:08 michaelneale