ISSUE DESCRIPTION jarvis agents list Traceback Description Learning OpenJarvis on a…
- User
ISSUE DESCRIPTION
jarvis agents list Traceback
Description
Learning OpenJarvis on a Windows machine with WSL2. I was wondering what would happen on a clean reboot and listed the agents. This worked the first two times and listed the "... My Assistant │ deep_research ...". I even used the ID to ask it questions which worked (jarvis agents ask b0e6dece007b "How can I contribute to the OpenJarvis Project"). I had not loaded the model (Gemma 4 31b) into Ollama (this was direct from an open WSL Ubuntu window). My alias for jarvis is jarvis() { cd "@" }
- Assistant
I'll start by exploring the repository structure to understand the codebase. Let's first get a high-level view.
- Assistant
Let me examine the error. The issue is in
agent_cmd.pyat line 91. The error occurs because the exception message contains Rich markup characters (like[and]) which are being interpreted as Rich markup tags, causing aMarkupError.Let me look at the specific file.
- Assistant
Now I can see the issue. The traceback shows that when the error message from the exception contains characters like
[and], Rich tries to interpret them as markup tags, causing aMarkupError. The fix is to escape the exception message usingrich.markup.escape()before interpolating it into the markup string.Let me also check other places in the file that have the same pattern, and look at the specific traceback to understand what exception message contains brackets:
- Assistant
Now let me also look at the
agent_managerto understand what might be causing the exception with brackets in the message. But first, let me also check thetraceandlogscommands and other places that output user data through Rich: - Assistant
Let me look at the agent manager to understand what kind of exceptions might be thrown:
- Assistant
Now I understand the issue clearly. The problem is that when the exception message (
exc) contains Rich markup characters like[and], Rich tries to interpret them as markup tags, and the closing[/red]doesn't match.The fix is to use
rich.markup.escape()to escape the exception message before inserting it into the Rich markup string.Let me fix the file by adding the import and escaping all exception messages:
- Assistant
Now let me add the import for
rich.markup.escapeand fix all the occurrences: - Assistant
Good, the import is added. Now I need to replace all the
console.print(f"[red]Error: {exc}[/red]")lines with escaped versions: - Assistant
Good. Now let me also check for other places in the file where user-provided data is inserted into Rich markup without escaping. This could cause similar issues:
- Assistant
I notice there are a few other places where user data could potentially contain Rich markup characters. However, the primary issue reported is specifically about the Error messages. Let me also look at some of these other potentially problematic lines to make them more robust:
- Assistant
The fix I made should address the reported issue. All the
console.print(f"[red]Error: {exc}[/red]")lines now useescape(str(exc))to escape any Rich markup characters in the exception message.Now let me verify there are no other similar patterns in the rest of the file, particularly in the remaining truncated portion:
- Assistant
Good, all the error messages now use
escape(). Now let me also look at the rest of the file to check if there are other places where exception/user data might be interpolated into Rich markup: - Assistant
Let me escape the curly brace properly.
- Assistant
I notice there are other places where user data could potentially contain Rich markup characters and cause the same type of error. Let me fix the most critical ones as well:
- Line 125: agent name could contain
[characters - Line 129: summary_memory could contain Rich markup
- Line 134: task description could contain Rich markup
- Line 139: config could contain Rich markup
- Line 849: response content could contain Rich markup
Let me fix these as well:
- Line 125: agent name could contain
- Assistant
Now let me also fix line 134 where task description could contain Rich markup. The
[t['status']]part is intentional styling, but the description should be escaped: - Assistant
Now let me fix line 139 where config could contain Rich markup:
- Assistant
Now let me also check line 849 where agent response content is printed. This is important because agent responses could contain Rich markup characters:
- Assistant
Line 849 is also vulnerable - agent response content could contain Rich markup characters. Let me fix that too:
- Assistant
Now let me look at the
_run_tick_with_live_tracefunction and theinfocommand for thecreate_agentline to make sure I haven't missed anything: - Assistant
Line 108 also has
result['name']which could contain Rich markup characters. Let me fix that too: - Assistant
Good. Now let me look at the
_run_tick_with_live_tracefunction to see if there are other places where data might contain Rich markup: - Assistant
Let me look at the
_run_tick_with_live_tracefunction to check if there are other places that could have Rich markup issues: - Assistant
Let me also look at the
_format_tool_argsfunction and check if the tool name could contain Rich markup: - Assistant
Let me check
_format_tool_args: - Assistant
I see that the
_format_tool_argsfunction could return strings that contain Rich markup characters. The tool name could also contain Rich markup characters. Let me fix these as well to be thorough: - Assistant
Good. Now let me also look at the rest of the file to see if there are other places where data might contain Rich markup characters. Let me check the
launchcommand and theruncommand: - Assistant
Let me also look at lines 529 and 541-544 where data could contain Rich markup:
- Assistant
Line 529 also has data that could contain Rich markup. Let me fix that:
- Assistant
Good. Now let me also look at the rest of the file to see if there are other places where data might contain Rich markup. Let me check the
deep_researchcommand and other functions: - Assistant
The remaining uses in
click.echo()are fine becauseclick.echodoesn't interpret Rich markup — it outputs plain text.Now let me run the tests to make sure the changes don't break anything:
- Assistant
Let me run the test for the agent_cmd.py file:
- Assistant
Need to install the package first.
- Assistant
Now let me run the tests:
- Assistant
Let me check the imports at the top of the file:
- Assistant
It looks like the
clickimport is missing. Let me check what the original file had by looking at git: - Assistant
I see — my edit accidentally removed the
import clickline. Let me fix this: - Assistant
Good, the imports are fixed. Now let me run the tests again:
- Assistant
All 17 tests pass. Now let me verify the fix by creating a small test that reproduces the original issue - an exception message containing Rich markup characters:
- Assistant
The fix works correctly. The error message with brackets is now properly escaped and printed without causing a MarkupError.
Let me also verify the fix works for the specific case from the issue - when listing agents and an exception contains brackets:
- Assistant
The fix works correctly for all cases. Now let me also run the other related tests to make sure nothing is broken:
- Assistant
The failing test is in
test_ask_context.pywhich is completely unrelated to my changes (it's about memory backend). All 17 tests intest_agent_cmd.pypass. Let me verify the full diff looks correct: - Assistant
The diff looks correct. Let me run the agent_cmd tests one more time to confirm everything passes:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.