Skip to content

fix(canvas): always run canvas generation as a cloud run#2952

Merged
raquelmsmith merged 3 commits into
mainfrom
posthog-code/canvas-generation-cloud-runs
Jun 26, 2026
Merged

fix(canvas): always run canvas generation as a cloud run#2952
raquelmsmith merged 3 commits into
mainfrom
posthog-code/canvas-generation-cloud-runs

Conversation

@raquelmsmith

Copy link
Copy Markdown
Member

Problem

Canvas generation tasks were running as local agent runs instead of cloud runs. They should always run in the cloud — local runs tie up (and depend on) the user's machine and stop if the app is closed.

Why it was happening: not the sticky "last-used workspace mode" as suspected. useGenerateFreeformCanvas hard-coded workspaceMode: "local", so canvas generation always ran locally regardless of any prior task. The fix makes it explicitly cloud.

Changes

  • packages/ui/src/features/canvas/hooks/useGenerateFreeformCanvas.ts: workspaceMode: "local""cloud", and updated the surrounding comments (scratch-dir reasoning no longer applies).

The repo-less cloud path is already supported by TaskCreationSaga — it provisions a cloud workspace and starts the run with no repo (allowNoRepo), and the agent still publishes results via the desktop-file-system-canvas-partial-update MCP tool. taskService.createTask runs the cloud usage preflight, so an over-limit case surfaces as the existing error toast.

Note: the sibling useGenerateContext.ts (channel CONTEXT.md generation) is hard-coded to "local" the same way — left unchanged since this request is scoped to canvas generation. Happy to flip it too if desired.

How did you test this?

No automated tests run — dependencies aren't installed in this environment. The change is a string-literal swap between two valid WorkspaceMode values already used throughout the saga and other call sites. Please pull down and verify a canvas generation now creates a cloud run.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code

@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 4e949cb.

@greptile-apps

greptile-apps Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(canvas): always run canvas generatio..." | Re-trigger Greptile

@raquelmsmith raquelmsmith requested a review from k11kirky June 26, 2026 16:53
@raquelmsmith raquelmsmith marked this pull request as ready for review June 26, 2026 16:53
@raquelmsmith raquelmsmith added the Stamphog This will request an autostamp by stamphog on small changes label Jun 26, 2026
github-actions[bot]
github-actions Bot previously approved these changes Jun 26, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trivial one-line behavioral fix switching canvas generation from local to cloud workspace mode, with corresponding comment updates. No showstoppers.

Freeform canvas generation hard-coded `workspaceMode: "local"`, so every
canvas/dashboard build kicked off a local agent run instead of a cloud
run. Switch it to `workspaceMode: "cloud"` so generation always runs
server-side, regardless of the user's last-used workspace mode or whether
the app is open. The repo-less cloud path is already supported by the task
creation saga (it provisions a cloud workspace and starts the run without a
repo), and the agent still publishes results via the
`desktop-file-system-canvas-partial-update` MCP tool.

Generated-By: PostHog Code
Task-Id: 36b53fe0-c4f6-473b-b514-21e50941cf52
CONTEXT.md generation hard-coded `workspaceMode: "local"`, same as canvas
generation, so it kicked off a local agent run instead of a cloud run.
Switch it to `workspaceMode: "cloud"` so generation always runs server-side,
regardless of the user's last-used workspace mode or whether the app is open.
The repo-less cloud path is already supported by the task creation saga.

Generated-By: PostHog Code
Task-Id: 36b53fe0-c4f6-473b-b514-21e50941cf52
@raquelmsmith raquelmsmith force-pushed the posthog-code/canvas-generation-cloud-runs branch from ca2c713 to fb272cb Compare June 26, 2026 18:13
@github-actions github-actions Bot dismissed their stale review June 26, 2026 18:13

New commits pushed (delta classified non_linear_history) — stamphog approval dismissed; re-review running automatically.

@raquelmsmith raquelmsmith enabled auto-merge (squash) June 26, 2026 18:14
github-actions[bot]
github-actions Bot previously approved these changes Jun 26, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple, well-justified mode switch from local to cloud for canvas generation tasks. No showstoppers: no data model changes, no security concerns, no unresolved review comments, and the change is consistent and intentional across both hooks.

@raquelmsmith raquelmsmith disabled auto-merge June 26, 2026 18:14
…eration

Canvas and CONTEXT.md generation always run as cloud runs, but cloud runs
only reflect merged code — so a local build of these features can't be
tested before merging. Add a dev-only (import.meta.env.DEV) workspace-mode
picker to both generation screens so the run can be pointed at a local
agent during development. Production is unchanged: the picker is hidden and
both hooks default to cloud.

The hooks now take an optional workspaceMode (default "cloud"); the UIs reuse
the existing WorkspaceModeSelect (restricted to local/cloud) and label it with
a tooltip noting it's dev-only.

Generated-By: PostHog Code
Task-Id: 36b53fe0-c4f6-473b-b514-21e50941cf52
@github-actions github-actions Bot dismissed their stale review June 26, 2026 18:29

New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean, intentional behavioral fix: canvas generation tasks now default to cloud instead of local workspace mode. The dev-only override picker is properly gated behind import.meta.env.DEV, production always uses cloud, and no API contracts, data models, or security boundaries are affected.

@raquelmsmith raquelmsmith enabled auto-merge (squash) June 26, 2026 18:32
@raquelmsmith raquelmsmith merged commit 5f5e43b into main Jun 26, 2026
23 checks passed
@raquelmsmith raquelmsmith deleted the posthog-code/canvas-generation-cloud-runs branch June 26, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Stamphog This will request an autostamp by stamphog on small changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant