Skip to content

feat(plugins): start a task in an existing workspace - #30466

Draft
DimitriBrick wants to merge 28 commits into
stablyai:mainfrom
DimitriBrick:feat/task-start-existing-workspace
Draft

DimitriBrick wants to merge 28 commits into
stablyai:mainfrom
DimitriBrick:feat/task-start-existing-workspace

Conversation

@DimitriBrick

@DimitriBrick DimitriBrick commented Oct 19, 2026 •

Copy link
Copy Markdown

Stacked on #26282 (plugin task sources), which this builds on. Until that merges, the diff here includes it; the change itself is the last two commits, c1da3d2 and 453f8e1.

ELI5

Pressing Start on a plugin task always made a brand-new workspace. Some tasks belong to a
workspace that already exists (its files, notes and pending work live there), so a new one
cannot continue them. Now the Create workspace form lets you pick that existing workspace
instead, and the agent opens there with the task's prompt ready to review.

What Changed

Before: Start on a task opened Create workspace, and the only outcome was a new workspace with
the agent started in it.

After: when the form is opened with an agent prompt (which is what a task's Start does), a
Run in field sits under the prompt with New workspace (the default, unchanged
behaviour) and the project's existing workspaces on the same host. Picking one changes the
button to Start in workspace. Pressing it opens a new agent tab in that workspace with the
prompt typed in but not sent, and records the task link on the workspace, so its sidebar card
shows the task. The field is disabled with the form's existing "pick an agent" text when no
agent is chosen, and hidden for folder workspace targets, which cannot hold a task link.
Switching project falls back to New workspace. While an existing workspace is picked, the form
leaves out what only shapes a new one (workspace name, Advanced and Create more); picking New workspace again brings them back with their values.

Mechanism: the form calls a new startTaskInExistingWorkspace, which launches through
launchAgentInNewTab with promptDelivery: 'draft' and the launch platform from
resolveRepoWorktreeLaunchPlatform, the same host-aware route the checks Fix action uses for an
existing workspace, then writes the link with
persistCreatedWorkspacePluginTaskLink. launchAgentInNewTab gains an optional
sessionOptions, so a task's pinned model and effort apply here as they do for a new
workspace. The candidate list (the project's live workspaces on the
composer's host) is composer-worktree-candidates.ts. No change to
the plugin task schema, the start recipe or the main process.

Built on the #26282 branch at e62f51ebc.

Why

A plugin that lists work living in existing workspaces (an overnight job parked in one, a
handoff to resume in another) needs Start to reach that workspace; a fresh one has none of the
state. Putting the choice in the form keeps one Start button and one flow, works for any task
source and any project kind, and needs no plugin API change. The alternatives were a start
recipe field naming a target workspace (a schema and protocol change, and the plugin would have
to know Orca's workspace ids) or a second button on the task detail (a parallel flow that skips
the prompt review and agent choice the form already gives).

Known limits: a workspace already linked to another task takes the new link, since a workspace
holds one. The link-save failure toast still says "Workspace created", which reads oddly on this
path. Session options reach the terminal launch routes; the structured chat route does not read
them.

Linked Issue

Fixes #30464

Visual Proof

Taken in a throwaway profile with a demo project and the examples/plugins/hello-tasks sample plugin.

Before: Start on a task always makes a new workspace After: a Run in field under the prompt
Create worktree opened from a task, no Run in field Create worktree with Run in set to New workspace
Run in lists the project's workspaces After picking one, the form keeps only what applies
Run in list: New workspace, docs-refresh, fix-upload-retry, main Start in workspace form with fix-upload-retry picked

Start in workspace opened an agent tab in fix-upload-retry with the prompt typed but not sent, and the workspace card shows the task link:

Agent tab with the unsent prompt; sidebar card shows Wire up the login form

Testing

  • pnpm tc passes on plugin-task-sources at e62f51ebc.

  • pnpm test:node on the touched test files and their neighbours (37 files, 247 tests) passes,
    including new tests for the candidate list, the Run in field's states, the launch (draft
    delivery and the link on success, no link when the launch or the reveal fails, a missing
    workspace, no agent), and the form leaving out the new-workspace fields, including mid-way
    through a sparse preset edit.

  • check:code-quality:changed (base e62f51ebc), check:max-lines-ratchet,
    verify:localization-catalog and verify:localization-extraction pass.

  • Automated checks run on Windows. Manual check in the app (Windows, a pnpm dev instance with
    the sample plugin, the screenshots above): Start on a task, Run in set to an existing workspace,
    opens the agent there with the prompt typed and unsent, and the workspace card shows the task
    link; the form drops the new-workspace fields while an existing workspace is picked.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Written with Claude Code (Claude Opus 5.5) from a reviewed plan; reviewed by the author.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Independent of #30465 (plugin task list shortcuts); either can merge first.

Security: no new IPC or input surface; the workspace list is the renderer's own index. SSH and
runtime-owned workspaces go through launchAgentInNewTab, which resolves the workspace's host.
No new paths or shortcuts.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

🤖 Generated with Claude Code

ggrafhalfbrick and others added 28 commits October 7, 2026 09:06
A plugin can now declare contributes.taskSources (with the new tasks:provide
capability, shown in the consent dialog) and register list/get handlers with
orca.tasks.registerSource in its worker. Main validates every request and every
worker answer against strict schemas before anything reaches a renderer.

Each source gets a tab on the Tasks page beside the built-in providers, with
search, plugin-defined filters, a list, and a detail sheet. An item's start
recipe opens Create workspace prefilled with the name, project, base and a new
editable Agent prompt, which is typed into the agent as a draft; nothing is
created until the user clicks Create. The last plugin tab picked is remembered.

Includes the hello-tasks example plugin and an e2e spec for the whole flow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n settings

Plugin task sources now:
- remember each source's search and filters per device, so the list comes
  back as the user left it after visiting other pages or restarting;
- link a workspace to the task it was started from: the sidebar card shows
  the task and opens it, and the task list and detail show the workspaces
  already started from a task ("Open workspace" / "Start another");
- let a start recipe pin agent session options (model, effort) for the agent
  they are written for, shown in Create workspace; other agents start with
  their own;
- carry small link metadata that the workspace keeps with its link.

Plugins can declare contributes.settings (string, boolean, enum; needs
settings:own). Settings > Plugins shows a Settings dialog for them, and values
land in the plugin's own settings store that the worker already reads.

Also clears the stale "Enter a plugin folder path" error once a path is typed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The examples were borrowed from a private plugin: a "Read from" setting with
a depot option, Perforce stream base refs, and a project-specific label.
Use a generic "Sort by" setting and a plain branch name instead, and drop the
Perforce mention from the baseRef doc, since main has no Perforce support.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ect.apply

Two worktree merge tests compared whole objects and missed the new
linkedPluginTask field. The task-source activation test called the API
through Reflect.apply, which the anti-slop gate rejects; it now types the
fake plugin's view of the API instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The commit hook's formatter wrapped this upstream line during the merge,
which left the cast one line below its oxlint-disable comment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A remembered filter value the source stopped offering showed its picker's
default, while the list request and the saved view kept sending the stale
value. Once a list arrives, selections that are no longer offered (or whose
filter is gone) are dropped, so the request, the saved view and the pickers
agree; the source then applies its own default, as it does for an unset filter.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Saving a new workspace's link to its plugin task discarded the result, so a
failed metadata write lost the link silently. The result is now checked and a
failure shows a toast. The save stays off the creation path so a slow host
never delays opening the workspace or starting its agent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Start opened Create workspace on the active project whenever a recipe's
projectPath did not match one, so the new workspace could land in an
unrelated repository with a base ref from another.

Start recipes can now name projectSource, where the project's files
come from (for example a Git remote URL). Without projectPath, Orca asks
one matcher per source-control kind; the Git matcher compares the URL
with each project's stored remote identity (any forge, scp/https/ssh
forms, forge alias hosts, SSH host aliases ranked lower) and prefers the
active project, then local over SSH, on ties. When a recipe names a
folder or source that no project matches, Start shows which one is
missing instead of opening another project. Recipes that name neither
keep the composer's usual default.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A project keeps one remote identity and prefers its upstream remote, so
a task naming a fork's URL found no clone whose upstream is the parent,
and a fork clone without an upstream remote did not match a task naming
the parent. Both now match, ranked below an exact remote and an SSH host
alias: a project whose forge-reported parent is the task's repository,
or one whose identity comes from upstream and shares the host and
repository name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…okups

