CLIO icon indicating copy to clipboard operation
CLIO copied to clipboard

Not getting responses

Open hartmund opened this issue 9 months ago • 19 comments

I installed CLIO on newest macOS, tried using it with Google Gemini and Gemma. Got one reply at first but following that, despite inputs, I only get warnings and errors:

2026-03-04 10:50:52 [WARN][WorkflowOrchestrator] Consecutive error count: 2/3 2026-03-04 10:50:53 [WARN][WorkflowOrchestrator] Consecutive error count: 3/3 ┌──┤ ERROR └─ I'm sorry, I didn't receive a proper response. Please try rephrasing your question.

...

[ERROR][WorkflowOrchestrator] Session error budget exhausted (11 errors). Stopping to prevent cascading failures

Tried multiple API keys.

hartmund avatar Mar 04 '26 09:03 hartmund

Which provider are you using? I'll try and recreate it here.

fewtarius avatar Mar 04 '26 10:03 fewtarius

Like I said, Google with Gemini/Gemma

hartmund avatar Mar 04 '26 10:03 hartmund

Alright, I wanted to make sure it was and not OpenRouter. Let me see what I can do.

fewtarius avatar Mar 04 '26 10:03 fewtarius

Just checked, and I'm having the same problem with openrouter/google/gemma-3-27b-it:free . Provider, model and API key was set correctly. Can I send you debug logs somehow? Looking like a great tool so far, can't wait to try it out.

hartmund avatar Mar 04 '26 10:03 hartmund

I've been able to recreate this, I'm working on a fix right now. I think I caused it fixing a different bug yesterday and it got past me when I tested as I didn't test Gemini models. I'm also improving my tests so this gets caught in the future. :)

fewtarius avatar Mar 04 '26 10:03 fewtarius

Automated Triage Summary

Field Value
Classification bug
Priority high
Completeness 90%

Analysis: Users report that after a successful first reply from Gemini/Gemma, subsequent requests immediately produce repeated API errors and ultimately 'Session error budget exhausted' logs. Investigation shows the orchestrator's native streaming path (APIManager -> _send_native_streaming -> provider->parse_stream_event) is the likely fault surface: parse_stream_event in CLIO::Providers::Google expects a specific SSE/JSON format and when it fails the native streamer returns an error that bubbles into WorkflowOrchestrator, which increments session-level error counts until the hard limit (10) is exceeded. Also note a minor issue where the orchestrator resets consecutive-error counters before composing the final error message, producing an inaccurate message. Suggested next steps: 1) Add defensive logging in APIManager/_send_native_streaming to persist raw SSE lines when parse_stream_event returns undef/throws, 2) Harden parse_stream_event to accept variant payload shapes used by Gemma/Gemini variants (and add unit tests with recorded SSE samples), 3) Prevent a single parse error from immediately consuming the session error budget by classifying parse failures as non-fatal or adding a dedicated retry path, and 4) fix the consecutive-error message construction so it reports correct counts. Confidence: medium.

Root Cause Analysis

Confidence: unknown

Relevant files:

  • lib/CLIO/Core/WorkflowOrchestrator.pm
  • lib/CLIO/Core/APIManager.pm
  • lib/CLIO/Providers/Google.pm
  • lib/CLIO/Core/SimpleAIAgent.pm

Relevant functions:

  • CLIO::Core::WorkflowOrchestrator::process_input
  • CLIO::Core::WorkflowOrchestrator (error handling block around consecutive_errors / session error budget)
  • CLIO::Core::APIManager::_send_native_streaming
  • CLIO::Providers::Google::parse_stream_event
  • CLIO::Core::APIManager::send_request_streaming

When using native providers (Google Gemini / Gemma and some OpenRouter models) the native streaming parsing path is returning errors that APIManager::_send_native_streaming turns into failures (die/return error). WorkflowOrchestrator catches these API errors and increments a per-session error counter ($session->{_error_count}). The orchestrator will keep retrying until either retries/per-iteration limits are hit or the session-level error budget (max_session_errors = 10) is exceeded, at which point it logs and stops (this produces the observed 'Session error budget exhausted (11 errors)' message).

