Skip to content

fix(workflows): sync sidebar after external mutations - #7354

Closed
BillLeoutsakosvl346 wants to merge 2 commits into
stagingfrom
investigate/workflow-sidebar-live-state
Closed

fix(workflows): sync sidebar after external mutations#7354
BillLeoutsakosvl346 wants to merge 2 commits into
stagingfrom
investigate/workflow-sidebar-live-state

Conversation

@BillLeoutsakosvl346

@BillLeoutsakosvl346 BillLeoutsakosvl346 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds workspace-scoped realtime invalidation for workflow and workflow-folder lists so sidebar state updates after CLI/API mutations without a reload.

  • Adds the presence-free workspace-workflows:{workspaceId} room, read-permission authorization, and internal relay endpoint.
  • Invalidates active/archived/all workflow lists, workflow selectors, and active/archived workflow-folder lists on workspace-workflows-changed.
  • Runs the same invalidation after every successful join/rejoin to recover changes missed during a disconnect. The shared behavior also gives Files and Tables the same catch-up semantics.
  • Emits one best-effort signal after durable workflow-tree mutations, including canonical API paths and direct legacy/admin/Copilot/fork/VFS/deployment paths.

Report: Slack

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

  • Focused Vitest coverage for the shared room lifecycle, exact HTTP relay event/room, client cache binding, join/rejoin catch-up, notifier routing, and representative durable mutation boundaries.
  • bun run type-check — 26/26 tasks passed.
  • bun run lint:check — 26/26 tasks passed.
  • bun run test — 19/19 Turbo tasks passed; app 38,682 tests passed (67 skipped), realtime 288 passed, CLI 784 passed (1 skipped).

Browser acceptance on http://localhost:3001/workspace/1499db5d-b148-4f74-93bf-3d0a7975dae5/w/6e3d9d1d-d9b5-42a3-9715-2c8ee7a5249c:

  • CLI workflow create and workflow-folder create both appeared in the open sidebar without reload.
  • Each signal produced one active workflow-list GET and one active workflow-folder GET.
  • Moving the workflow into the folder updated live with one refetch pair and no storm.
  • During an abrupt realtime outage, a new workflow/folder remained absent as expected; after service restart, automatic socket rejoin triggered one catch-up refetch pair and both appeared without navigation or reload.
  • No new browser console errors or connected-state app/realtime errors. The outage window logged the expected best-effort notifier connection warnings.
  • Acceptance fixtures were cleaned up afterward.

Reviewer focus: notification placement is intentionally at top-level post-commit boundaries so batch/cascade operations signal once and failures/no-ops do not signal.

Checklist

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

Screenshots/Videos

N/A — socket-driven sidebar behavior was verified in the browser acceptance steps above.

@vercel

vercel Bot commented Sep 1, 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 Sep 1, 2026 5:40pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds workspace-scoped realtime invalidation so workflow and workflow-folder lists refresh after external mutations and reconnects.

  • Introduces the presence-free workspace-workflows room with shared protocol naming, read authorization, lifecycle handling, and an internal relay endpoint.
  • Invalidates workflow, selector, and workflow-folder query caches in the persistent sidebar.
  • Emits best-effort workspace notifications after workflow-tree mutations across API, application, VFS, deployment, Copilot, import, and workspace-forking paths.
  • Extends shared invalidation-room join behavior to perform catch-up refetches after successful initial joins and reconnects.

Confidence Score: 5/5

The PR appears safe to merge; the new workflow-list invalidation path is consistently scoped, authorized, and connected across mutation, relay, room, and client-cache boundaries.

No concrete changed-code-triggered failure remains after checking notification timing, room contract alignment, authorization and revocation behavior, reconnect recovery, and the separation between per-workflow editor events and workspace-list invalidation.

Important Files Changed

