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 "OPENJARVISH@"
}
Assistant
Let me look at the error. The issue is in agent_cmd.py line 91 where console.print(f"[red]Error: {exc}[/red]") is causing a MarkupError because exc contains a string with square brackets that Rich interprets as markup tags. The fix is to escape the exception message or use a different printing approach.
Let me look at the file.
Assistant
The problem is clear: when an exception message contains square brackets (like [something]), Rich interprets them as markup tags, causing a MarkupError. The fix is to escape the exception message before passing it to Rich. Let me find all occurrences of this pattern.
Assistant
Let me also check other CLI files for similar patterns.
Assistant
There are many occurrences across many files. The cleanest fix would be to create a shared helper function that prints an error safely (escaping the markup), and then replace all usages. But to keep things focused on the issue (which is specifically about agent_cmd.py line 91), I should fix all occurrences to be safe, but at minimum fix the pattern properly.
The best approach: create a helper function in a shared module and replace all the console.print(f"[red]Error: {exc}[/red]") calls with calls to this helper. But that's a big change. Alternatively, I can just use rich.markup.escape inline.
Let me think about the cleanest approach that's general enough. The issue is that exception messages can contain square brackets. The fix should escape the exception text.
I could do: console.print(f"[red]Error:[/red] {escape(str(exc))}") — this keeps the red styling for the "Error:" label but escapes the exc content. This is the cleanest.
But there are ~40 occurrences across many files. Let me create a helper and use sed to replace them all. Actually, let me think about what's the most maintainable. Since the issue specifically mentions agent_cmd.py, but the same bug exists everywhere, a general fix is better.
Assistant
Let me look at the variants more closely, especially the table one and the ones with newlines.
Assistant
The issue is that exc may contain square brackets which Rich interprets as markup. The fix: disable markup parsing while applying red style via the style parameter. Let me write a Python script to do all replacements reliably.
Assistant
Now I need to add the escape import to registry_cmd.py. Let me check its imports.
Assistant
Now let me verify there are no remaining unescaped occurrences and check the agent_cmd.py change.
Assistant
Missed one in registry_cmd.py. Let me fix it.
Assistant
The sed failed because of the special characters. Let me use the replace command via open/edit instead. Let me open the file.
Assistant
Now let me verify the changes in agent_cmd.py and registry_cmd.py.
Assistant
Let me check the registry_cmd.py table row line.
Assistant
Now let me write a reproduction script to confirm the fix works. The issue is that an exception with square brackets in its message causes a MarkupError.
Assistant
Rich isn't available in system Python. Let me use the project's virtual environment.
Assistant
The old pattern didn't raise here because the brackets were balanced. Let me make the reproduction more faithful to the actual error — the exception message likely contains a closing tag fragment that breaks parsing.
Assistant
The first case reproduces the exact error from the issue: MarkupError: closing tag '[/red]' at position 59 doesn't match any open tag. The new pattern handles it. Now let me verify the fix works in the actual CLI path using Click's CliRunner with a mocked manager.
Assistant
The fix works. Let me confirm the old behavior would have failed by temporarily checking against the original code, and then run the existing test suite to make sure nothing breaks.
Assistant
All existing tests pass. Let me run the broader CLI test suite to ensure nothing else broke across the files I modified.
Assistant
There are 14 failures. They look unrelated to my change (memory modules not found, version-check banner interference, JSON output). Let me verify they're pre-existing by stashing my changes and re-running the same tests.
Assistant
The failures are pre-existing — they fail in the original (stashed) state too, so my change doesn't break anything. I notice uv.lock shows as modified, which I didn't intend. Let me check.
Assistant
The uv.lock change is unrelated to my fix — it's a pre-existing environment artifact (likely from uv sync with Python 3.13). Since submit uses git diff for unstaged changes, I should restore it to avoid submitting an unrelated change.
Assistant
Now only my intended changes remain. Let me do a final review of the diff.
Assistant
The changes look good. Let me run the relevant tests once more to confirm, plus my reproduction test.
Assistant
All tests pass. Let me verify the newline variant changes too.
Assistant
Let me clean up the temp files.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
run "jarvis agents ask b0e6dece007b "How can I contribute to the OpenJarvis Project""
This will respond
Wait a bit, until GPU memory frees
run the "ps -aux|grep ollama" in another shell window and see only the one ollam process for the "serve"
run "jarvis agents list"
see Traceback
Expected Behavior
Expected the table listing with one idle agent: b0e6dece007b │ My Assistant │ deep_research │ idle │ 0 │ 0
Actual Behavior
Traceback
Operating System
Linux
Python Version
3.12
Hardware
NVIDIA GPU
Engine
Ollama
Logs / Traceback
Traceback (most recent call last):
File "/home/gru/projects/OpenJarvis/.venv/bin/jarvis", line 10, in <module>
sys.exit(main())
^^^^^^
File "/home/gru/projects/OpenJarvis/src/openjarvis/cli/__init__.py", line 122, in main
cli()
File "/home/gru/projects/OpenJarvis/.venv/lib/python3.12/site-packages/click/core.py", line 1485, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gru/projects/OpenJarvis/.venv/lib/python3.12/site-packages/click/core.py", line 1406, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/home/gru/projects/OpenJarvis/.venv/lib/python3.12/site-packages/click/core.py", line 1873, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gru/projects/OpenJarvis/.venv/lib/python3.12/site-packages/click/core.py", line 1873, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gru/projects/OpenJarvis/.venv/lib/python3.12/site-packages/click/core.py", line 1269, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gru/projects/OpenJarvis/.venv/lib/python3.12/site-packages/click/core.py", line 824, in invoke
return callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gru/projects/OpenJarvis/src/openjarvis/cli/agent_cmd.py", line 91, in list_agents
console.print(f"[red]Error: {exc}[/red]")
File "/home/gru/projects/OpenJarvis/.venv/lib/python3.12/site-packages/rich/console.py", line 1698, in print
renderables = self._collect_renderables(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gru/projects/OpenJarvis/.venv/lib/python3.12/site-packages/rich/console.py", line 1558, in _collect_renderables
self.render_str(
File "/home/gru/projects/OpenJarvis/.venv/lib/python3.12/site-packages/rich/console.py", line 1448, in render_str
rich_text = render_markup(
^^^^^^^^^^^^^^
File "/home/gru/projects/OpenJarvis/.venv/lib/python3.12/site-packages/rich/markup.py", line 167, in render
raise MarkupError(
rich.errors.MarkupError: closing tag '[/red]' at position 65 doesn't match any open tag
Interface
No new interfaces are introduced.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work.
For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state.
You can also reset all changes in the repository using git reset --hard command.
Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later.
Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands.
However you don't need to use git add or git commit before submitting your changes. In fact,
submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.
CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
If an error was reported in the issue description, I have successfully reproduced it.
If an error was reported in the issue description, I have confirmed that my fix resolves the error.
I have thought about edge cases and made sure my fix handles them as well.
I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass.
I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /OpenJarvis, current file: none) bash-$
Let me check if there's a shared cli utils module.