Skip to content

improvement(workflow): scope the editor by props instead of the URL - #8996

Merged
TheodoreSpeaks merged 2 commits into
stagingfrom
improvement/workflow-editor-ids
Oct 13, 2026
Merged

TheodoreSpeaks merged 2 commits into
stagingfrom
improvement/workflow-editor-ids

Conversation

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator

Summary

  • The workflow editor no longer reads workspaceId/workflowId from the URL, so <Workflow> works wherever it's mounted (groundwork for rendering the full editor in the org home's resource pane).
  • New WorkflowScopeProvider + useWorkflowScope() (throws outside a provider) + useScopedWorkflowId() (throws in a preview). <Workflow> takes both ids as required props; the route page passes them from params.
  • Previews (Preview, PreviewWorkflow, PreviewEditor) scope sub-blocks to the workspace with no workflow; /workspace/[id]/w renders Panel under the same null-workflow scope.
  • Socket room is only what mounted editors request: Workflow always joins its workflow and releases it on unmount (leaveWorkflow(id)), with a request stack so unmounting one editor never drops another's room. The route-param fallback is removed from socket-provider.
  • Editor navigations (invalid-workflow redirect, open logs, duplicate, usage-limit request, command list, delete) go through useResourceRouter, so a containing pane can intercept them.
  • useWand, SkillModal, and the custom-tool generation hooks take workspaceId explicitly since they also render outside the editor.

Type of Change

  • Improvement / refactor

Testing

  • bun run lint, bun run check:audits, block registry check, artifact generators (no drift)
  • bun run test: all pass except 6 in lib/cleanup / lib/core that fail identically on staging HEAD
  • socket-join-target.test.ts covers the request stack and visibility gate (new cases verified to fail against the matching mutations); sub-block tests now render under WorkflowScopeProvider
  • Manual E2E on the routed editor: room join + edits persist, tool/file/KB/table pickers list items, deploy modal (General/API/MCP), wand and file upload send the scoped ids, bogus workflow id redirects, logs execution snapshot renders

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

🤖 Generated with Claude Code

https://claude.ai/code/session_01UMjSAnE9M7r86o5P19ash5

The workflow editor read workspaceId/workflowId from useParams() all over its
tree, so it only worked mounted at /workspace/[workspaceId]/w/[workflowId].

- WorkflowScopeProvider + useWorkflowScope/useScopedWorkflowId supply the ids;
  <Workflow> takes them as required props and the route page passes them in.
- Previews (Preview, PreviewWorkflow, PreviewEditor) scope SubBlocks to the
  workspace with no workflow; /w renders Panel under a null-workflow scope.
- The socket room is only what mounted editors request: Workflow always joins
  its workflowId and releases it on unmount; the route-param fallback is gone.
- Editor navigation goes through useResourceRouter so a containing pane can
  intercept it.
- useWand, SkillModal and the custom-tool generation hooks take workspaceId
  explicitly, since they also render outside the editor.

Claude-Session: https://claude.ai/code/session_01UMjSAnE9M7r86o5P19ash5
@vercel

vercel Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Oct 13, 2026 10:46pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

The PR gives the workflow editor explicit workspace and workflow ids instead of reading them from the URL.

  • Previews now inherit the editor's workspace before falling back to the workspace host.
  • Each editor gets its own socket request token and releases it on cleanup.
  • The scope hooks now document their return values and errors.
  • The previous preview-scope and documentation findings are fixed.
  • TheodoreSpeaks intentionally deferred exporting ResourceNavigationProvider: no pane consumes it yet, and an unused export would fail CI. The follow-up pane PR will add both the provider and its consumer.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Route[Route params] --> Editor[Workflow props]
  Editor --> Scope[WorkflowScopeProvider]
  Scope --> Controls[Editor controls]
  Scope --> Preview[PreviewScope]
  Preview --> PreviewScope[Workspace scope with no workflow]
  Editor --> Join[Request room with unique token]
  Join --> Stack[Most recent request selects room]
  Cleanup[Editor cleanup] --> Release[Remove that token]
  Release --> Stack
Loading

Reviews (2) · Last reviewed commit: "fix(workflow): release socket room reque..." · Reviewed by Greptile

Comment thread apps/sim/app/workspace/[workspaceId]/w/components/preview/preview-scope.tsx Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 62 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/app/workspace/providers/socket-join-target.ts Outdated
Comment thread apps/sim/app/workspace/[workspaceId]/w/components/preview/preview-scope.tsx Outdated
… to the enclosing editor

- joinWorkflow returns a release for its own mount token, so unmounting one of two
  editors on the same workflow can no longer drop the other's room; leaveWorkflow is gone
- PreviewScope inherits the enclosing editor's workspace before the workspace host
- TSDoc on useWorkflowScope

Claude-Session: https://claude.ai/code/session_01UMjSAnE9M7r86o5P19ash5
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@TheodoreSpeaks I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 62 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@TheodoreSpeaks
TheodoreSpeaks merged commit 9cc1f0f into staging Oct 13, 2026
52 checks passed
@waleedlatif1
waleedlatif1 deleted the improvement/workflow-editor-ids branch October 13, 2026 23:13

This branch was previously deployed

1 inactive deployment
Preview — 03e1d792 Deployed Oct 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant