feat(database,web): an agent can start in a workspace with no plan, on a repository and a task, and names the automation whose run started it

Merged
DA
4d ago
+319-35

Step 4 of the automations plan (docs/proposals/automations-scope.md). It is stacked on #2663 (agent reach by workspace).

What changes

  • The store starts an agent with no plan. createCodingAgent takes a CodingAgentPlace: either a plan (as before, handed the plan's text or a task) or a workspace with no plan, handed a task, since there's no plan to hand it.
    • The workspace path locks the workspace row where the account is a member, as the plan path locks the plan. Two Starts under one key therefore still make one agent, and a non-member starts nothing.
    • The row is written with plan_id null, the workspace's organization_id, and the repository.
  • The agent names the automation that started it. NewCodingAgent and StartAsk take an optional automationId, written to #2637's coding_agent.automation_id. CodingAgent reads it back. An automation's run passes its automation now, so its agents are linked from step 4 on, which the Inbox grouping in step 6 reads.
  • The web's startCodingAgent takes either place. A workspace Start names the workspace, the repository, and the task.
    • The account must be a member of the workspace. Otherwise the Start answers not found, as an unreached plan does.
    • The repository is read through the workspace's installation by the same workspaceRepository check a plan's repository goes through.
    • The session opens with the task (no plan section mentions, since there's no plan).
    • The plan path is unchanged.
  • Nothing calls the workspace path yet. Step 10 points automation runs at it, once steps 5โ€“7 have given planless agents their Inbox, grouping, and wire shape. No wire or route changes, so v0.12.0 and v0.13.0 see no difference.

Tests

  • coder-start.test.ts (new) runs through startCodingAgent:
    • A workspace Start opens one planless agent in the workspace, on the repository, handed the task, and a retry under its key opens nothing again.
    • A teammate starts one; an account outside the workspace is refused as not found and opens no session.
    • A repository the installation doesn't reach is refused before eve is asked.
  • automation-runs.test.ts: a run's agent names its automation.
  • The existing store, start, and route tests pass unchanged.

pnpm check:affected passes. This change is server-only; CI cannot verify the Mac UI, and ./scripts/verify.sh was not run (LUKE-159 stands in before the first release).

๐Ÿค– Generated with Claude Code


Open workspace in Conductor


Devin Review


Summary by cubic

Agents can now start in a workspace without a plan, on a repository and a task, and record which automation started them.

  • Workspace starts require membership and a repository reachable through the workspace's installation; retries under the same key create no duplicate agent.
  • NewCodingAgent and StartAsk take an optional automationId, written to coding_agent.automation_id; an automation's run passes it, so its agents are linked from step 4 on.
  • Plan starts are unchanged, and no wire or route behavior changes; the workspace path is not called yet.