feat(db): add automations.reuse_workspace

Merged
KI
24d ago
+17302-0

Summary

  • Adds automations.reuse_workspace boolean NOT NULL DEFAULT false. When it is true, an automation with no pinned workspace keeps the workspace its first run creates, and later runs reuse it.
  • Schema only. The API, dispatch and editor changes that read this column come in #9347, which builds on this PR. They are split per .agents/skills/db-migrations ("No tRPC input or output change in the same PR").

Why / Context

The editor is getting a "Same workspace" option, and it needs to stay that way after the first run, in both "start fresh" and "continue" modes. Today the server can only infer reuse from continue_agent_session, and it can't tell a workspace someone picked by hand from one a run kept.

Migration safety

  • 0189_automation_reuse_workspace.sql: a single ADD COLUMN ... DEFAULT false NOT NULL. On Postgres 11+ a constant default needs no table rewrite, so the only lock is a brief one on automations.
  • automations is not one of the hot or large tables in the migration guide. I did not run the production size query (I have no production read access from here), and I did not rehearse under load because nothing is rewritten or scanned.
  • Generated with drizzle-kit generate; no hand edits. I did not apply it to a Neon dev branch; the preview deploy applies it.

Testing

  • bunx drizzle-kit generate produced only the expected statement.

Summary by cubic

Adds automations.reuse_workspace (boolean NOT NULL DEFAULT false) so an automation with no pinned workspace can keep the workspace its first run creates and reuse it for later runs. Schema only; the API, dispatch, and editor changes that read this column land in a follow-up PR (#9347).

Migration

  • Single ADD COLUMN with a constant default, so no table rewrite on Postgres 11+ and only a brief lock on automations.
  • No production size query was run, and automations is not among the hot or large tables in the migration guide.
  • Generated with drizzle-kit generate; no hand edits.

Summary by CodeRabbit

  • New Features
    • Automations now support a workspace reuse setting, which is off by default. When enabled, the workspace created during the first run can be retained for subsequent runs if no workspace was pinned initially.