Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix(cli): dispatch show subcommand's run_id, not the --show flag

cgycorey9edd946b0d69
diff --git a/agent/cli/_legacy.py b/agent/cli/_legacy.py
index ba738c30b..7e03099fd 100644
--- a/agent/cli/_legacy.py
+++ b/agent/cli/_legacy.py
@@ -5901,7 +5901,7 @@ def main(argv: list[str] | None = None) -> int:
if args.command == "list":
return _coerce_exit_code(cmd_list(args.list_limit))
if args.command == "show":
- return _coerce_exit_code(cmd_show(args.show))
+ return _coerce_exit_code(cmd_show(args.run_id))
if args.command == "chat":
return _coerce_exit_code(cmd_interactive(args.chat_max_iter))
if args.command == "update":
diff --git a/agent/tests/test_cli_show_subcommand.py b/agent/tests/test_cli_show_subcommand.py
new file mode 100644
index 000000000..d628f25bf
--- /dev/null
+++ b/agent/tests/test_cli_show_subcommand.py
@@ -0,0 +1,41 @@
+"""Regression tests for the ``show`` subcommand dispatch.
+
+The subcommand parser defines a positional ``run_id``, but the dispatch
+previously read the ``--show`` flag instead — so ``vibe-trading show <id>``
+always crashed with ``TypeError: unsupported operand type(s) for /:
+'PosixPath' and 'NoneType'``. The flag form kept working, hiding the bug.
+"""
+
+from __future__ import annotations
+
+from cli import _legacy
+
+
+def test_show_subcommand_passes_run_id_to_cmd_show(monkeypatch) -> None:
+ """``show <run_id>`` must dispatch the positional run_id, not the flag."""
+ captured: list[str | None] = []
+ monkeypatch.setattr(
+ _legacy, "cmd_show", lambda run_id: captured.append(run_id)
+ )
+ assert _legacy.main(["show", "some_run_123"]) == 0
+ assert captured == ["some_run_123"], f"cmd_show got {captured!r}"
+
+
+def test_show_flag_still_passes_run_id(monkeypatch) -> None:
+ """``--show <run_id>`` (legacy flag form) must keep working."""
+ captured: list[str | None] = []
+ monkeypatch.setattr(
+ _legacy, "cmd_show", lambda run_id: captured.append(run_id)
+ )
+ assert _legacy.main(["--show", "flag_run_456"]) == 0
+ assert captured == ["flag_run_456"], f"cmd_show got {captured!r}"
+
+
+def test_show_missing_run_id_is_usage_error(monkeypatch) -> None:
+ """``show`` without a run_id is a parse error, not a crash."""
+ captured: list[str | None] = []
+ monkeypatch.setattr(
+ _legacy, "cmd_show", lambda run_id: captured.append(run_id)
+ )
+ assert _legacy.main(["show"]) != 0
+ assert captured == []