Skip to content

feat(agents): expand AR CLI surface#8237

Open
VaibhavAcharya wants to merge 10 commits intomainfrom
feat/agents-cli-revamp
Open

feat(agents): expand AR CLI surface#8237
VaibhavAcharya wants to merge 10 commits intomainfrom
feat/agents-cli-revamp

Conversation

@VaibhavAcharya
Copy link
Copy Markdown
Contributor

@VaibhavAcharya VaibhavAcharya commented May 7, 2026

Summary

This expands the agents CLI from the small "create / list / show / stop" surface into the full set of operations the agent runners API supports, so day-to-day workflows like reviewing the diff, opening a PR, committing to a branch, publishing to production, reverting to a session, or archiving a task all live in the CLI now. The static model whitelist is gone, replaced with a live fetch from the AI gateway so adding a new model upstream does not require shipping a CLI patch. The API calls are pulled out into a typed module so the individual command files stay focused on UX. Existing commands grow filters, watch mode, JSON/NDJSON output, attachments, and a few quality-of-life touches like detecting the local git branch and warning about uncommitted changes. Docs are regenerated, the original integration tests are updated to match the new contract, and there is now coverage for every new subcommand.

Expands netlify agents to use the full agent_runners API surface. Adds 7 new commands, extends create/list/show/stop with new flags, centralizes the API calls into a typed api.ts module, and replaces the static model whitelist with a live fetch from /api/v1/ai-gateway/providers.

New commands: follow-up, open, diff, pr, commit, publish, revert, archive, redeploy. New flags on existing commands: --watch, --session, --mode, --from-deploy, --parent, --dev-server-image, --attach, --branch/--user/--title/--since/--until/--page/--per-page/--account, --ndjson, --yes. Smarter defaults (local git branch detection, dirty/unpushed warnings) and renderer upgrades (hierarchical sessions, token + credit usage, conditional action hints, append-only watch ticker).

Test plan

  • npm run lint, npm run typecheck, npx prettier --check src/commands/agents/ — all clean
  • All 14 commands exercised end-to-end against the live API on a test site
  • Real diffs, file attachments (S3 upload), follow-up sessions, redeploy, archive, revert, publish all verified
  • Error paths verified for fake model IDs, invalid dates, missing files, no-repo PR/commit attempts
  • Integration test coverage added for every new subcommand

Sample output

Captured live from the worktree binary against real sites.

agents:list

.---------------------------------------------------------------------------------------------------------.
|                                  Agent Tasks for another-astro-starter                                  |
|---------------------------------------------------------------------------------------------------------|
|            ID            | STATUS |               PROMPT                | BRANCH | DURATION |  CREATED  |
|--------------------------|--------|-------------------------------------|--------|----------|-----------|
| 69e766451314e00fad873557 | DONE   | Use SWAR image as logo and add P... | main   | 2m 51s   | 21/4/2026 |
| 69de1cba3ca3140a0cfcf2b2 | DONE   | List all the skills                 | main   | 7m 38s   | 14/4/2026 |
| 69de1cac0458e700cf4ebc2a | DONE   | List all the skills                 | main   | 7m 26s   | 14/4/2026 |
'---------------------------------------------------------------------------------------------------------'

Showing 1-3 of 33 task(s) • Use --page 2 to see the next page

Use netlify agents:show <id> to view details

agents:list --status error

| 69b83212ff093b54828fb345 | ERROR  | Implement Netlify Edge function ... | main   | 7m 58s   | 16/3/2026 |
| 68d57302dc050f5cb525c611 | ERROR  | Convert Multipage App to Single ... | main   | 4m 49s   | 25/9/2025 |

Showing 1-2 of 2 task(s)

agents:show <id>

Agent Task Details

Basic Information:
  Task ID: 69e766451314e00fad873557
  Status: DONE
  Site: another-astro-starter (8cfc0eb3-041b-4984-adf6-50dfbd8fd55f)
  Created by: Vaibhav Acharya

Configuration:
  Agent: Codex
  Branch: main

Task:
  Prompt: Use SWAR image as logo and add PDF to home page

