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 and the relevant file mentioned in the traceback.
Assistant
Now I understand the issue. The problem is that when an exception occurs, the error message
excmay contain characters that Rich interprets as markup tags (square brackets[and]). The lineconsole.print(f"[red]Error: {exc}[/red]")fails whenexccontains square brackets because Rich's markup parser gets confused.Let me find all occurrences of this pattern across the codebase.
Assistant
I'll run the searches one at a time.
Assistant
Let me reproduce the error first to confirm my understanding.
Assistant
Let me check if there's a virtual environment or how the project is set up.
Assistant
There's a virtual environment. Let me use it to reproduce the error.
Assistant
I've reproduced the error. Now let me verify the fix approach using the
styleparameter instead of inline markup tags.Assistant
The
styleparameter still parses markup. Let me try usingrich.text.Textorrich.markup.escape.Assistant
Let me test the fixes one at a time.
Assistant
The
escapeapproach works. Now let me understand the scope of the issue. The problem is two-fold:- The error message itself (containing brackets) needs to be escaped before being printed as markup.
- The original exception that's being raised needs to be investigated — why does
list_agentsfail after the ollama runner process dies?
Let me look at the actual root cause — why
list_agentsthrows an exception in the first place.Assistant
Let me look at
_row_to_agentto understand what error might occur.Assistant
Let me look at the schema migration code, since the exception might come from a column access issue.
Assistant
Let me look at
list_tasksandlist_channel_bindings.Assistant
Let me test a theory — the
status_styleline might produce bad markup when the status is not in the dict.Assistant
Let me reproduce the exact double-MarkupError scenario from the issue.
Assistant
Let me carefully analyze the position. Let me reproduce with a real inner MarkupError and check positions.
Assistant
Let me check what exception message length produces position 65 for the outer error.
Assistant
Let me set up a real reproduction with a database. First let me check the deep_research setup and how agents get created.
Assistant
Let me look at how
current_activityis set in the executor. Maybe it contains rich markup.Assistant
current_activityis set to plain strings, not displayed inlistanyway. Let me look at the activity strings at lines 496 and 569 which are multi-line.Assistant
Let me look at the deep_research setup command and how agents are created with that type.
Assistant
Let me look at the exact line numbers in agent_cmd.py around the list command.
Assistant
Let me brute-force search for what inner MarkupError message produces outer position 65.
Assistant
I found the root cause. The cell
[]needs_attention[/](when status is "needs_attention", not in the dict) produces an OUTER MarkupError at position 65 — exactly matching the issue. Let me confirm the exact reproduction matches the issue's traceback.Assistant
I've exactly reproduced the issue's traceback. The root cause is the agent's status being "needs_attention" (not in the status_style dict), producing invalid markup
[]needs_attention[/]. Let me verify "needs_attention" is a real status used in the codebase.Assistant
"needs_attention" is a real status set by the executor. Let me check the context.
Assistant
Let me check other statuses used in the server routes to make sure I cover all cases.
Assistant
Let me search for all status values that can be set on agents.
Assistant
I now fully understand the issue. Let me check the CLI module structure to see if there's a shared helper for console printing.
Assistant
Let me check existing tests related to agent_cmd and the list functionality.
Assistant
The existing tests only check
--help. Let me write a reproduction script that exercises the actualagents listcommand with an agent in "needs_attention" status.Assistant
Now let me write a reproduction script that invokes the actual
agents listCLI command with an agent inneeds_attentionstatus.Assistant
I've exactly reproduced the issue's traceback. Now let me look at all the error-printing patterns and check if there's a common console utility module.
Assistant
escapefromrich.markupis already a precedent in the codebase. Now let me implement the fixes. First, let me add the import and a helper function at the top ofagent_cmd.py.Assistant
Now let me add the
escapeimport and a_print_errorhelper.Assistant
Now let me fix Bug 1 — the status cell that produces invalid markup. I'll add the missing statuses and guard against empty
status_style.Assistant
The replace command requires the lines to be in the displayed window. Let me navigate to line 89 first.
Assistant
Now the lines are in view. Let me apply the Bug 1 fix to the status cell.
Assistant
Now let me replace all
console.print(f"[red]Error: {exc}[/red]")occurrences with_print_error(console, exc)in this file.Assistant
Let me fix the docstring to be accurate after the rename.
Assistant
Let me verify all the
{exc}error patterns were replaced in agent_cmd.py.Assistant
The remaining occurrences are the docstring reference (line 33) and a
click.echo(line 356) which doesn't parse markup — both fine. Now let me re-run the reproduction script to confirm the fix.Assistant
The fix works —
agents listnow displays the table with theneeds_attentionstatus. Let me test more edge cases: other unmapped statuses, unknown statuses, names with brackets, and the error handler robustness.Assistant
All edge cases pass. Let me also verify the error handler now displays a bracket-containing exception properly (instead of crashing), and check whether an unmatched bracket in a name could still crash.
Assistant
Let me test a name with an unmatched closing tag, which is the actual crash scenario.
Assistant
Even an unmatched closing tag in a name now gracefully shows an error (thanks to the escaped error handler) rather than a traceback. Let me check whether other commands in agent_cmd.py have a similar status-cell pattern.
Assistant
Let me look at the
statuscommand in agent_cmd.py which might render status similarly.Assistant
The
statuscommand usesclick.echowith plain text, so it's safe. Now let me run the existing tests to make sure I didn't break anything.Assistant
Let me run a broader set of CLI tests and the integration tests for the agent manager.
Assistant
There are failures, but they seem unrelated to my change. Let me verify they're pre-existing by stashing my changes and re-running a couple of them.
Assistant
The failures are pre-existing (they fail without my changes too). I notice
uv.lockshows as modified, which I didn't touch. Let me check that.Assistant
The
uv.lockwas modified by the environment, not by me. I'll restore it so only my intended change is submitted.Assistant
Now only
agent_cmd.pyis changed. Let me view the full diff to review my changes.Assistant
The diff is clean and focused. Let me do a final verification — confirm the module imports cleanly, re-run the reproduction, and run the agent_cmd tests.
Assistant
Everything works. Let me clean up the temporary test files before submitting.
Assistant
Only my intended change to
agent_cmd.pyremains. Let me do a final review of the complete modifiedlist_agentsfunction and the helper.Assistant
The changes are complete and verified. Let me submit.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.