Skip to content

feat(automation): honor flow status for enable/disable + expose runtime enable/bound state#2597

Merged
os-zhuang merged 1 commit into
mainfrom
feat/flow-enable-disable-status
Jul 4, 2026
Merged

feat(automation): honor flow status for enable/disable + expose runtime enable/bound state#2597
os-zhuang merged 1 commit into
mainfrom
feat/flow-enable-disable-status

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Why (UX eval #6 — automation enable/disable entry + status)

The engine bound and ran every registered flow, ignoring the persisted status. So an author had no way to turn an automation off (short of deleting it), or to see whether one was live. The Studio header even says "Off by default · review before enabling" — nothing enforced or reflected it. This is the engine half of "a clear on/off switch + visible enabled/bound status"; the objectui half (badges + switch) follows.

What

  • registerFlow honors status: obsolete/invaliddisabled (trigger not bound, execute() refuses); draft/active — and legacy flows with no explicit status — stay enabled, so existing flows are unaffected (zero regression; confirmed showcase flows mix status:'active' with default-draft, both keep firing). This persists the Studio switch via the existing status field (applied on the next publish rebind); a flip back out of a disabled status re-enables on re-register; a runtime toggleFlow() override on a still-enabled flow is preserved.
  • New getFlowRuntimeStates() + GET /api/v1/automation/_status[{ name, enabled, bound }] for every registered flow — the truth behind the Studio's badges (persisted status is metadata; actually enabled + bound is engine state). Underscore-prefixed so no flow name shadows it; degrades to [] on an older service.

Verification

Unit (@objectstack/service-automation 239, @objectstack/runtime 147): draft/active bind + enable (unchanged); obsolete neither binds nor enables and execute() refuses it; obsolete→active re-enables + re-binds on re-register; _status route shape + not shadowed by /:name.

Runtime — clean showcase: GET /automation/_status returned all 20 flows enabled:true, bound 14/6 — the 6 unbound are screen/manually-launched flows with no trigger (correctly bound:false). Endpoint reflects real engine state.

🤖 Generated with Claude Code

…me enable/bound state

The engine bound and ran every registered flow, ignoring the persisted `status`
— an author couldn't turn an automation off or tell whether one was live.

- registerFlow honors `status`: `obsolete`/`invalid` → disabled (trigger not
  bound, execute() refuses). `draft`/`active`/legacy-no-status → enabled, so
  existing flows are unaffected (zero regression). This persists the Studio's
  on/off switch via the existing `status` field (applied on publish rebind); a
  flip back out of a disabled status re-enables on re-register; a runtime
  toggleFlow() override on a still-enabled flow is preserved.
- New getFlowRuntimeStates() + GET /api/v1/automation/_status → [{name, enabled,
  bound}] for every flow — the truth behind the Studio's status badges.

Tests: draft/active bind+enable, obsolete neither binds nor enables + execute
refuses, obsolete→active re-enables+re-binds, _status route shape. Endpoint
runtime-verified on the showcase (20 flows; screen/manual flows correctly
bound:false, all enabled).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 4, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jul 4, 2026 5:26pm

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation tests tooling size/m labels Jul 4, 2026
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/runtime, packages/services.

20 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/ai/chatbot-integration.mdx (via @objectstack/runtime)
  • content/docs/api/index.mdx (via @objectstack/runtime)
  • content/docs/automation/hook-bodies.mdx (via @objectstack/runtime)
  • content/docs/concepts/north-star.mdx (via packages/runtime)
  • content/docs/data-modeling/drivers.mdx (via @objectstack/runtime)
  • content/docs/deployment/cloud-artifact-api.mdx (via packages/runtime)
  • content/docs/deployment/index.mdx (via @objectstack/runtime)
  • content/docs/deployment/production-readiness.mdx (via @objectstack/runtime)
  • content/docs/deployment/single-project-mode.mdx (via @objectstack/runtime)
  • content/docs/deployment/vercel.mdx (via @objectstack/runtime)
  • content/docs/kernel/runtime-services/audit-service.mdx (via packages/services)
  • content/docs/kernel/runtime-services/index.mdx (via packages/services)
  • content/docs/kernel/runtime-services/settings-service.mdx (via packages/services)
  • content/docs/permissions/authentication.mdx (via @objectstack/runtime)
  • content/docs/plugins/packages.mdx (via @objectstack/runtime, packages/services)
  • content/docs/protocol/objectos/http-protocol.mdx (via @objectstack/runtime)
  • content/docs/protocol/objectos/i18n-standard.mdx (via packages/services)
  • content/docs/protocol/objectos/index.mdx (via @objectstack/runtime)
  • content/docs/protocol/objectos/lifecycle.mdx (via @objectstack/runtime)
  • content/docs/releases/implementation-status.mdx (via @objectstack/runtime)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

@os-zhuang
os-zhuang merged commit c53b5c3 into main Jul 4, 2026
16 checks passed
@os-zhuang
os-zhuang deleted the feat/flow-enable-disable-status branch July 4, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant