Skip to content

Delete the routines parent; scheduled work is native definitions (CL-4455) - #626

Merged
TheGreatAxios merged 9 commits into
mainfrom
cl-4455-wire-native-workflow-schedule-triggers-into-the-runtime-and
Sep 4, 2026
Merged

TheGreatAxios merged 9 commits into
mainfrom
cl-4455-wire-native-workflow-schedule-triggers-into-the-runtime-and

Conversation

@TheGreatAxios

@TheGreatAxios TheGreatAxios commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Scheduled work is native workflow definitions. The routines parent is gone.

A definition with a ScheduleTrigger is the schedule. The hub poller claims each UTC minute on workflow_definition.schedule_claimed_minute and launches deployed definitions through the sidecar. /routines lists those definitions (including stopped). Pause is the existing agent-definitions status PUT. Run-now is POST /api/tenants/:id/workflows/scheduled/:definitionId/run.

@corbits/routines and @corbits/routines-tools are deleted. Seed does not plant wrappers. Existing digest wrappers hand off to definition status (enabled → deployed, paused → stopped), then DROP SCHEMA routines.

vendor/intx/db migration 0089 adds schedule_claimed_minute. Ledgered in VENDORED.md (kill 2026-10-26) until upstream absorbs it.

https://linear.app/abklabs/issue/CL-4455

Fixes CL-4455

@linear-code

linear-code Bot commented Sep 4, 2026

Copy link
Copy Markdown

CL-4455

@TheGreatAxios

Copy link
Copy Markdown
Contributor Author

Self-review

Verdict: the CAS poller, the digest-handoff/DROP SCHEMA routines one-shot in scripts/db-setup.ts, the deleted-package cleanup, and the /routines UI/API surface all check out against the CL-4455 ruling (drop wrappers, no migrate, no retarget-create). No confirmed defects found; nothing fixed.

  • DISMISSED: worried the DROP SCHEMA routines mentioned in the PR body had no migration backing it — it's not a drizzle migration, it's a one-shot in dropRoutinesSchemaAfterDigestHandoff (scripts/db-setup.ts), gated on information_schema.schemata so it's a no-op once dropped. DIGEST_HANDOFF_SQL correctly joins on routines.routine.preset_key = 'workbench-digest' and wd.origin = 'authored', matching the deleted schema's own preset_key column.
  • DISMISSED: checked for reintroduced pause-polarity bug (prior CL-6756) in apps/web/src/routines-api.ts — pauseScheduledWorkflow/resume map straight to stopped/deployed via the existing setAgentDefinitionStatus, no inversion.
  • DISMISSED: grepped for leftover @corbits/routines, @corbits/routines-tools, and route-mount references — none found; VENDORED.md's vendor/intx/db row correctly documents migration 0089 and its 2026-10-26 kill date.
  • DISMISSED: /api/tenants/:id/workflows/scheduled and its /run route are tenant- and grant-scoped (workflow-definition:* read, workflow-run:* create) with no create/retarget endpoint, matching the ruling.

Targeted tests run (all pass):

  • apps/hub: bun test test/workflow-scheduler.test.ts (15 pass), bun test src/native-workflow-routine-launch.test.ts (4 pass)
  • repo root: bun test packages/seeding/ (66 pass), bun test packages/workflows/src/schedule/ (46 pass), bun test workflows/workbench-digest/ (part of above)
  • apps/web: bun test test/routine-detail-page.test.tsx test/routines-page.test.tsx test/routine-activity.test.ts test/routine-panel.test.tsx (29 + 24 pass, run from apps/web for the DOM env)
  • scripts/db-setup.test.ts DB-gated suite skipped locally (no DATABASE_URL; a stray port conflict with another local Postgres container blocked spinning one up, so left it to CI rather than risk another worktree's DB).

No commits pushed — no fixes were needed.

@TheGreatAxios
TheGreatAxios force-pushed the cl-4455-wire-native-workflow-schedule-triggers-into-the-runtime-and branch from 7be2744 to 29b4e41 Compare September 4, 2026 06:26
The hashed definition now carries Interchange ScheduleTrigger
{ type: "schedule", cron: "0 9 * * *" } instead of a mail trigger
whose `to` was not the fire address. Launch remains sidecar routeMail
to the live deployment; that is transport, not a start condition.
The hashed cron lives on the workflow definition. The hub claims each UTC minute on workflow_definition.schedule_claimed_minute and launches through the sidecar. After launch, a workbench-delivering workflow joins the tenant's first existing workbench; no workbench still launches. Digest is seeded stopped so a fresh tenant does not fire until a member restores it. Seed pages every definitions cursor to find that row.
Seed no longer POSTs /routines. Re-seed only deletes pristine leftover workbench-digest and last-30-days-research rows; a member-touched or pre-presetKey row is kept. Overlapping prune treats 404 as already retired. Digest ticks from ScheduleTrigger; last-30-days-research stays a deployed workflow.
…4455)

