Repository navigation
feat(plugins): start a task in an existing workspace - #30466
Draft
DimitriBrick wants to merge 28 commits into
Draft
DimitriBrick wants to merge 28 commits into
DimitriBrick wants to merge 28 commits into
Conversation
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]>
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]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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]>
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]>
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]>
…ommand 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]>
8 of 9 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 throughlaunchAgentInNewTabwithpromptDelivery: 'draft'and the launch platform fromresolveRepoWorktreeLaunchPlatform, the same host-aware route the checks Fix action uses for anexisting workspace, then writes the link with
persistCreatedWorkspacePluginTaskLink.launchAgentInNewTabgains an optionalsessionOptions, so a task's pinned model and effort apply here as they do for a newworkspace. The candidate list (the project's live workspaces on the
composer's host) is
composer-worktree-candidates.ts. No change tothe 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-taskssample plugin.Start in workspace opened an agent tab in
fix-upload-retrywith the prompt typed but not sent, and the workspace card shows the task link:Testing
pnpm tcpasses onplugin-task-sourcesate62f51ebc.pnpm test:nodeon 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(basee62f51ebc),check:max-lines-ratchet,verify:localization-catalogandverify:localization-extractionpass.Automated checks run on Windows. Manual check in the app (Windows, a
pnpm devinstance withthe 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
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
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)🤖 Generated with Claude Code