Skip to content

🤖 feat: centralize workflow automations#3560

Open
ThomasK33 wants to merge 1 commit into
mainfrom
workflow-scheduler-97kn-1
Open

🤖 feat: centralize workflow automations#3560
ThomasK33 wants to merge 1 commit into
mainfrom
workflow-scheduler-97kn-1

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Jun 15, 2026

Copy link
Copy Markdown
Member

Summary

Centralizes scheduled workflow automations at the project level so automations survive workspace archive/delete lifecycles, while still supporting existing-workspace targets and fresh-workspace-per-run targets.

Background

Workspace-local scheduled workflows were tied to a specific workspace record. This made recurring automations fragile: removing the workspace could remove the automation too. Project-level schedules make recurring workflows a first-class project setting.

Implementation

  • Adds project workflow schedule schemas and oRPC endpoints for set/run/remove flows.
  • Extends the scheduler to dispatch project-owned automations, including dynamic workspace creation and terminal cleanup for fresh-workspace targets.
  • Adds UI for per-workspace automation setup and project-wide automation management.
  • Validates executable workflow availability, target conflicts, and unsupported fresh-workspace templates before enabling/running schedules.
  • Skips archived existing-workspace project targets before stamping lastRunStartedAt, so unarchiving keeps overdue automations due immediately.
  • Releases manual Run now locks when backgrounded project automation runs are interrupted, without sending a workflow-result continuation for the interruption.
  • Removes unshipped legacy workspace-to-project automation migration plumbing.
  • Simplifies shared schedule helpers for interval validation, args parsing, due checks, and fresh-workspace template detection.
  • Ensures project automation workflow discovery scans the requested host project root, and refreshes untouched fresh-workspace base-branch drafts after async branch discovery.

Validation

  • make typecheck
  • bun test src/browser/components/AutomationModal/AutomationModal.test.tsx src/browser/components/ProjectAutomationsModal/ProjectAutomationsModal.test.tsx src/common/utils/workflowScheduleTarget.test.ts
  • bun test src/node/services/workflows/WorkflowSchedulerService.test.ts src/node/orpc/router.test.ts src/node/services/serviceContainer.test.ts
  • bun test src/browser/components/WorkspaceMenuBar/WorkspaceMenuBar.test.tsx src/browser/components/AutomationModal/AutomationModal.test.tsx src/browser/components/ProjectAutomationsModal/ProjectAutomationsModal.test.tsx
  • bun test src/node/orpc/router.test.ts src/node/services/workflows/WorkflowSchedulerService.test.ts
  • bun test src/node/services/workflows/WorkflowSchedulerService.test.ts src/node/services/workflows/WorkflowService.test.ts
  • bun test src/node/services/serviceContainer.test.ts
  • make storybook-run CMD="make test-storybook"
  • make test
  • make static-check
  • MUX_ESLINT_CONCURRENCY=1 make static-check
  • Storybook dogfood covered desktop and narrow/mobile automation modal layouts during implementation.

Risks

Moderate regression risk in workflow scheduling and workspace creation paths. The change touches scheduler dispatch semantics, workflow run status propagation, and project config persistence. Risk is mitigated by targeted scheduler/router/service tests, full unit tests, Storybook interaction tests, and static checks.


Generated with mux • Model: openai:gpt-5.5 • Thinking: xhigh • Cost: $649.23

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0f7019ae60

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/components/AgentListItem/AgentListItem.tsx

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0f7019ae60

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/node/orpc/router.ts Outdated
@ThomasK33 ThomasK33 force-pushed the workflow-scheduler-97kn-1 branch from 0f7019a to 12c884b Compare June 15, 2026 15:27
@ThomasK33

Copy link
Copy Markdown
Member Author

Addressed the current Codex findings:

  • src/node/orpc/router.ts: project-level workflows.listDefinitions({ projectPath }) now builds a definition store rooted at the requested project path instead of returning the first active workspace checkout's workflow definitions. Added a regression test that a workspace-only workflow is not returned for project discovery.
  • src/browser/components/ProjectAutomationsModal/ProjectAutomationsModal.tsx: new automation drafts now update the untouched base branch when async branch discovery returns a non-main recommendation, without reinitializing the rest of the user's draft. Added coverage for this case.

