Skip to content

feat(workflows-as-code): turn workflows as code on for everyone - #10564

Draft
waleedlatif1 wants to merge 2 commits into
stagingfrom
feat/wac-remove-workflow-code-flag
Draft

waleedlatif1 wants to merge 2 commits into
stagingfrom
feat/wac-remove-workflow-code-flag

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Turns workflows as code (and workspace as code) on for everyone by removing the workflow-code feature flag and every gate behind it.

Merge only after AppConfig workflow-code: {enabled: true} has held globally on staging and then prod. This PR is the cleanup after that; it is not the rollout.

Removed

  • Server gate. The feature: WORKFLOW_CODE_FEATURE declarations on every workflow and workspace source operation, lib/workflows/code/feature-flag.ts, and lib/workflows/application/code-availability.ts.
  • The operation-feature mechanism, since workflow-code was its only user: lib/core/application/feature-availability.ts, the feature? field on workspace operations, the check in the shared use-case wrapper, the barrel export, and the FEATURE_NOT_ENABLED forbidden code (the generated OpenAPI enums drop it).
  • The flag itself. The workflow-code registry entry and the WORKFLOW_CODE env fallback.
  • UI gates. The workspace layout's flag read and the provider key, the Code tab, its content and the "Download as code" menu item in the panel (no longer conditional; the tab body mounts on first open, so a session that never opens it runs none of its draft subscriptions), the 'workflow-code': false literals in the org, account and extension providers, and the Code tab's Preview badge.
  • CLI inventory. print-command-inventory no longer emits entitlement on the workflows source and workspaces source commands. The worker reads that field as optional.
  • Tests. The three flag-gate suites (source-feature-gate.integration.ts, the v2 source feature-flag.test.ts, code/feature-flag.integration.ts), the flag-off cases, and the flag === 'workflow-code' mock in 24 integration files. The sandbox-session tests now use dashboards.
  • CI. WORKFLOW_CODE=true in http-e2e.sh, the flag-off app and start_extra_app. The Code tab UI e2e no longer has flag-off and flag-flip checks; the refresh-error check now refuses the read in the browser.
  • Copy. "Returns 403 while workflows as code is not enabled" in the OpenAPI descriptions and route TSDoc, "(preview)" in the CLI, the docs' preview callouts and enablement prerequisites, the troubleshooting bullets, the env-vars "Preview features" section (and its docs baseline heading), the sim-cli README note, the DESIGN.md Rollout section, and the rules' Feature flag section (with .cursor regenerated).