Timeline:
  Created: 21/4/2026, 5:27:58 pm
  Updated: 21/4/2026, 5:30:49 pm
  Completed: 21/4/2026, 5:30:49 pm
  Duration: 2m 51s

Sessions (1):

  1/1 Use SWAR image as logo and add PDF to home page
     DONE • took 2m 50s
     id: 69e766461314e00fad873559
     preview: https://agent-69e766451314e00fad8--another-astro-starter.netlify.app
     Tokens: 203.8k (in 14.0k, out 4.9k, cached 184.8k)
     Credits: 22.4192
     Result: The home page was updated to reflect the provided assets...

Actions:
  View diff: netlify agents:diff 69e766451314e00fad873557
  Open preview: netlify agents:open 69e766451314e00fad873557
  View in browser: https://app.netlify.com/projects/another-astro-starter/agent-runs/69e766451314e00fad873557

agents:show --watch (rate-limit resilience)

Watching agent task 69fdd87e6c3eef71f1a7f5a2 (Ctrl+C to stop)

• state: RUNNING
• session a7f5a4 RUNNING
! poll failed: HTTP 429: Too Many Requests — retrying
! poll failed: HTTP 429: Too Many Requests — retrying
• state: RUNNING → DONE
• session a7f5a4: RUNNING → DONE in 1m 33s

agents:diff --no-color --per-page 2

diff --git a/public/documents/war-lockdown-notice.pdf b/public/documents/war-lockdown-notice.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..fc350b67120576f76448dc31c64c3ea05034f12f
GIT binary patch
(binary content stripped)
diff --git a/public/images/swar.png b/public/images/swar.png
new file mode 100644
index 0000000000000000000000000000000000000000..1a19538db7cdfc4b47767538a7d34083d9d1e935
GIT binary patch
(binary content stripped)

Showing files 1-2 of 4 • Use --page 2 for the next page

agents:create

✓ Agent task created successfully!

Details:
  Task ID: 69fdd87e6c3eef71f1a7f5a2
  Prompt: Add a small comment at the top of README.md saying when this was last reviewed
  Agent: Claude
  Branch: main
  Status: NEW

Monitor progress:
  Watch: netlify agents:show 69fdd87e6c3eef71f1a7f5a2 --watch
  Show:  netlify agents:show 69fdd87e6c3eef71f1a7f5a2
  Browser: https://app.netlify.com/projects/vaibhav-test-201394/agent-runs/69fdd87e6c3eef71f1a7f5a2

The agent task runs remotely on Netlify infrastructure and may take a few minutes.

agents:follow-up

✓ Follow-up session created!

Details:
  Task ID: 69fdc6c98c634538340f301f
  Session ID: 69fdc7b7f8743e44b30755ed
  Prompt: Add a small README.md file with a brief description of this site
  Status: RUNNING

Monitor progress:
  Watch: netlify agents:show 69fdc6c98c634538340f301f --watch
  Show:  netlify agents:show 69fdc6c98c634538340f301f

agents:open

$ netlify agents:open <id> dashboard
Opening https://app.netlify.com/projects/another-astro-starter/agent-runs/69e766451314e00fad873557

$ netlify agents:open <id> pr   # when no PR exists yet
No pull request exists for this agent task.
Create one with: netlify agents:pr 69fdc6c98c634538340f301f

$ netlify agents:open <id> bogus
Error: Invalid target "bogus". Choose one of: preview, dashboard, pr

agents:pr

✓ Pull request created!

  URL: https://github.com/VaibhavAcharya/astro-platform-starter/pull/1
  Branch: agent-comment-to-readmemd-f5a2
  State: open

# second invocation is idempotent:
$ netlify agents:pr <id>
Error: Failed to create pull request: Pull request already exists: https://github.com/VaibhavAcharya/astro-platform-starter/pull/1

agents:redeploy

✓ Redeploy session created!

  Task ID: 69fdd87e6c3eef71f1a7f5a2
  Session ID: 69fdd9aba8684b924ee33606
  Source Session: 69fdd87f6c3eef71f1a7f5a4
  Status: RUNNING

Watch progress: netlify agents:show 69fdd87e6c3eef71f1a7f5a2 --watch