Also fixed CI-local repro failures by only expecting the automation modal test double when it is mounted, and wrapping AgentListItem stories in ProjectProvider.

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 12c884b9b3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/node/orpc/router.ts Outdated
Comment thread src/node/services/workflows/WorkflowSchedulerService.ts
@ThomasK33 ThomasK33 force-pushed the workflow-scheduler-97kn-1 branch from 12c884b to c1157ac Compare June 15, 2026 15:52
@ThomasK33

Copy link
Copy Markdown
Member Author

Addressed the latest Codex findings:

  • workflows.listDefinitions({ projectPath }) now uses host project-path discovery for project-level automation workflow lists instead of attempting to scan host paths through SSH/Docker runtimes.
  • Project automations targeting archived existing workspaces now skip before stamping lastRunStartedAt, so unarchiving does not delay the next due run. Added scheduler coverage for the archived-target case.

Also changed WorkspaceMenuBar tests to mock the automation modal module before importing the menu bar so the full unit suite does not cache the real Radix dialog implementation before AutomationModal tests run.

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c1157ac7f8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/node/services/workflows/WorkflowSchedulerService.ts
@ThomasK33 ThomasK33 force-pushed the workflow-scheduler-97kn-1 branch from c1157ac to fef4720 Compare June 15, 2026 16:12
@ThomasK33

Copy link
Copy Markdown
Member Author

Addressed the latest Codex finding:

  • Manual project automation background locks now release when the workflow run is interrupted. The scheduled startWorkflow path opts into interrupted background terminal notifications only when the scheduler supplied an onTerminal callback, and interrupted events release the scheduler lock without sending a workflow-result continuation message.
  • Added scheduler coverage that a backgrounded Run now call rejects duplicates until an interrupted terminal event, then allows the automation to run again.

Validation for this round:

  • bun test src/node/services/workflows/WorkflowSchedulerService.test.ts src/node/services/workflows/WorkflowService.test.ts
  • bun test src/node/services/serviceContainer.test.ts
  • MUX_ESLINT_CONCURRENCY=1 make static-check

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: fef4720893

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ThomasK33 ThomasK33 force-pushed the workflow-scheduler-97kn-1 branch from fef4720 to b625368 Compare June 15, 2026 16:40
@ThomasK33

Copy link
Copy Markdown
Member Author

Pushed a unit-test isolation fix after the latest CI failure: WorkspaceMenuBar.test.tsx now dynamically imports the component after installing its AutomationModal test double, so the full unit suite cannot cache the real Radix dialog implementation before AutomationModal.test.tsx installs its dialog mock.

Validation:

  • bun test src/browser/components/AgentListItem/AgentListItem.test.tsx src/browser/components/WorkspaceMenuBar/WorkspaceMenuBar.test.tsx src/browser/components/AutomationModal/AutomationModal.test.tsx
  • make test
  • MUX_ESLINT_CONCURRENCY=1 make static-check

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b62536819c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/node/services/workflows/WorkflowSchedulerService.ts
Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx
@ThomasK33 ThomasK33 force-pushed the workflow-scheduler-97kn-1 branch from b625368 to 46fb7f6 Compare June 15, 2026 17:07
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please take another look. Addressed the missing/deleted project target stamping case and added a project automation keyboard shortcut path.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 46fb7f6145

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/components/AutomationModal/AutomationModal.tsx
@ThomasK33 ThomasK33 force-pushed the workflow-scheduler-97kn-1 branch from 46fb7f6 to b06d98a Compare June 15, 2026 17:22
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please re-check after the Storybook play-test selector fix.

