Skip to content

Add web agent creation controls#249

Merged
TraderSamwise merged 3 commits into
masterfrom
feat/web-api-parity-creation
Jun 26, 2026
Merged

Add web agent creation controls#249
TraderSamwise merged 3 commits into
masterfrom
feat/web-api-parity-creation

Conversation

@TraderSamwise

@TraderSamwise TraderSamwise commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • add a shared web new-agent panel backed by /agents/spawn
  • mount the creation panel in the project dashboard with tool and worktree selection
  • add a fork button to web agent actions backed by /agents/fork
  • refresh desktop/project API views after spawn and fork mutations

Verification

  • cd app && yarn typecheck
  • cd app && yarn test
  • yarn typecheck
  • git diff --check
  • push hook: yarn typecheck && yarn lint && yarn test

Summary by CodeRabbit

  • New Features

    • Added a panel to start a new agent directly from the dashboard, with tool selection and worktree choice.
    • Added a new Fork action for existing agents, including support for forking from the main checkout when applicable.
    • Improved agent controls across chat, sidebar, and dashboard views to better reflect the active worktree.
  • Bug Fixes

    • Updated agent actions to use the correct worktree path in more cases, improving consistency when creating or forking agents.

@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment Jun 26, 2026 3:03am

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6289780e-84c5-41b9-bc3d-e03988017f54

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR adds an agent creation panel to the dashboard, threads mainCheckoutPath through existing agent action renderers, and adds a Fork action that calls forkAgent with a computed worktree path.

Changes

Agent controls and creation

Layer / File(s) Summary
New agent creation panel
app/components/agent-create-panel.tsx
A new panel lets users pick a tool and worktree, calls spawnAgent, and shows success or error feedback.
Dashboard placement
app/components/WorktreeDashboard.tsx
WorktreeDashboard renders AgentCreatePanel above WorktreeList, adjusts padding, and stops forwarding padded to the list.
Checkout path threading
app/components/ProjectSidebar.tsx, app/components/WorktreeDashboard.tsx, app/components/screens/AgentChatScreen.tsx
mainCheckoutPath is added to AgentRow and passed from main checkout buckets and the chat header into AgentActions.
Fork action
app/components/agent-actions.tsx
AgentActions derives a fork tool, computes a fork worktree path, and conditionally renders a Fork control that calls forkAgent.

Sequence Diagram(s)

Fork action flow

sequenceDiagram
  participant User
  participant AgentActions
  participant forkAgent
  User->>AgentActions: press Fork
  AgentActions->>forkAgent: forkAgent({ sourceSessionId, tool, worktreePath, open: false }, { token })
  forkAgent-->>AgentActions: fork result
Loading

Review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

Hop hop, I scout the worktree glow,
A fresh new panel starts the show.
Forked paths twinkle, side by side,
mainCheckoutPath keeps the rabbit guide.
🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 23.08% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding web agent creation controls and related UI actions.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/web-api-parity-creation

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

@TraderSamwise

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

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.

@TraderSamwise

Copy link
Copy Markdown
Owner Author

Independent review findings fixed in ad8c783:

  • Replaced invalid hardcoded shell choice with the built-in enabled tool set used by the default config: claude, codex, aider.
  • Defaulted creation to claude, matching the default tool config.
  • Removed duplicate main-checkout worktree choices so main checkout creation omits worktreePath.
  • Added selected accessibility state to tool and worktree choices.

@TraderSamwise

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

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.

@TraderSamwise

Copy link
Copy Markdown
Owner Author

Second independent review findings fixed in b49265a:

  • Fork now hides for sessions without a valid agent tool key; command fallback is limited to known built-in agent tools.
  • Fork now normalizes main-checkout sessions by omitting worktreePath when the session path matches main checkout context.
  • Dashboard, sidebar, and chat header all pass main-checkout context into AgentActions.

@TraderSamwise

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
app/components/agent-create-panel.tsx (1)

35-41: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Redundant path filtering.

worktreeChoices already excludes entries without a path (Line 38), so the second .filter((choice) => choice.path) at Line 104 is dead. You can drop it to simplify the render.

♻️ Proposed simplification
-          {worktreeChoices
-            .filter((choice) => choice.path)
-            .map((choice) => (
+          {worktreeChoices.map((choice) => (
               <WorktreeChip
                 key={choice.key}
                 label={choice.label}
                 active={worktreePath === choice.path}
                 onPress={() => setWorktreePath(choice.path)}
               />
             ))}

Also applies to: 103-113

🤖 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 `@app/components/agent-create-panel.tsx` around lines 35 - 41, The render logic
still applies a redundant path check to worktreeChoices even though the useMemo
in agent-create-panel already filters out entries without a path. Remove the
unnecessary .filter((choice) => choice.path) from the worktree rendering path
and rely on the existing filtering in worktreeChoices, keeping the
mapping/selection logic in sync with the worktreeChoices memo.
app/components/ProjectSidebar.tsx (1)

355-355: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider passing the canonical main-checkout path instead of the session's own path.

Here mainCheckoutPath is set to session.worktreePath, but AgentActions only uses this prop to decide whether to omit the worktree path on fork (session.worktreePath !== mainCheckoutPath). Feeding the session's own path works solely by self-comparison, which is indirect and diverges from AgentChatScreen.tsx (line 497) where the real desktopState.mainCheckoutPath is passed. Using bucket.path would be equivalent in behavior but clearer and consistent across callers.

♻️ Suggested change
-              mainCheckoutPath={bucket.isMainCheckout ? session.worktreePath : undefined}
+              mainCheckoutPath={bucket.isMainCheckout ? bucket.path : undefined}
🤖 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 `@app/components/ProjectSidebar.tsx` at line 355, The main-checkout path passed
into AgentActions is using the session’s own worktree path instead of the
canonical main checkout path, which is indirect and inconsistent with other
callers. Update the mainCheckoutPath prop in ProjectSidebar’s AgentActions usage
to pass the bucket’s canonical path (matching the behavior used by
AgentChatScreen with desktopState.mainCheckoutPath), so the fork comparison
remains clear and consistent.
🤖 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 `@app/components/agent-create-panel.tsx`:
- Around line 35-41: The render logic still applies a redundant path check to
worktreeChoices even though the useMemo in agent-create-panel already filters
out entries without a path. Remove the unnecessary .filter((choice) =>
choice.path) from the worktree rendering path and rely on the existing filtering
in worktreeChoices, keeping the mapping/selection logic in sync with the
worktreeChoices memo.

In `@app/components/ProjectSidebar.tsx`:
- Line 355: The main-checkout path passed into AgentActions is using the
session’s own worktree path instead of the canonical main checkout path, which
is indirect and inconsistent with other callers. Update the mainCheckoutPath
prop in ProjectSidebar’s AgentActions usage to pass the bucket’s canonical path
(matching the behavior used by AgentChatScreen with
desktopState.mainCheckoutPath), so the fork comparison remains clear and
consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 152c27e6-c290-4882-b295-f2ca0cdff59a

📥 Commits

Reviewing files that changed from the base of the PR and between be2b895 and b49265a.

📒 Files selected for processing (5)
  • app/components/ProjectSidebar.tsx
  • app/components/WorktreeDashboard.tsx
  • app/components/agent-actions.tsx
  • app/components/agent-create-panel.tsx
  • app/components/screens/AgentChatScreen.tsx

@TraderSamwise
TraderSamwise merged commit e4d3723 into master Jun 26, 2026
3 checks passed
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