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 inspect the CLI error path and related tests first. The traceback suggests the original exception contains Rich markup-like brackets, and interpolating it into a markup-enabled string causes a second exception that hides the real failure; I’ll confirm that and determine whether the underlying agent-list failure also needs correction.
- Assistant
The vulnerable interpolation appears throughout this command module, but I’ll focus the fix coherently on
agentsso every agent operation can safely report arbitrary exception text. Next I’ll inspect manager listing/recovery logic and CLI tests to identify the original exception likely triggered after an Ollama runner unloads, and I’ll directly reproduce Rich’s secondaryMarkupError. - Assistant
The manager’s list path is SQLite-only, so Ollama being unloaded should not itself matter. The exact secondary failure requires the original exception to contain a closing Rich tag (likely text such as
[/...]); regardless of source, exception text must be treated as plain text. I’ll inspect all agent command code and agent status writes, then implement a small safe error-rendering helper using RichText(rather than merely escaping one bracket pattern), and also make table row content safe because user-controlled names and persisted fields can contain markup. - Assistant
I found the root cause: persisted statuses include
budget_exceededandneeds_attention, but the list command only maps five statuses. An unmapped status constructs invalid markup like[]needs_attention[/]; Rich raises aMarkupError, whose message itself contains[/], and the exception handler then raises the reported secondMarkupError. I’ll fix both layers: render status as aTextobject with an optional style (safe for unknown/future statuses), add sensible styles for current statuses, and render all caught exceptions as styled plain text. I’ll avoid changing tests per the environment constraint and use temporary/in-memory scripts for the regression cases. - Assistant
The code now addresses the actual unmapped-status failure and the exception-handler masking failure. I’ll verify three targeted cases without modifying repository tests:
needs_attention,budget_exceeded, and a future unknown status must all produce a successful table; separately, an exception containing[/]must be printed without a traceback. Then I’ll run the existing agent CLI and manager suites plus formatting/lint checks available in the project. - Assistant
The targeted reproductions pass, including the exact problematic closing-tag content, and all 52 relevant existing tests pass. Ruff is not installed in this environment, so those checks could not execute; I’ll use the repository’s declared tooling to see whether it is available as a development dependency, restore the incidental
uv.lockchange again, and inspect the final diff. I’ll also confirm the pre-fix invalid status expression yields the same two-stage Rich error shape described in the issue. - Assistant
The exact old two-stage reproduction matches the reported traceback precisely—including the closing
[/red]mismatch at position 65—confirming the diagnosis. One more robustness check is warranted: agent names/types are persisted user data passed to Rich as strings. I’ll test whether malformed markup there can similarly break listing; if so, I’ll convert those dynamic cells to plainTexttoo. I’ll also run Ruff ephemerally from the declared version range without altering lockfiles. - Assistant
Rich does interpret dynamic table strings, and a name containing a closing tag can break
agents listindependently. I’ll therefore render every persisted textual agent field in this table as plainText, ensuring names, IDs, types, and statuses are data rather than markup. Then I’ll apply Ruff formatting and rerun the targeted regression, relevant tests, lint, and diff checks. - Assistant
The CLI itself exited successfully, and the existing tests still all pass; the temporary assertion failed because Rich wrapped one long table cell at Click’s default 80-column test width, so the raw expected substring was split. I’ll rerun with a wider terminal to validate literal preservation, inspect the formatted diff to ensure no unrelated semantic changes, and run the broader CLI test directory since the helper touches all agent subcommands’ error paths.
- Assistant
The broad CLI run produced 403 passes and 14 environment/unrelated failures: the Rust extension is unavailable, and an existing update notification contaminates JSON command output. None involve
agent_cmd.py; the focused 52 tests pass. The temporary malformed-value test again exited successfully, but Rich wraps table content based on its own console width despite Click’s width setting, so I’ll assert preserved fragments rather than contiguous wrapped text. I’ll also revert two unrelated lines changed only by the newer ephemeral Ruff formatter to keep the patch focused, then perform final checks.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.