Drop @corbits/routines and @corbits/routines-tools. Hub ticks
ScheduleTrigger on deployed definitions; /routines lists those
definitions (including stopped). Pause is definition status;
run-now is POST /workflows/scheduled/:id/run. Enabled digest
wrappers hand off to deployed, paused to stopped, then DROP SCHEMA.
…t (CL-4455)

Seed lists definitions with a cursor query; onboarding fakes now match it
and PUT digest to stopped. Record 0089 in VENDORED-FROM and the kill-date
hash. Pause/run-now report through error-sink; cron validation probes
opt out. Shrink the report-error baseline for the deleted routines packages.

Made-with: Cursor
…(CL-4455)

Handoff copies routine enabled onto definition status and bumps
updated_at so the next seed does not re-stop a member-enabled digest.
POST /workflows/scheduled/:id/run joins the delivery workbench the same
way the poller does. Palette and context-menu run-now report through
error-sink.

Made-with: Cursor
…ire settle wiring (CL-4455)

Rebasing onto main pulled in CL-6778's runOutcomeStatus/withListingAbandoned
reading (Insights, Mission Control, shell activity) and CL-6756's pause-
polarity label fix, both added to files @corbits/routines never touched
directly. Ports the pure run-outcome/run-status-label helpers from the
deleted package's health.ts/run-language.ts into
packages/workflows/src/schedule/run-outcome.ts (re-exported from
@corbits/workflows/client) so every surface that reads a fire's displayed
status keeps working, and updates their imports.

apps/hub/src/index.ts's onTurnFinalized settle-terminal-status wiring
(CL-6778) depended on the deleted routine_run table and
settleRoutineFireFromTurn; native ScheduleTrigger definitions have no
equivalent per-fire join today, so that settle path is dropped rather than
reimplemented against a still-open native-run-tracking question.

Also: apply CL-6756's On/Off switch label to the new routines-page.tsx,
drop a dead-lettering test with no native-model equivalent, and update
shell-chrome-wiring's CL-6819 dismiss tests to exercise the profile pane
instead of the now-permanently-stubbed routine canvas pane.
@TheGreatAxios
TheGreatAxios force-pushed the cl-4455-wire-native-workflow-schedule-triggers-into-the-runtime-and branch from 29b4e41 to a3a0a49 Compare September 4, 2026 06:28
Prettier flagged VENDORED.md formatting, and eslint failed to parse two
orphaned files (packages/routines/src/settle-fire.ts and its test) left
behind after the routines package deletion - nothing referenced them and
the package had no package.json/tsconfig, so they were dead weight from
the rebase.
The crypto-provider-cache-wiring pin still asserted a call site for createHubRoutineLauncher, which the native-scheduler rebase removed. Scheduled workflow triggers now fire through triggerNativeWorkflowRoutineRun, which signs its trigger mail with a fresh per-call keypair instead of the shared CryptoProviderCache, so that call site no longer exists to pin.
@TheGreatAxios
TheGreatAxios merged commit b773739 into main Sep 4, 2026
7 checks passed
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