Root likely places for the failure:

  • CLIO::Providers::Google::parse_stream_event assumes a specific SSE payload format (lines beginning with 'data: ...', JSON shapes under candidates->content->parts, and certain field names like 'functionCall' / 'args'). If Gemini/Gemma or the OpenRouter-wrapped Gemma model emits SSE events or JSON fields that differ (e.g., different key names, nested shapes, or sends grouped events not split by newline), parse_stream_event may return undef or throw, causing _send_native_streaming to treat the exchange as an error (it dies on 'error' event or returns an error on broken parsing).
  • APIManager::_send_native_streaming's streaming handler currently dies on provider-detected 'error' events or returns HTTP error responses; these propagate back as $api_response->{error} and cause the orchestrator to increment session error counts. There is insufficient defensive handling/logging of raw SSE lines when parse_stream_event fails, making diagnosis harder.

Secondary bug (observability/usability): WorkflowOrchestrator resets $self->{consecutive_errors} to before constructing the user-facing error return message, so the returned text reports an incorrect consecutive count. This is a small bug in the error-message construction logic.

Evidence (code reads):

  • WorkflowOrchestrator sets max_session_errors = 10 and checks if ($session_error_count > $max_session_errors) and logs the exact message the reporter saw.
  • WorkflowOrchestrator tracks consecutive identical errors ($self->{consecutive_errors}) and breaks after max_consecutive_errors (3) for identical errors, which matches the logged consecutive error warnings prior to session-budget exhaustion.
  • APIManager dispatches to _send_native_streaming for native providers; _send_native_streaming parses SSE via provider->parse_stream_event and will die on provider-reported error (which becomes an API error returned to orchestrator).

Confidence: medium

Affected Areas

  • lib/CLIO/Providers/ (Google provider and other native providers / OpenRouter provider wrappers)
  • lib/CLIO/Core/APIManager.pm (native streaming & error propagation)
  • lib/CLIO/Core/WorkflowOrchestrator.pm (error accounting, retry logic, user-facing error message)
  • lib/CLIO/Core/SimpleAIAgent.pm (integration/test fallback path and final-response text)

This is an automated analysis. A maintainer will review shortly.

CLIO-Bot avatar Mar 04 '26 11:03 CLIO-Bot