agents:stop

✓ Agent task stopped successfully!

Details:
  Task ID: 69fdd87e6c3eef71f1a7f5a2
  Previous Status: RUNNING
  New Status: CANCELLED

The agent task has been stopped and will not continue processing.

# idempotent on terminal states:
$ netlify agents:stop <id>
Agent task is already done.

agents:archive

✓ Agent task archived.
  Task ID: 69fdd87e6c3eef71f1a7f5a2

# refuses to fire from a non-TTY without --yes:
$ netlify agents:archive <id>
Error: Refusing to archive without --yes when stdin is not a TTY

Validation paths

$ netlify agents:list --status weird
Error: --status accepts only "live" or "error"

$ netlify agents:list --since notadate
Error: Invalid date "notadate". Use an ISO timestamp like 2026-05-01T00:00:00Z.

$ netlify agents:list --page 1.5
Error: --page must be a positive integer

$ netlify agents:create "test" --agent fakeagent
Error: Invalid agent. Available agents: claude, codex, gemini

$ netlify agents:show 0000000000000000aaaaaaaa
Error: Agent task not found: 0000000000000000aaaaaaaa

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • New Features

    • Added 9 new agent task commands: archive, commit, diff, follow-up, open, PR, publish, redeploy, and revert
    • Added file attachment support for agent creation and follow-up sessions
    • Added watch mode to monitor agent task progress in real-time
    • Added session-level management capabilities (stop, redeploy, revert specific sessions)
    • Expanded agent listing with advanced filtering (branch, user, title, date range, account) and NDJSON output
  • Documentation

    • Updated agent command reference with new subcommands and expanded options

Walkthrough

This PR adds a typed Agents API client and expanded TypeScript types/constants, implements nine new agents subcommands (archive, commit, diff, follow-up, open, pr, publish, redeploy, revert), refactors agents:create/list/show/stop with multi-step flows (git detection, attachments, watch/polling, pagination/filters), adds attachment upload support, updates CLI wiring/examples, refreshes docs, and adds comprehensive integration tests and mock-server enhancements.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(agents): expand AR CLI surface' directly describes the main change—expanding the agents CLI surface with new commands and features.
Description check ✅ Passed The description comprehensively covers the PR's scope, objectives, test plan, and sample outputs, clearly related to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/agents-cli-revamp

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

📊 Benchmark results

Comparing with 07fa4d1

  • Dependency count: 1,061 (no change)
  • Package size: 357 MB ⬆️ 0.00% increase vs. 07fa4d1
  • Number of ts-expect-error directives: 355 (no change)

@VaibhavAcharya
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

Actionable comments posted: 9

🧹 Nitpick comments (2)
docs/index.md (1)

28-28: 💤 Low value

Use smart apostrophes per documentation style guide.

