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 traceback shows the error occurs in
list_agentsat line 91 where it doesconsole.print(f"[red]Error: {exc}[/red]"). The exception messageexccontains square brackets which Rich interprets as markup tags, causing theMarkupError.Let me reproduce this to confirm:
Assistant
Need to use uv or install. Let me check the environment.
Assistant
I've reproduced the
MarkupError. The exception message contains square brackets which Rich interprets as markup. Now let me investigate the underlying cause — what exception is actually being thrown inlist_agentsthat triggers this error handler.Assistant
Let me look at the
list_agentsmethod andlist_tasks,list_channel_bindingsmethods to understand what could be failing.Assistant
Let me look at the
_row_to_agentmethod and the schema migrations to understand what exception might be raised:Assistant
Let me look at
_row_to_agent,_row_to_task, and_row_to_binding.Assistant
I've confirmed the
MarkupError. The exception messageexccontains square brackets which Rich interprets as markup tags. This is a systematic issue across the CLI. Let me find all occurrences of this fragile pattern:Assistant
This is a systematic issue across many CLI files. Let me look at the CLI package structure to find the best place for a shared helper:
Assistant
Let me check the existing patterns and whether there's a shared CLI utility module. Let me also check what other similar markup patterns exist with dynamic content:
Assistant
Let me examine the variants of the pattern more closely (some have
\n, and one is in a table row):Assistant
Now I have a full picture of the issue. The pattern
console.print(f"[red]Error: {exc}[/red]")interpolates the raw exception message into Rich markup. Whenexccontains square brackets (e.g.[Errno 111] Connection refused), Rich raises aMarkupErrorthat masks the real error.Let me verify the escape function works as a fix first:
Assistant
The
escapefunction works as a fix. Now let me also investigate the underlying exception that triggers this error handler, to see if there's a real bug. Let me look atload_configand try to reproduce the actuallist_agentsfailure:Assistant
Let me try to actually reproduce the underlying
list_agentsfailure by running the CLI in this environment:Assistant
Clean environment works. Let me create an agent and then simulate a problematic state:
Assistant
The list works in a clean environment. Let me investigate the
askcommand path and what state it might leave, and checkdetect_hardware(called byload_configin_get_manager):Assistant
Let me try running
ask(which will fail to connect to ollama here) and thenlist, to see if theaskfailure leaves bad DB state:Assistant
My grep didn't extract the agent ID. Let me get it differently.
Assistant
The DB path is different. The config uses
~/.openjarvis/agents.dbby default (DEFAULT_CONFIG_DIR / "agents.db"), not under OPENJARVIS_HOME. Let me find the actual DB path.Assistant
Let me check the agent status after the failed ask and look at
detect_hardware:Assistant
The agent status is "idle" — the DB state is fine after a failed ask. The underlying exception in the user's environment is environment-specific (ollama/GPU state), but the clear, reproducible bug is the
MarkupErrorin the error handler — it masks whatever real error occurs.Let me now apply the fix comprehensively. First, the global replacement of the fragile pattern with escaped exception text:
Assistant
The replacement worked. Now I need to add
from rich.markup import escapeimport to each affected file. Let me check which files already import it (to avoid duplicates):Assistant
All 13 files need the import. Let me check how each file imports
Consoleto add theescapeimport consistently:Assistant
All files have a top-level
from rich.console import Console. Let me addfrom rich.markup import escapeafter it in each file using a script:Assistant
All imports added. Let me verify the changes look correct in
agent_cmd.py:Assistant
Let me verify the table.add_row case in registry_cmd.py and check a couple more files:
Assistant
All variants are correctly handled (the
\nprefixes/suffixes preserved). Now let me reproduce the original issue through the actual CLI command path to confirm the fix. I'll monkeypatch_get_managerto raise a bracketed exception (like[Errno 111] Connection refused):Assistant
The fix works — it now prints the actual error instead of crashing with a
MarkupError. Let me verify all modified files import correctly (no syntax/import errors):Assistant
All modules import cleanly. Now let me run the existing tests to make sure nothing is broken:
Assistant
All CLI tests pass. Let me run the broader CLI and agents test suites to be thorough:
Assistant
Let me check whether these failures are pre-existing (unrelated to my change) by stashing my changes and re-running the failing tests:
Assistant
The failures are pre-existing (environment-related, e.g.
ModuleNotFoundError: No module named 'openjarvis_rust') — not caused by my changes. Butgit stash popfailed due to auv.lockconflict from theuv runrebuild. Let me restore my changes properly:Assistant
My source changes are in the stash; only
uv.lockis modified in the working tree. Let me discard theuv.lockchange and pop the stash to restore my source changes:Assistant
My 13 source files are restored. The
uv.lockwas auto-modified byuv runrebuilding the local package — that's not part of my fix. Let me check and discard it:Assistant
The
uv.lockchange is just environment-related Python version resolution markers — not part of my fix. Let me discard it:Assistant
Now only my 13 source file changes remain. Let me re-run the relevant CLI tests to confirm everything still passes with my changes in place:
Assistant
All 97 tests pass. Let me run my reproduction script one final time to confirm the fix is in place after the stash/restore:
Assistant
All edge cases are handled correctly. Let me also confirm the normal (non-error) path of
jarvis agents liststill works end-to-end:Assistant
The normal path works — the table displays correctly. Let me clean up the test artifacts I created:
Assistant
Now let me review the final diff to confirm all changes are correct and complete:
Assistant
The
uv.lockgot re-modified by subsequentuv runtest executions (it rebuilds the local package and rewrites Python version markers). This is not part of my fix. Let me discard it and verify it stays clean:Assistant
Now the diff is clean — only my 13 source file changes. Let me do a final review of the variant cases (the
\nvariants and the table row):Assistant
All changes look correct — imports placed right after
from rich.console import Console, and the replacements preserve surrounding formatting (including\nvariants and the table row case). Let me do a final check for any duplicate imports or conflicts:Assistant
I forgot the
.pyextension. Let me fix the check:Assistant
Each file has exactly one
escapeimport, and no unescaped{exc}patterns remain (the exit code 1 is just grep finding no matches, which is what we want).Let me do a final status check to ensure
uv.lockis clean before submitting:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.