A fork parent saved without a host was assumed to be on github.com, so a
GitHub Enterprise fork could match a same-named github.com task, and a mixed-
case host never matched. Like repoUpstreamIdentityKey, the parent now takes
the clone's own host, and the fork match is refused when that is unknown.

Start's project lookup is async and fire-and-forget, so a failing matcher now
shows its error in a toast instead of becoming an unhandled rejection.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The load pass only checked a truthy linkedPluginTask, so a stored '', 0 or
false skipped validation and stayed in memory. Every present value is now
validated, as the write path already does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Clearing the "enter a plugin folder path" error while typing is unrelated to
task sources and plugin settings, so it comes out of this branch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Upstream dropped the selectedRepo argument from quick submit and stopped
passing Chat UI's stored options into composer launches. A plugin task's
model and effort are explicit choices for one launch, so they now go to the
startup plan as session options that win over the agent's default arguments,
as orchestration worker preferences do. plugins.invokeTaskSource declares the
workspace permission that every runtime method now needs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
While merging main, the pre-commit formatter rewrapped a line in
src/relay/agent-exec-disposal.test.ts and dropped a blank line in
structured-agent-session-queued-mutations.ts. Neither belongs to this
change, so both go back to upstream's exact content. Committed without the
hook, which would reformat them again; only these two files are touched.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	src/renderer/src/components/task-page/SourceBar.tsx
#	src/renderer/src/i18n/locales/en.json
The main merge took upstream's quick-startup-plan.ts, which replaced the
input's `platform` field with `launchHost: ExecutionHostPlatformFact`, but
auto-merge kept this branch's test helper still passing `platform`. Update
the helper to build a `launchHost` so the renderer typechecks again.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Resolved conflicts:
- composer: unify QuickSubmitOptions in quick-creation-request (upstream's setupOnly plus agentDraft, sessionOptions, linkedPluginTask) and keep both the plugin agent-draft props and the setup-only picker
- task page effects: keep the escape-to-close hook with upstream's Jira summary model
- en.json: keep plugin task keys alongside the new Jira key; drop the unused key upstream removed

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

# Conflicts:
#	src/renderer/src/lib/pending-worktree-creation.ts
#	src/shared/worktree/meta-types.ts
#	src/shared/worktree/types.ts
Create workspace, when a task's Start opens it with an agent prompt, now has a
Run in field under the prompt: New workspace (as before) or one of the
project's existing workspaces on the same host. Picking one changes the button
to Start in workspace; pressing it opens an agent tab in that workspace with
the prompt typed in but not sent, and records the task link on it so its
sidebar card shows the task. Nothing else in the form applies on that path.

The field is disabled with the form's "pick an agent" text when no agent is
chosen, and hidden for folder workspace targets, which cannot hold a task
link. Switching project falls back to a new workspace. A workspace already
linked to another task takes the new link, as a workspace holds one.

The launch goes through launchAgentInNewTab, the same host-aware path the
fix-checks action uses for an existing workspace, so SSH and runtime-owned
workspaces work. launchAgentInNewTab gains an optional sessionOptions so the
task's model and effort apply here too, as they do for a new workspace. The
parent-worktree picker's candidate filter moves to
composer-worktree-candidates.ts so both lists agree on which workspaces count.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…sting workspace

When Run in picks an existing workspace, Create workspace no longer shows
the workspace name, the Perforce stream choice, Advanced or Create more:
they only shape a new workspace and did nothing on this path. A sparse
preset edit in progress is set aside while an existing workspace is
picked, so the start button stays. Switching back to New workspace brings
the fields back with their values.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

This branch has not been deployed

No deployments
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.

[Feature]: Start on a plugin task cannot continue in a workspace that already exists

3 participants