Also fixes three small API-doc issues on the blob operations: they document RESOURCE_ERRORS (they can't return 409 or 423), descriptions name Stage Workspace Source Blobs instead of the HTTP path, and the missing-blobs TSDoc no longer claims that asking renews blobs.

Kept, on purpose

  • The workflow-code Mothership entitlement, granted as constant true in both scopes. Today's worker hides the source commands and the workflow-source skill unless a turn holds it, so dropping it here would turn the feature off in chat. It goes away in Sim PR B, after the Mothership change below is on prod.
  • computeEntitlements uses Promise.allSettled, so a failing rollout check withholds only its own entitlement (logged) instead of failing the turn and losing workflow-code with it. This is a behavior change: an evaluator error used to fail the turn. The owner-shape check (workspace and organization both set) still throws.

Rollout and rollback

  1. AppConfig: set workflow-code to {enabled: true} on staging, soak, then prod. This is the zero-code rollback path: flip it back.
  2. This PR, once step 1 has held on prod. To roll back, revert it. The flag is still on in AppConfig, so users see no change.
  3. Mothership PR (below), after this reaches Sim staging.
  4. Sim PR B: contracts:sync and delete the constant evaluator, only after that worker is on prod.
  5. Delete the workflow-code AppConfig key on staging and prod.

Self-hosted upgrade note

On a self-hosted install with WORKFLOW_CODE unset, workflows as code is off today. After this upgrade it is on: the Code tab shows, and the source API, MCP operations and sim workflows source / sim workspaces source commands answer instead of returning 403. WORKFLOW_CODE no longer has any effect.

Companion Mothership change (needed before Sim PR B)

  • Regenerate the CLI inventory against Sim staging (bun run generate:cli-inventory), which drops the entitlement fields. Until then the worker's sim-sync check (check:cli-inventory) reports drift against Sim staging. Pin this PR in .github/sim-sync-companions/ to validate early.
  • worker/scripts/source-primer.ts: drop entitlement: workflow-code and update the generators.test.ts expectation.
  • build-workflow SKILL.md: make the entitled text the description and drop entitledDescriptions.
  • Remove ENTITLEMENTS.workflowCode in the same commit as those frontmatter edits. The skill loader's KnownEntitlement refine throws on an unknown key.
  • Update the cli-scope, skill-content and workbench-policy tests. Delete the generic entitlementGate / entitledDescriptions machinery only if nothing else uses it.
  • Deploy the worker to prod.

Test plan

  • bun run generate, lint, type-check, check:audits, check:api-validation:strict
  • apps/sim unit: lib/workflows, lib/workspace-source, lib/mothership, lib/copilot, lib/core, and the panel, composer, rollout, desktop, access-control and v2 workflow and workspace route suites
  • sim-cli suite; inventory prints no entitlement
  • docs content:verify-compatibility (no lost routes, anchors or fences)
  • CI integration and e2e suites (workflow source, workspace source, sandbox-session, workflow-code-ui)

@vercel

vercel Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
docs Ready Ready Preview Dec 1, 2026 10:34am UTC

Request Review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

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

@greptile-apps

greptile-apps Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge after the rollout prerequisite stated in its description is met.RetriggerView in GreptileConfidence Score: 5/5

[High impact] The PR appears safe to merge after the rollout prerequisite stated in its description is met.

Summary

Makes workflows and workspaces as code available without a feature flag.

  • Workflow and workspace source work without a rollout flag.
  • The workflow editor always shows its Code tab and download option.
  • Mothership keeps source commands available and isolates failed entitlement checks.

The earlier, unnumbered stale-code finding is fixed: the Code tab now invalidates an idle cached copy when its draft subscription starts.

waleedlatif1 explicitly identifies per-entitlement error isolation and the temporary constant entitlement as intentional behavior.

Reviews (2) · Last reviewed commit: "fix(workflows-as-code): revalidate a sou..." · Reviewed by 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 99 files

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

Turn on auto-fix | Re-trigger cubic

Remove the workflow-code feature flag and every gate behind it: the
source operations' feature declarations and the operation-feature
mechanism (its only user), FEATURE_NOT_ENABLED, the flag registry entry
and WORKFLOW_CODE fallback, the Code tab gates and Preview badge, the
CLI inventory entitlement fields, the flag-off tests and CI app, and the
preview and 403 copy across OpenAPI, CLI, docs and rules.

The Mothership workflow-code entitlement stays granted as constant true
until the worker stops gating on it. computeEntitlements now settles
each evaluator on its own, so one failing rollout check withholds only
its entitlement. The Code tab mounts on first open, so sessions that
never open it pay for none of its draft subscriptions.

Also documents RESOURCE_ERRORS on the blob operations, names Stage
Workspace Source Blobs instead of its path, and corrects the
missing-blobs TSDoc.
…b opens, and bootstrap a persisted Code tab

A Download as code read leaves a fresh-looking cache entry the lazily mounted Code tab
never saw edits against, so the tab's draft subscription revalidates any idle cached copy
when it starts. The blocking panel script no longer rewrites a persisted Code tab to the
toolbar, and the pre-hydration CSS covers the Code tab like the others.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review

@waleedlatif1 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 102 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

This branch was successfully deployed

1 active deployment
Preview — ad66ff67 Deployed Dec 1, 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