This should be resolved once 20260304.1 is available for update (it's in process). Let me know if you have any issues after updating.

fewtarius avatar Mar 04 '26 11:03 fewtarius

Tried it out already. Using google/gemini-2.5-flash, it does 7 file operations (git clone, file searches) after my first prompt before I'm getting the same error. Immediately switched to gemma-27b to make sure they aren't token limit issues, but got no reply at all: "ERROR I'm sorry, I didn't receive a proper response. Please try rephrasing your question."

hartmund avatar Mar 04 '26 12:03 hartmund

huh, I had the agents doing tool tests. Try with --debug and see if it gives you an indication of what's failing.

fewtarius avatar Mar 04 '26 12:03 fewtarius

Ah ok, the problem with gemma was that it just let me set a gemma model that is not in the list, without indicating an error. Right now there are no gemma models shown at all in /api models. Can you also (re)add the Gemma models? Also I think it would be smart to always display the error when prompts cannot be processed.

Using debug, I was able to use Gemini once, then an error came from quota limit reached.

EDIT2: With openrouter/gemma27b, it also works now. But somehow, it is no longer autonomous:

[google/gemma-3-27b-it:free] user: Test
YOU: Test
CLIO: Okay, I'm CLIO. I understand the current date and time, the working directory, and the critical path rules. I've also reviewed the available tools and their usage guidelines, including the importance of using user_collaboration for all agent-user interaction. I acknowledge the constraints and the authority framework.

You've provided a "Test" prompt. Since this is a minimal prompt, I'll assume you're testing my ability to respond and acknowledge the setup.

Here's my plan:

1. Acknowledge the prompt and confirm I'm ready for instructions.
2. Wait for your next request.

Proceed?

Code Block (json):
  {
    "operation": "request_input",
    "message": "Acknowledged. I'm ready for your instructions. What would you like me to do?",
    "context": "Testing initial setup and response."
  }
  Code Block:

[google/gemma-3-27b-it:free] user: Clone your repo: https://github.com/SyntheticAutonomicMind/CLIO/ . Look for instructions on how to create modules that don't break after updates
YOU: Clone your repo: https://github.com/SyntheticAutonomicMind/CLIO/ . Look for instructions on how to create modules that don't break after updates
CLIO: Okay, I will clone the CLIO repository and search for instructions on creating modules that remain stable across updates. This is a crucial task for ensuring long-term maintainability and preventing regressions.

Here's my plan:

1. Clone the repository using terminal_operations.
2. Search for relevant documentation within the cloned repository using file_operations (specifically grep_search). I'll look for keywords like "module stability", "update resilience", "versioning", "API compatibility", "migration", and "upgrade".
3. Summarize the findings and present them to you using user_collaboration.
4. If no specific documentation is found, I will analyze the existing module structure and identify best practices for creating stable modules.

Let's begin by cloning the repository.

Code Block (json):
  {
    "operation": "execute",
    "command": "git clone https://github.com/SyntheticAutonomicMind/CLIO/",
    "working_directory": "/Users/user"
  }
  Code Block:

[google/gemma-3-27b-it:free] user:

hartmund avatar Mar 04 '26 12:03 hartmund

The problem with Open Router is that that we can't verify the models via API like we can with Copilot's API - at least we couldn't when it was implemented. Let me see if I can find another way to implement that. You're right, we should display a message with the error, we normally do so the error is probably falling through the handler and silently failing. Let me see if I can also improve that as well.

fewtarius avatar Mar 04 '26 12:03 fewtarius

I took another look at the original attempt at model detection, and it was just wrong. Hopefully this release addresses model selection and error messaging. :)

fewtarius avatar Mar 04 '26 13:03 fewtarius

Unfortunately, I'm still encountering issues:

[gemini-2.5-flash] user: /api set model google/gemma-3-27b-it
┌──┤ SYSTEM
└─ Model set to: google/gemma-3-27b-it (saved)

[gemma-3-27b-it] user: Clone your own source code from https://github.com/SyntheticAutonomicMind/CLIO/ . Analyze how you can create modules that do not break after CLIO updates.
YOU: Clone your own source code from https://github.com/SyntheticAutonomicMind/CLIO/ . Analyze how you can create modules that do not break after CLIO updates.
┌──┤ ERROR
└─ I'm sorry, I encountered an error: Unknown API error

[gemma-3-27b-it] user: /api provider openrouter
┌──┤ SYSTEM
└─ Note: Use '/api set provider <name>' (new syntax)
┌──┤ SYSTEM
└─ Switched to provider: openrouter (saved)
┌──┤ SYSTEM
└─   API Base: https://openrouter.ai/api/v1/chat/completions (from provider)
┌──┤ SYSTEM
└─   Model: openrouter/meta-llama/llama-3.1-405b-instruct:free (from provider)

[meta-llama/llama-3.1-405b-instruct:free] user: Clone your own source code from https://github.com/SyntheticAutonomicMind/CLIO/ . Analyze how you can create modules that do not break after CLIO updates.
YOU: Clone your own source code from https://github.com/SyntheticAutonomicMind/CLIO/ . Analyze how you can create modules that do not break after CLIO updates.
2026-03-04 16:22:16 [WARN][APIManager] NO previous_response_id on turn 2+ - this will be charged as NEW request
2026-03-04 16:22:17 [WARN][APIManager] NO previous_response_id on turn 2+ - this will be charged as NEW request
2026-03-04 16:22:18 [WARN][APIManager] NO previous_response_id on turn 2+ - this will be charged as NEW request
┌──┤ ERROR
└─ I'm sorry, I encountered an error: No endpoints found for meta-llama/llama-3.1-405b-instruct:free.

