Skip to content

Adapt list to show multiple workspaces, and separate available agent list#23

Merged
nezhar merged 1 commit into
mainfrom
list-cmd
Mar 3, 2026
Merged

Adapt list to show multiple workspaces, and separate available agent list#23
nezhar merged 1 commit into
mainfrom
list-cmd

Conversation

@nezhar
Copy link
Copy Markdown
Collaborator

@nezhar nezhar commented Mar 3, 2026

Refactors the agent listing functionality to improve both the code structure and the output format, especially for JSON and table display modes. The changes separate the concepts of configured agents and running agent containers, allowing for clearer output and easier testing of multiple running instances.

Output and Data Structure Improvements:

  • The JSON output from the list_agents command now distinguishes between configured agents (agents) and currently running agent containers (running), supporting multiple running instances per agent.
  • Table output is split into two: one for running agents (showing container and context) and another for configured agents (showing shortcut, agent name, and base image), making the CLI more informative and user-friendly.

Code Refactoring:

  • Refactored internal logic by replacing _running_map with _running_rows and _configured_agent_rows functions, simplifying how agent and container data are collected and displayed.

Testing Enhancements:

  • Updated tests to verify the new JSON payload structure, ensuring that configured agents and running containers are correctly reported and that multiple running instances are preserved in the output.

Summary by CodeRabbit

  • New Features
    • Running and configured agents now display in separate tables in the list command
    • Running agents table shows agent name, container ID, and workspace context
    • Configured agents table shows short name, full agent name, and base image
    • JSON output restructured with distinct "running" and "agents" keys

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 3, 2026

📝 Walkthrough

Walkthrough

The list_cmd.py file is refactored to separate the generation of configured agent rows and running container rows into dedicated functions. The list_agents command flow is updated to produce a modified JSON payload structure with distinct "running" and "agents" keys, and render separate tables for running and configured agents instead of a single aggregated view.

Changes

Cohort / File(s) Summary
Command Logic Refactoring
src/vibepod/commands/list_cmd.py
Introduces _configured_agent_rows() and _running_rows() helper functions to replace single-pass aggregation. Updates list_agents() to produce JSON payloads with separate "running" and "agents" keys, and render distinct tables for running vs. configured agents.
Test Updates
tests/test_list.py
Adds new test test_list_running_json_preserves_multiple_instances() to validate JSON output with multiple running containers. Modifies existing test_list_json_includes_short_and_full_agent_names() to access agent rows from payload["agents"] instead of direct payload structure.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 With whiskers twitching, I hop through the code,
Where running and config now take separate roads,
No more single-pass muddles, just clarity bright,
Two clean little tables—a refactored delight!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: separating configured agents from running agents and showing multiple workspaces in the list command.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch list-cmd

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/vibepod/commands/list_cmd.py (1)

63-64: Avoid eager configured-agent construction in --running paths.

configured_rows is built even when --running excludes configured agents. This adds unnecessary work and creates avoidable coupling to configured-agent metadata for running-only output. Build configured rows only when needed.

♻️ Proposed refactor
-    running_rows = _running_rows(containers)
-    configured_rows = _configured_agent_rows()
+    running_rows = _running_rows(containers)

     if as_json:
         import json

         payload: dict[str, Any] = {"running": running_rows}
         if not running:
-            payload["agents"] = configured_rows
+            payload["agents"] = _configured_agent_rows()
         print(json.dumps(payload, indent=2))
         return
@@
     if running:
         return

+    configured_rows = _configured_agent_rows()
     console.print()
     reference_table = Table(title="Configured Agents", title_justify="left")

Also applies to: 69-71, 87-97

tests/test_list.py (1)

29-35: Consider asserting the image field in configured-agent JSON rows.

The command now treats configured-agent rows as a defined schema (short, agent, image); adding an assertion here would guard against silent payload regressions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/test_list.py` around lines 29 - 35, The test currently builds rows =
payload["agents"] and by_agent = {row["agent"]: row for row in rows} and asserts
keys and shortcuts; extend it to also assert each configured-agent row includes
a non-empty "image" field to prevent schema regressions—for example, inside the
loop over AGENT_SHORTCUTS (or when iterating by_agent.values()) add an assertion
that "image" in by_agent[agent] and by_agent[agent]["image"] is truthy (or
compare against an expected IMAGE_MAP if one exists) so every agent row has a
defined image value.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/test_list.py`:
- Around line 29-35: The test currently builds rows = payload["agents"] and
by_agent = {row["agent"]: row for row in rows} and asserts keys and shortcuts;
extend it to also assert each configured-agent row includes a non-empty "image"
field to prevent schema regressions—for example, inside the loop over
AGENT_SHORTCUTS (or when iterating by_agent.values()) add an assertion that
"image" in by_agent[agent] and by_agent[agent]["image"] is truthy (or compare
against an expected IMAGE_MAP if one exists) so every agent row has a defined
image value.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3f80014 and 0302fa8.

📒 Files selected for processing (2)
  • src/vibepod/commands/list_cmd.py
  • tests/test_list.py

@nezhar nezhar merged commit 63ec333 into main Mar 3, 2026
17 checks passed
@nezhar nezhar deleted the list-cmd branch March 20, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant