feat(desktop,api): auto-populate branch from Linear issues and move linked tasks to In Progress
Fixes SUPER-1794
What
Linear-integration improvements: workspaces created from Linear issues use Linear's exact branch format, and linked tasks move to In Progress (and get assigned) when work starts.
1. Auto-populate workspace/branch name from Linear issues
Linear's branchName (the exact format Linear autolinks back to the issue, including the user's branch-format template) is synced into the existing tasks.branch column — no migration needed:
- Initial sync fetches
branchNameinISSUES_QUERYand maps it into the upsert (+ conflict-update allowlist). - Webhooks: Linear omits
branchNamefrom webhook payloads, so issue create/update events do a targetedissue(id) { branchName }fetch; on failure the stored value is left untouched. This also progressively backfills existing tasks as issues get touched. sync-taskwritesbranchNameback when Superset creates/updates the Linear issue (title edits change it).
Consumption:
- Desktop:
deriveBranchNamepreferstask.branchover the localslug-titlereconstruction (kept as fallback) on all task→workspace surfaces. Linking a Linear issue in the new-workspace flow seeds the workspace name (issue title) and branch name; user-typed values are never overwritten, and unlinking clears the seeded values only if untouched. - Host:
workspaces.createwith ataskIdand nobranchderives the branch from the linked task via a bounded (2s) cloud lookup — covers CLI/MCP/automation creates; offline hosts fall back silently. - CLI: new
--task(links the task; branch derives from it when--branchis omitted) and--skip-branch-prefixflags; both rejected for project-less sessions. Theuse-with-lineardocs script now passes--skip-branch-prefix.
Provider branches are exact: the new skipBranchPrefix create input makes the host use provider-supplied branches verbatim (still deduplicated) instead of namespacing them under the project branch prefix. Manually editing a seeded branch clears the flag and restores normal prefixing; the slug-title fallback also keeps normal prefixing.
2. Auto-transition linked task to In Progress + assign
New task.start cloud procedure:
- Moves a task to the org's first
started-type status, only frombacklog/unstarted— never regresses in-progress/done tasks. - Assigns the acting user when the task is unassigned; an existing assignee (internal or external Linear snapshot) is never overwritten.
- Pushes both changes to Linear via the existing
syncTaskpath.
Host-service fires it best-effort on every "work is starting" signal:
workspaces.createwith ataskId(desktop v2, CLI, MCP, automations)workspace.updatelinking a task to an existing workspace (command palette "Link task")- agent
Startlifecycle events in a linked workspace (deduped once per task per process; the procedure is idempotent)
v1 surfaces are intentionally untouched (sunset). Merged with main's sessions feature: project-less sessions have no branch semantics and skip all of the above.
Verification
- Unit:
deriveBranchName(5 tests), notifications hook task-start nudge (3 new, 11 total). Lint + full monorepo typecheck clean, re-validated after merging main. - CDP end-to-end on the dev desktop (isolated Neon branch), 16-case edge matrix in the comments below. Highlights: with a project prefix configured, a fallback branch got
kiet/...while a Linear branch was created verbatim in the same project; taskId-only creates derive the Linear branch host-side; Backlog → In Progress verified through create, palette-link, and the agent-Start hook (real HTTP POST); never-regress and never-steal-assignee both held; seeding/clearing rules verified in the real control-arm modal. - Not exercised live: the Linear API fetch itself (deliberately — dev uses a copied OAuth connection whose token rotation must not be triggered) and the CLI flags (passthrough; the CLI targets the real host config).
Notes
- Existing synced tasks have
branch = nulluntil their issue is next touched by a webhook (or a fresh initial sync); the UI falls back to theslug-titlederivation, which still autolinks since it contains the identifier. - Because branches now match Linear's format, Linear's own GitHub integration handles the rest of the lifecycle (In Review / Done on PR open/merge) — no need for Superset-side PR status sync.
- Follow-ups (ticket material): branch backfill job, chat-agent
Startemission check, gating the webhook branchName fetch on title changes, surfacing the branch on the task detail page,useLinkedContextunit tests, and the pre-existing AI-rename-drops-prefix bug.