[meta-llama/llama-3.1-405b-instruct:free] user: /api set model openrouter/google/gemma-3-27b-it:free
┌──┤ SYSTEM
└─ Model set to: openrouter/google/gemma-3-27b-it:free (saved)

[google/gemma-3-27b-it:free] user: Clone your own source code from https://github.com/SyntheticAutonomicMind/CLIO/ . Analyze how you can create modules that do not break after CLIO updates.
YOU: Clone your own source code from https://github.com/SyntheticAutonomicMind/CLIO/ . Analyze how you can create modules that do not break after CLIO updates.
2026-03-04 16:23:02 [WARN][APIManager] NO previous_response_id on turn 2+ - this will be charged as NEW request
┌──┤ SYSTEM
└─ Temporary rate limit detected. Retrying in 60s... (attempt 1/20)

hartmund avatar Mar 04 '26 15:03 hartmund

Are you hitting quota errors? We may need to add a handler for that. btw, Gemma does not issue tool requests in a standard format that CLIO supports, so it may be problematic.

fewtarius avatar Mar 04 '26 15:03 fewtarius

Just checked, no, not with gemma at first attempt. There is function calling though with gemma: https://ai.google.dev/gemma/docs/capabilities/function-calling , maybe that can be used to create the right result?

hartmund avatar Mar 04 '26 16:03 hartmund

Just checked, no, not with gemma at first attempt. There is function calling though with gemma: https://ai.google.dev/gemma/docs/capabilities/function-calling , maybe that can be used to create the right result?

Yeah, I'm kind of on the fence about adding Gemma's tool calling, let me see what I can do with it. I'll also see if I can figure out what's happening with general use with this model.

fewtarius avatar Mar 04 '26 22:03 fewtarius

Just checked, no, not with gemma at first attempt. There is function calling though with gemma: https://ai.google.dev/gemma/docs/capabilities/function-calling , maybe that can be used to create the right result?

I've been looking into this, probably related to: https://aistudio.google.com/status

I'll check up on it in a few hours and see if it's available again so I can look into the tool calling stuff.

fewtarius avatar Mar 04 '26 23:03 fewtarius

Thanks. Making Gemma work would really do a lot for those of us who don't have the Copilot subscription. Latest logs:

[gemini-2.5-flash] user: Analyze your .md files from https://github.com/SyntheticAutonomicMind/CLIO . Figure out how to create a new module that doesn't break after updates.
YOU: Analyze your .md files from https://github.com/SyntheticAutonomicMind/CLIO . Figure out how to create a new module that doesn't break after updates.
2026-03-05 09:19:03 [WARN][APIManager] NO previous_response_id on turn 2+ - this will be charged as NEW request
┌──┤ TERMINAL OPERATIONS
└─ running 'git clone https://github.com/SyntheticAutonomicMind/CLIO.git' (exit code 128)

┌──┤ TERMINAL OPERATIONS

┌──┤ TERMINAL OPERATIONS
└─ running 'mkdir clio_repo_temp' (success)

┌──┤ TERMINAL OPERATIONS

┌──┤ TERMINAL OPERATIONS
└─ running 'mkdir /tmp/clio_repo' (success)

┌──┤ TERMINAL OPERATIONS

┌──┤ FILE OPERATIONS
└─ checking if CLIO exists (directory)

┌──┤ ERROR
└─ I'm sorry, I encountered an error: Unknown API error

[gemma-3-27b-it] user: Analyze your code at https://github.com/SyntheticAutonomicMind/CLIO . Figure out how you can develop modules that don't break after updates.
YOU: Analyze your code at https://github.com/SyntheticAutonomicMind/CLIO . Figure out how you can develop modules that don't break after updates.
2026-03-05 09:24:04 [WARN][APIManager] NO previous_response_id on turn 2+ - this will be charged as NEW request
2026-03-05 09:24:05 [WARN][APIManager] NO previous_response_id on turn 2+ - this will be charged as NEW request
2026-03-05 09:24:06 [WARN][APIManager] NO previous_response_id on turn 2+ - this will be charged as NEW request
┌──┤ ERROR
└─ I'm sorry, I encountered an error: Unknown API error