Filename Overview
packages/realtime-protocol/src/rooms.ts Adds the shared workspace-workflows room token while preserving typed room naming and parsing.
packages/platform-authz/src/rooms.ts Resolves the new room directly to its workspace so existing room authorization and revalidation apply.
apps/realtime/src/routes/http.ts Adds the authenticated internal workflow-tree invalidation relay and emits the expected workspace-scoped event.
apps/sim/app/workspace/[workspaceId]/hooks/use-workspace-invalidation-room.ts Adds catch-up invalidation after each successful room join or rejoin across shared invalidation rooms.
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/hooks/use-workspace-workflows-room.ts Binds workflow-room events to active, archived, and all workflow lists plus workflow-folder caches.
apps/sim/lib/realtime/notify.ts Adds best-effort workspace workflow notification routing and integrates workflow folders with it.
apps/sim/lib/workflows/application/workflow-vfs.ts Consolidates workspace-list notification at successful VFS mutation boundaries while retaining per-workflow editor notifications where needed.
apps/sim/lib/workflows/deployment-outbox.ts Adds checkpointed workspace-list notification to deployment post-activation side effects.

Sequence Diagram

sequenceDiagram
  participant M as Workflow mutation path
  participant A as Sim application
  participant R as Realtime service
  participant C as Workspace sidebar
  participant Q as Durable query API
  M->>A: Commit workflow-tree mutation
  A->>R: POST workspace-workflows-changed
  R-->>C: Broadcast workspace-workflows-changed
  C->>C: Invalidate workflow, selector, and folder caches
  C->>Q: Refetch workspace lists
  Q-->>C: Return current durable state
  Note over C,R: Successful join or rejoin triggers the same catch-up invalidation
Loading

Reviews (1): Last reviewed commit: "fix(workflows): sync sidebar after exter..." | Re-trigger Greptile

@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 53 files

Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/ee/workspace-forking/lib/promote/rollback.ts Outdated
Comment thread apps/sim/lib/workflows/deployment-outbox.ts Outdated
Comment thread apps/sim/lib/workflows/application/move-workflows-bulk.ts 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.

No issues found across 54 files

Confidence score: 5/5

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

Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.

Re-trigger cubic

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

Browser acceptance proof

Follow-up commit 4624fc3f0c addresses all three Cubic findings:

  • Rollback now invalidates workspace lists for actually unarchived workflows even when there is no prior deployment to reactivate.
  • Deployment outbox checkpoints workspace-list invalidation before the fail-fast per-workflow socket notification.
  • Same-folder bulk moves no longer emit a workspace-list invalidation.

Acceptance was run on the same open canvas URL without reload:
http://localhost:3001/workspace/1499db5d-b148-4f74-93bf-3d0a7975dae5/w/6e3d9d1d-d9b5-42a3-9715-2c8ee7a5249c

  1. Live CLI create: the new workflow and folder appeared automatically in the open sidebar.
  2. Live structural update: moving the workflow into the folder updated the tree automatically.
  3. Reconnect catch-up: items created while realtime was abruptly unavailable stayed absent during the outage, then appeared after the socket rejoined—without navigation or reload.

Each connected signal/rejoin produced one active workflow-list GET and one active workflow-folder GET. Browser console showed no new errors. Temporary acceptance fixtures were cleaned up.

Automated validation:

  • Focused Vitest: 30/30 passed
  • bun run type-check: 26/26 tasks passed
  • bun run lint:check: 26/26 tasks passed
  • bun run test: 19/19 tasks passed; app 38,685 tests passed (67 skipped), realtime 288 passed, CLI 784 passed (1 skipped)

1. Live CLI workflow + folder creation

Live CLI workflow and folder creation in the open sidebar

2. Live workflow move into the folder

Workflow moved live into the expanded folder

3. Reconnect catch-up after missed events

Workflow and folder recovered after realtime reconnect

@BillLeoutsakosvl346
BillLeoutsakosvl346 force-pushed the investigate/workflow-sidebar-live-state branch from 4624fc3 to 00be125 Compare September 1, 2026 17:40
@waleedlatif1

Copy link
Copy Markdown
Collaborator

superseded by #7356

@waleedlatif1
waleedlatif1 deleted the investigate/workflow-sidebar-live-state branch September 1, 2026 19:23
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.

2 participants