Skip to content

feat(agents): opt out of reopening workspaces with creation agent - #10589

Closed
innocarpe wants to merge 3 commits into
stablyai:mainfrom
innocarpe:feat/opt-out-created-agent-reopen
Closed

innocarpe wants to merge 3 commits into
stablyai:mainfrom
innocarpe:feat/opt-out-created-agent-reopen

Conversation

@innocarpe

@innocarpe innocarpe commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • vitest — worktree-activation-created-agent.test.ts (13 tests, including opt-out)
  • Create worktree with Claude → exit → reopen sidebar: agent relaunches (default)
  • Toggle setting off → same flow opens blank terminal only
  • Settings search finds “reopen” / “created” under Agents

Closes #10578

ELI5

Reopening an empty workspace used to always relaunch the agent it was created with. A new setting lets you opt out so reopen starts a blank terminal while still remembering which agent created it.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@innocarpe, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 11 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3affb1f7-0b2d-463e-b601-01070d711971

📥 Commits

Reviewing files that changed from the base of the PR and between 48b45d82b32b463f80ba24599f1eb83acb7477df and 3738c18dc13aa79d4b2e72ef50a4dca82438aa98.

📒 Files selected for processing (1)
  • src/renderer/src/components/settings/CreatedAgentReopenSetting.tsx
📝 Walkthrough

Walkthrough

Adds a default-enabled reopenWorkspacesWithCreatedAgent setting to global settings. The Agents pane now provides an accessible toggle with localized copy and search support. Worktree activation skips the created-agent startup payload when the setting is disabled, while enabled launches use request_kind: 'new'. Tests cover the updated telemetry classification and disabled-setting behavior.

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary and test plan, but it omits required template sections like Screenshots, AI Review Report, Security Audit, and Notes. Add the missing template sections with screenshots or "No visual change", a testing checklist, AI review report, security audit, and notes.
Out of Scope Changes check ⚠️ Warning setting-labels.ts also adds windowBackgroundBlur, which is unrelated to the opt-out reopening-agent objective. Remove the unrelated windowBackgroundBlur label change or split it into a separate PR.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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
Title check ✅ Passed The title clearly names the main change: opting out of reopening workspaces with the creation agent.
Linked Issues check ✅ Passed The changes match #10578: they add an opt-out setting, keep it on by default, stop relaunching when disabled, and fix telemetry to 'new'.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6bc5e1be-7a25-4ab3-84a6-ee6ca6fdc066

📥 Commits

Reviewing files that changed from the base of the PR and between 505967e and 48b45d82b32b463f80ba24599f1eb83acb7477df.

📒 Files selected for processing (9)
  • src/renderer/src/components/settings/AgentsPane.tsx
  • src/renderer/src/components/settings/CreatedAgentReopenSetting.tsx
  • src/renderer/src/components/settings/agents-search.ts
  • src/renderer/src/components/settings/created-agent-reopen-copy.ts
  • src/renderer/src/components/settings/setting-labels.ts
  • src/renderer/src/lib/worktree-activation-created-agent.test.ts
  • src/renderer/src/lib/worktree-activation.ts
  • src/shared/constants.ts
  • src/shared/types.ts

Comment thread src/renderer/src/components/settings/CreatedAgentReopenSetting.tsx Outdated
@AmethystLiang
AmethystLiang self-requested a review July 25, 2026 18:30
@nwparker nwparker added the enhancement New feature or request label Jul 27, 2026
Workspaces created with an agent relaunched that agent on every empty
sidebar reopen. Add Settings → Agents toggle (default on) so users can
prefer a blank terminal instead, and label the launch as request_kind new
rather than resume since no provider session is restored.

Closes stablyai#10578
CodeRabbit: replace the bespoke switch markup with the settings form
primitive so interaction and styling stay consistent.
@innocarpe
innocarpe force-pushed the feat/opt-out-created-agent-reopen branch from 3738c18 to e9c4b48 Compare July 29, 2026 01:03
@innocarpe

Copy link
Copy Markdown
Contributor Author

Sync update (e9c4b4882)

Rebase onto upstream/main to clear merge conflicts

Comment thread src/renderer/src/components/settings/setting-labels.ts Outdated
@greptile-apps

greptile-apps Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR implements default-on reopening of workspaces with their creation agent (createdWithAgent) when a workspace has no open tabs, and adds a Settings → Agents toggle to opt out. Previously the code explicitly did not relaunch on reopen; this change reverses that default to satisfy #1814 while giving users the escape hatch requested in #10578.

  • Adds buildCreatedAgentReopenStartup in worktree-activation.ts, which reads reopenWorkspacesWithCreatedAgent from settings (default true) and, when enabled, assembles a full WorktreeStartupPayload for the creation agent with request_kind: 'new'.
  • Adds CreatedAgentReopenSetting component wired into AgentsPane and the agents search catalog, backed by GlobalSettings.reopenWorkspacesWithCreatedAgent.
  • Updates 13 vitest cases: the default-relaunch path, the opt-out path, multi-cycle opt-out, and WSL path quoting are all covered.

Confidence Score: 4/5

Safe to merge with the noted caveat — the new agent-reopen path works correctly and the opt-out setting is wired end-to-end, but an existing unfixed tracking issue can cause visit recency to be skipped when the worktree is already active with no tabs.

The hasActivationWork guard only checks opts?.startup, so when buildCreatedAgentReopenStartup is the sole source of a startup payload and the worktree is already the active terminal worktree, isPlainAlreadyActiveTerminal evaluates to true, skipping markWorktreeVisited and recordWorktreeVisit. This was flagged in a previous review pass and remains unaddressed.

Files Needing Attention: src/renderer/src/lib/worktree-activation.ts — the hasActivationWork calculation and the hardcoded launch_source in buildCreatedAgentReopenStartup.

Important Files Changed

Filename Overview
src/renderer/src/lib/worktree-activation.ts Core logic change: adds buildCreatedAgentReopenStartup and wires it into activateAndRevealWorktree; the unaddressed hasActivationWork issue from a previous review remains unfixed.
src/renderer/src/lib/worktree-activation-created-agent.test.ts Tests updated to reflect reversed default behavior; opts-out, WSL quoting, and multi-cycle cases all covered.
src/renderer/src/components/settings/CreatedAgentReopenSetting.tsx New settings component; correctly defaults to enabled via !== false guard.
src/shared/types.ts Adds reopenWorkspacesWithCreatedAgent: boolean to GlobalSettings with JSDoc.
src/shared/constants.ts Default set to true preserving #1814 behaviour; comment references both tracking issues.

Reviews (2): Last reviewed commit: "fix(settings): align created-agent reope..." | Re-trigger Greptile

Greptile: SETTING_LABELS must match the SettingsSwitchRow title string.

Co-Authored-By: Grok Companion <noreply@x.ai>
@innocarpe

Copy link
Copy Markdown
Contributor Author

Sync update (59aafa54b)

Address Greptile: setting label matches live UI title

@innocarpe

Copy link
Copy Markdown
Contributor Author

Closing in favor of merged #10647, which already closes #10578.

Empty-workspace activation no longer synthesizes a startup from createdWithAgent. This branch would duplicate that policy. Thank you @nwparker / @AmethystLiang.

@innocarpe innocarpe closed this Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Let workspaces opt out of relaunching the agent they were created with

4 participants