[gemma-3-27b-it] user: /api set provider openrouter
┌──┤ SYSTEM
└─ Switched to provider: openrouter (saved)
┌──┤ SYSTEM
└─   API Base: https://openrouter.ai/api/v1/chat/completions (from provider)
┌──┤ SYSTEM
└─   Model: openrouter/meta-llama/llama-3.1-405b-instruct:free (from provider)

[meta-llama/llama-3.1-405b-instruct:free] user: Analyze your code at https://github.com/SyntheticAutonomicMind/CLIO . Figure out how you can develop modules that don't break after updates.
YOU: Analyze your code at https://github.com/SyntheticAutonomicMind/CLIO . Figure out how you can develop modules that don't break after updates.
2026-03-05 09:24:26 [WARN][APIManager] NO previous_response_id on turn 2+ - this will be charged as NEW request
2026-03-05 09:24:27 [WARN][APIManager] NO previous_response_id on turn 2+ - this will be charged as NEW request
2026-03-05 09:24:28 [WARN][APIManager] NO previous_response_id on turn 2+ - this will be charged as NEW request
┌──┤ ERROR
└─ I'm sorry, I encountered an error: No endpoints found for meta-llama/llama-3.1-405b-instruct:free.

hartmund avatar Mar 05 '26 08:03 hartmund

I don't think we're going to be able to actually support Gemma models, it looks like they have aggressive rate limits even at tier 1 (looks like 15k tokens/min) and CLIO uses close to that with all of it's capabilities included in the prompt.

I don't see openrouter/meta-llama/llama-3.1-405b-instruct:free in the model list, 70b has a :free variant.

I did find and fix a couple of issues though, openrouter/meta-llama/llama-3.1-405b-instruct is working fine with this morning's release:

fordprefect:scratch $ ../clio --model openrouter/meta-llama/llama-3.1-405b-instruct
[INFO] Using temporary model: openrouter/meta-llama/llama-3.1-405b-instruct

CLIO - Command Line Intelligence Orchestrator
Session ID: 34476bcd-d465-414a-ac73-8f76a3a96acf
You are connected to meta-llama/llama-3.1-405b-instruct@OpenRouter
Type "/help" for a list of commands.

[meta-llama/llama-3.1-405b-instruct] scratch (tools-test-branch-2): hello
YOU: hello
CLIO: Hello! I'm CLIO, your AI development assistant. What task would you like to work on today? I can help with coding, debugging, testing, and more. Please provide a specific problem or goal, and I'll do my best to assist you.

[meta-llama/llama-3.1-405b-instruct] scratch (tools-test-branch-2): please do a simple tools test
YOU: please do a simple tools test
CLIO: Let's do a simple tools test.

Step 1: Create a test file

I'll use the file_operations tool to create a new file calledtest_file.txt in the scratch/ directory.

Step 2: Read the test file

Now, I'll use the file_operations tool to read the contents of the test_file.txt file.

Step 3: Delete the test file

Finally, I'll use the file_operations tool to delete the test_file.txt file.

This test verifies that the file_operations tool is working correctly for creating, reading, and deleting files.
Please let me know if you'd like to test any other tools or perform a different task.
┌──┤ FILE OPERATIONS
└─ creating scratch/test_file.txt (20 bytes)

┌──┤ FILE OPERATIONS
└─ reading scratch/test_file.txt (from line 1)

┌──┤ FILE OPERATIONS
└─ deleting scratch/test_file.txt (file)

CLIO:
Tools test successful. I created a test file, read its contents, and then deleted it. All operations completed successfully.

[meta-llama/llama-3.1-405b-instruct] scratch (tools-test-branch-2):


┌──┤ SYSTEM
├─ Saving session
└─ Goodbye!

fewtarius avatar Mar 05 '26 12:03 fewtarius