@ThomasK33 ThomasK33 force-pushed the workflow-scheduler-97kn-1 branch from b06d98a to ae6ec2b Compare June 15, 2026 17:28
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please take another look. Preserved existing project automation titles when saving from the workspace automation modal and covered it in the modal test.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ae6ec2b015

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/node/services/serviceContainer.ts Outdated
@ThomasK33 ThomasK33 force-pushed the workflow-scheduler-97kn-1 branch from ae6ec2b to 4d8b0a0 Compare June 15, 2026 17:43
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please take another look. Project automation fresh workspaces now use template workspaces only for runtime settings and do not inherit a template sub-project scope; added serviceContainer coverage for that case.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4d8b0a089c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx Outdated
@ThomasK33 ThomasK33 force-pushed the workflow-scheduler-97kn-1 branch from 4d8b0a0 to d0b1d03 Compare June 15, 2026 18:09
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please take another look. The project automation shortcut now resolves the selected workspace's effective sub-project scope, matching the new-workspace shortcut behavior, with ProjectSidebar coverage.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d0b1d036d4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/node/services/serviceContainer.ts
Comment thread src/node/services/serviceContainer.ts
@ThomasK33 ThomasK33 force-pushed the workflow-scheduler-97kn-1 branch from d0b1d03 to 365f1a9 Compare June 15, 2026 18:27
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please take another look. Sub-project project automations now resolve parent workspace templates for runtime compatibility and pass the source project scope through workflow resolution so scheduled runs load workflows from the intended sub-project checkout path.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 365f1a9715

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/node/orpc/router.ts
Comment thread src/node/orpc/router.ts
@ThomasK33 ThomasK33 force-pushed the workflow-scheduler-97kn-1 branch from 365f1a9 to dd5652d Compare June 15, 2026 18:40
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please take another look. Saving new-workspace schedules for sub-projects now validates against the owner project's workspace templates, and project trust now resolves through the registered parent project so sub-project workflow runs can load project-local definitions under a trusted parent.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dd5652debe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/components/WorkspaceMenuBar/WorkspaceMenuBar.tsx Outdated
Comment thread src/node/services/workflows/WorkflowSchedulerService.ts Outdated
@ThomasK33 ThomasK33 force-pushed the workflow-scheduler-97kn-1 branch from dd5652d to 2324f84 Compare June 15, 2026 18:55
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please take another look. WorkspaceMenuBar now opens/saves workspace automation schedules under the effective sub-project path, and project schedule dispatch resolves existing-workspace targets through the owner project so sub-project-owned schedules can run against parent-owned workspaces.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2324f84749

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/components/AutomationModal/AutomationModal.tsx Outdated
Comment thread src/browser/components/ProjectAutomationsModal/ProjectAutomationsModal.tsx Outdated
Comment thread src/node/orpc/router.ts
Promote scheduled workflow automations from workspace-local state into project-level schedules that survive workspace archival and deletion.

- add project workflow schedule schemas, oRPC endpoints, and scheduler dispatch support
- support existing-workspace and new-workspace automation targets with conflict validation
- add modal UI, menu entries, stories, and tests for configuring and running automations
- harden workflow scheduling around terminal status, stale config stamps, and unsupported targets
- remove unshipped legacy workspace automation migration plumbing

---

_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `$632.46`_

<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=632.46 -->
@ThomasK33 ThomasK33 force-pushed the workflow-scheduler-97kn-1 branch from 2324f84 to 8733cb3 Compare June 15, 2026 19:11
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please take another look. AutomationModal now loads workflow definitions from the effective sub-project path, ProjectAutomationsModal uses owner-project workspaces for sub-project target options, and existing-workspace conflicts are checked across the owner project plus registered sub-project schedules.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8733cb3f7c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/node/orpc/router.ts
if (candidateOwnerPath !== ownerProjectPath) {
return [];
}
return (candidateProject.workflowSchedules ?? []).map((schedule) => ({

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include workspace schedules in target conflict checks

When saving an existing-workspace project automation, this scan only considers candidateProject.workflowSchedules; existing per-workspace workspace.workflowSchedule entries are still loaded and dispatched by WorkflowSchedulerService.tick(). After upgrading a config that already has a workspace schedule, creating a project automation for the same workspace succeeds here and both schedules can run against the same target, causing duplicate automated workflow runs instead of enforcing the “one automation per workspace” rule.

Useful? React with 👍 / 👎.

</Popover>
{dynamicWorkflowsEnabled && automationModalOpen && (
<AutomationModal
projectPath={projectPath}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use the row's sub-project when opening automation settings

For workspaces rendered inside a sub-project section, ProjectSidebar still passes the owner projectPath into AgentListItem while the sub-project is only available as sectionId. Opening automation settings from that row therefore reads/saves the owner project's schedules here, unlike WorkspaceMenuBar which switches to the workspace subProjectPath; a user configuring a sub-project workspace from the sidebar will edit or create the wrong project automation.

Useful? React with 👍 / 👎.

Comment on lines +260 to +264
getExistingWorkspaceAutomationConflict({
projectConfig: props.projectConfig,
workspaceId: workspace.id,
editingScheduleId,
}) == null

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Check sibling schedules before offering targets

activeWorkspaces now comes from the owner project, but the conflict test still receives only props.projectConfig, so a sub-project modal only filters schedules stored on that sub-project. If the owner project or a sibling sub-project already targets workspace.id, this option remains selectable and the form appears valid until the backend rejects the save; the picker should use the same owner-wide schedule set as the API conflict check.

Useful? React with 👍 / 👎.

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