The linter prefers smart apostrophes (') over straight quotes in user-facing text.

✏️ Suggested fix
-| [`agents:commit`](/commands/agents#agentscommit) | Commit an agent task's changes directly to a branch  |
+| [`agents:commit`](/commands/agents#agentscommit) | Commit an agent task's changes directly to a branch  |
-| [`agents:publish`](/commands/agents#agentspublish) | Publish an agent task's changes to production  |
+| [`agents:publish`](/commands/agents#agentspublish) | Publish an agent task's changes to production  |

Also applies to: 35-35

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/index.md` at line 28, Replace the straight apostrophe in the user-facing
table entry for `agents:commit` — the text "Commit an agent task's changes
directly to a branch" — with a smart apostrophe (’) to match the documentation
style guide; update the same phrase occurrence noted at the other location as
well so both instances use the smart apostrophe.
src/commands/agents/agents-list.ts (1)

154-163: 💤 Low value

Low-risk ReDoS pattern, but easily mitigated.

The RegExp is constructed from status.toUpperCase() where status comes from runner.state. While expected values are safe alphanumeric strings from AGENT_STATES, the API response could theoretically contain unexpected characters. The practical risk is low since states are typically controlled server-side, but escaping is a simple fix.

♻️ Optional: Escape regex metacharacters
+const escapeRegex = (str: string): string => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
+
 const colorizeStatuses = (tableOutput: string, runners: AgentRunner[]): string => {
   let output = tableOutput
   const statuses = new Set(runners.map((runner) => runner.state ?? 'unknown'))
   for (const status of statuses) {
     const plain = status.toUpperCase()
     const colored = formatStatus(status)
-    output = output.replace(new RegExp(`\\b${plain}\\b`, 'g'), colored)
+    output = output.replace(new RegExp(`\\b${escapeRegex(plain)}\\b`, 'g'), colored)
   }
   return output
 }

This addresses the static analysis warning about regex construction from variables.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/commands/agents/agents-list.ts` around lines 154 - 163, The RegExp in
colorizeStatuses is built from untrusted status strings (from runners[i].state)
and should escape regex metacharacters to avoid ReDoS or incorrect matching;
update colorizeStatuses to escape status (before calling status.toUpperCase())
when creating new RegExp (or build the regex via RegExp(escape(status), 'g')),
or alternatively use a safe literal-based replace strategy (e.g., split/join or
indexOf loop) and still call formatStatus(status) for replacement; reference the
colorizeStatuses function, the status variable derived from runner.state, and
formatStatus to locate and change the code.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/commands/agents.md`:
- Line 31: Replace the straight ASCII apostrophe in each occurrence of the
phrase "task's" with a typographic (smart) apostrophe so it reads "task’s" to
satisfy the docs linter; locate the occurrences by searching for the literal
token "task's" (e.g., near the `agents:commit` command entry and other places
where "task's" appears) and update them to "task’s" everywhere in the document.

In `@src/commands/agents/agents-commit.ts`:
- Around line 20-23: The check should use process.stdin.isTTY not
process.stdout.isTTY and the branch flag must be trimmed before validation:
change the gating condition where targetBranch is computed to test
process.stdin.isTTY, and normalize options.branch (e.g., assign trimmed value to
targetBranch or similar) so whitespace-only values don't bypass validation;
update any uses of targetBranch/options.branch (including the inquirer prompt
validator referenced around the prompt) to rely on the trimmed value.

In `@src/commands/agents/agents-create.ts`:
- Around line 64-75: The code interpolates the git ref name (upstream) into a
shell string (used by run) causing possible command injection; change the logic
in agents-create.ts to avoid shell interpolation by calling a safe API (e.g.,
child_process.spawnSync/execFileSync or your run wrapper variant that accepts
args) to run git rev-list with upstream passed as an argument array instead of
via template string; update the block that computes hasUnpushedCommits (the
upstream variable, the run call that executes `git rev-list --count
${upstream}..HEAD`, and any run helper used) to pass upstream as a separate
argument so special characters are not interpreted by the shell.

In `@src/commands/agents/agents-diff.ts`:
- Around line 20-23: The current parsing uses Number.parseInt which accepts
malformed inputs like "1abc" or "12.34"; update the validation in the block
handling input/name to first check the raw input with a strict regex (e.g.
/^\d+$/) and throw the same Error(`--${name} must be a positive integer`) if it
doesn't match, then safely parse with Number.parseInt(input, 10) (or Number) and
ensure value > 0; reference the variables input, name and the existing
Number.parseInt usage to locate and change the logic.

In `@src/commands/agents/agents-redeploy.ts`:
- Around line 23-27: The auto-selection currently calls
api.listAgentRunnerSessions(id, { page: 1, per_page: 20 }) and only inspects
that first page (sessions -> latestDone), which can miss completed sessions;
change the logic in agents-redeploy.ts to paginate through
listAgentRunnerSessions results until a session with state === 'done' is found
(or all pages are exhausted) instead of relying solely on page=1, per_page=20;
implement a loop/request pattern using api.listAgentRunnerSessions(id, { page:
n, per_page: m }) to fetch subsequent pages, stop early when latestDone is
located, and preserve the existing behavior of allowing an explicit --session
override.

In `@src/commands/agents/api.ts`:
- Around line 200-206: The listAiGatewayProviders function currently calls fetch
without the Authorization header; update it to pass the same request init used
by other methods (call getInit() and use that as the second argument to fetch or
merge it into an init object) so the Authorization header is included when
fetching `${baseUrl}/ai-gateway/providers`; keep the existing providersCache and
existing throwForStatus usage intact and ensure the response handling (await
response.json()) remains unchanged.

In `@src/commands/agents/attachments.ts`:
- Around line 51-55: The fetch call uploading attachments (the PUT to uploadUrl)
can hang indefinitely; add a timeout/signal to abort stalled uploads by creating
an AbortController (or using AbortSignal.timeout) and pass its signal into the
fetch options; ensure you clear or handle the timeout appropriately and surface
the abort error in the surrounding function (e.g., the upload logic in
src/commands/agents/attachments.ts where putResponse is awaited) so the command
fails fast instead of hanging.

In `@tests/integration/commands/agents/agents-archive.test.ts`:
- Around line 18-23: The mock route for the accounts endpoint in the baseRoutes
array doesn't include the minimal=true query so the test request GET
/api/v1/accounts?minimal=true isn't matched; update the accounts entry in
baseRoutes (the object with path 'accounts') to include the query (e.g., change
path to 'accounts?minimal=true' or otherwise match query shape) so the mocked
response is used and the CI warning is resolved.

In `@tests/integration/commands/agents/agents-follow-up.test.ts`:
- Around line 81-99: The test 'should pass agent and model in the request body'
currently mocks both provider endpoints which masks wrong API paths; remove the
redundant mock for the generic 'ai-gateway/providers' and keep only the specific
'agent_runners/ai-gateway/providers' route in the routes array so the test only
matches the intended endpoint (ensure the route object with path
'ai-gateway/providers' is deleted and the rest of the routes, including
'agent_runners/ai-gateway/providers', remain).

---

Nitpick comments:
In `@docs/index.md`:
- Line 28: Replace the straight apostrophe in the user-facing table entry for
`agents:commit` — the text "Commit an agent task's changes directly to a branch"
— with a smart apostrophe (’) to match the documentation style guide; update the
same phrase occurrence noted at the other location as well so both instances use
the smart apostrophe.

In `@src/commands/agents/agents-list.ts`:
- Around line 154-163: The RegExp in colorizeStatuses is built from untrusted
status strings (from runners[i].state) and should escape regex metacharacters to
avoid ReDoS or incorrect matching; update colorizeStatuses to escape status
(before calling status.toUpperCase()) when creating new RegExp (or build the
regex via RegExp(escape(status), 'g')), or alternatively use a safe
literal-based replace strategy (e.g., split/join or indexOf loop) and still call
formatStatus(status) for replacement; reference the colorizeStatuses function,
the status variable derived from runner.state, and formatStatus to locate and
change the code.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0895fa4d-bea9-42a9-aecf-86df6c49931e

📥 Commits

Reviewing files that changed from the base of the PR and between 07fa4d1 and f934bc0.

📒 Files selected for processing (34)
  • docs/commands/agents.md
  • docs/index.md
  • src/commands/agents/agents-archive.ts
  • src/commands/agents/agents-commit.ts
  • src/commands/agents/agents-create.ts
  • src/commands/agents/agents-diff.ts
  • src/commands/agents/agents-follow-up.ts
  • src/commands/agents/agents-list.ts
  • src/commands/agents/agents-open.ts
  • src/commands/agents/agents-pr.ts
  • src/commands/agents/agents-publish.ts
  • src/commands/agents/agents-redeploy.ts
  • src/commands/agents/agents-revert.ts
  • src/commands/agents/agents-show.ts
  • src/commands/agents/agents-stop.ts
  • src/commands/agents/agents.ts
  • src/commands/agents/api.ts
  • src/commands/agents/attachments.ts
  • src/commands/agents/constants.ts
  • src/commands/agents/types.ts
  • src/commands/agents/utils.ts
  • tests/integration/commands/agents/agents-archive.test.ts
  • tests/integration/commands/agents/agents-commit.test.ts
  • tests/integration/commands/agents/agents-diff.test.ts
  • tests/integration/commands/agents/agents-follow-up.test.ts
  • tests/integration/commands/agents/agents-list.test.ts
  • tests/integration/commands/agents/agents-open.test.ts
  • tests/integration/commands/agents/agents-pr.test.ts
  • tests/integration/commands/agents/agents-publish.test.ts
  • tests/integration/commands/agents/agents-redeploy.test.ts
  • tests/integration/commands/agents/agents-revert.test.ts
  • tests/integration/commands/agents/agents-show.test.ts
  • tests/integration/commands/agents/agents-stop.test.ts
  • tests/integration/utils/mock-api.ts

Comment thread docs/commands/agents.md Outdated
Comment thread src/commands/agents/agents-commit.ts
Comment thread src/commands/agents/agents-create.ts
Comment thread src/commands/agents/agents-diff.ts Outdated
Comment thread src/commands/agents/agents-redeploy.ts Outdated
Comment thread src/commands/agents/api.ts
Comment thread src/commands/agents/attachments.ts Outdated
Comment thread tests/integration/commands/agents/agents-archive.test.ts
Comment thread tests/integration/commands/agents/agents-follow-up.test.ts
@VaibhavAcharya
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@VaibhavAcharya
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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 (1)
tests/integration/commands/agents/agents-list.test.ts (1)

97-122: 💤 Low value

Clarify the relationship between --status live filter and state: 'running' response.

The test uses --status live (line 112) but the mock response returns state: 'running' (line 103). This works because live is the API filter value (mapped to filters.state), while running is a valid state the API returns for live runners. However, this implicit mapping may confuse future maintainers.

Consider adding a brief inline comment in the mock response to clarify this relationship, or rename the mock state to match what the API would actually return for a live filter.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/integration/commands/agents/agents-list.test.ts` around lines 97 - 122,
In the test "should filter by status" (agents-list.test.ts) clarify the implicit
mapping between the CLI flag '--status live' and the mock response's state value
by updating the mock to make intent explicit: either rename the
mockAgentRunner's state to the API-returned value for a live filter or add a
one-line inline comment next to the mock response (the object with state:
'running') explaining that 'live' is the filter value sent by the CLI while the
API returns 'running' for live runners; update the mock/object around
mockAgentRunner and leave the test assertions
(expect(cliResponse).toContain('RUNNING')) unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/integration/commands/agents/agents-list.test.ts`:
- Around line 97-122: In the test "should filter by status"
(agents-list.test.ts) clarify the implicit mapping between the CLI flag
'--status live' and the mock response's state value by updating the mock to make
intent explicit: either rename the mockAgentRunner's state to the API-returned
value for a live filter or add a one-line inline comment next to the mock
response (the object with state: 'running') explaining that 'live' is the filter
value sent by the CLI while the API returns 'running' for live runners; update
the mock/object around mockAgentRunner and leave the test assertions
(expect(cliResponse).toContain('RUNNING')) unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 947dd8b1-3f23-419e-b673-7b222d939d94

📥 Commits

Reviewing files that changed from the base of the PR and between d9608bb and c42c935.

📒 Files selected for processing (10)
  • src/commands/agents/agents-create.ts
  • src/commands/agents/agents-diff.ts
  • src/commands/agents/agents-list.ts
  • src/commands/agents/agents-open.ts
  • src/commands/agents/agents-redeploy.ts
  • src/commands/agents/agents-show.ts
  • src/commands/agents/api.ts
  • tests/integration/commands/agents/agents-diff.test.ts
  • tests/integration/commands/agents/agents-list.test.ts
  • tests/integration/commands/agents/agents-show.test.ts
🚧 Files skipped from review as they are similar to previous changes (6)
  • src/commands/agents/agents-redeploy.ts
  • tests/integration/commands/agents/agents-show.test.ts
  • src/commands/agents/agents-diff.ts
  • src/commands/agents/agents-open.ts
  • src/commands/agents/api.ts
  • src/commands/agents/agents-show.ts

@VaibhavAcharya VaibhavAcharya marked this pull request as ready for review May 8, 2026 14:43
@VaibhavAcharya VaibhavAcharya requested review from a team as code owners May 8, 2026 14:43
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