feat(automations): allow project-less session automations

Merged
KI
3mo ago
+6938-98

Summary

Stacked on #6274 (sessions). Automations can now run without a project, completing the "no project = session" convention across every creation surface (desktop, CLI, MCP, SDK — and now scheduled runs).

Session automation = no project and no workspace pin. Each run creates a project-less session workspace on the target host via workspaces.createSession (managed folder under ~/.superset/sessions), then launches the agent exactly as before — agents.run was already project-agnostic. Pinning an existing session workspace also works now.

Changes

Cloud

  • automations.v2_project_id → nullable (migration 0064, single DROP NOT NULL; the FK was already dropped in 0062)
  • automation.create: the denormalized pin path requires only v2WorkspaceId + targetHostId — a null project means a session pin; the "v2ProjectId required" throw is gone (omit both = session mode)
  • automation.update: explicit v2ProjectId: null switches to session mode (and clears any pin); undefined keeps the project
  • dispatch.ts: null project relays workspaces.createSession (host dedupes the folder name per run) instead of workspaces.create; no branch computation. Stale-pin recovery falls back to the same path.

Desktop

  • Automation ProjectPicker: "No project (session)" option
  • WorkspacePicker: with no project selected it lists the host's session workspaces; "New workspace" copy becomes "New session"
  • Create dialog: tri-state selection (unchosen → auto-default first project; explicit "No project" respected); prompt file-search degrades gracefully (no project to search)
  • List rows + sort show "Session" instead of "—"

CLI / MCP / SDK

  • automations create: --project optional — omit both --project and --workspace for session mode; session workspaces accepted as --workspace targets (previous hard rejection removed)
  • automations update: new --session flag (clears project + pin)
  • MCP tool schemas + SDK types widened with session-mode docs

Notes

  • Old pre-denormalization clients pinning cloud workspaces still resolve via the legacy verifyWorkspaceInOrg branch, unchanged.
  • Deploy ordering: cloud/API must deploy before this desktop build goes out (standard).

Testing

  • Full repo typecheck + lint green
  • Host-side createSession behavior covered by #6274's integration tests
  • Follow-up: E2E dispatch verification (run-now on a session automation) once #6274 merges

Summary by cubic

Enable session automations: automations can now run with no project and no workspace pin. Each run creates a project-less session workspace on the target host.

  • New Features

    • Cloud/API: automations.v2_project_id is nullable (migration 0064); automation.create/update accept v2ProjectId: null; denormalized pins no longer require a project.
    • Dispatch: when v2ProjectId is null, runs call workspaces.createSession; session workspaces can be pinned.
    • Desktop: ProjectPicker adds “No project (session)”; WorkspacePicker lists session workspaces and shows “New session”; create dialog supports tri-state; automation lists show “Session”.
    • CLI: automations create makes --project optional (omit with no --workspace for session mode); automations update adds --session; session workspaces are valid --workspace targets.
    • MCP/SDK: schemas/types allow nullable v2ProjectId; docs clarify session pins require targetHostId and unpinning to session mode sends v2WorkspaceId: null.
  • Bug Fixes

    • Update flow skips legacy cloud-table resolution for retained pins to avoid “Workspace not found” on session-pinned automations.
    • CLI: validate --session conflicts before toggling enabled, preventing partial updates.
    • Desktop: WorkspacePicker shows neutral copy while no project is chosen (pre-default), not session mode.