Skip to content

Give plays a user-owned enabled switch and persist engine suspensions #3444

Closed

Description

@malibio

Overview

Give a play its own user-owned on/off switch, enabled. Record the engine's verdicts as device-local suspensions that survive a restart and never change the user's switch. Make "does this play run" one check (ADR-087 §5).

Problem Statement

  • lifecycle_status is the play's on/off switch.
    • Startup loads only active plays (packages/core/src/playbook/engine.rs, query_nodes_by_type("play", Some("active"))).
    • handle_play_created and handle_play_updated compare lifecycle with the in-memory state.
    • nodespace playbook enable|disable (packages/cli/src/commands/playbook.rs) writes lifecycle_status.
    • packages/skill/references/cli.md teaches --lifecycle-status archived as the way to disable a play, and contradicts itself: it says no bespoke enable/disable commands exist, then documents playbook enable|disable.
  • Engine disables are memory only. PlaybookLifecycleManager::disable_play (packages/core/src/playbook/lifecycle.rs) is called on validation failure, the cycle-depth limit and action failure. The node stays active, no API can see the disable, and a restart undoes it.
  • Engine defects:
    • After an action failure, later rules of the same play still run in that work item.
    • handle_play_created's disable is a no-op.
    • A parse failure on update drops the play entirely.
  • Rule validation runs on any patch. validate_play_rules runs on any properties patch, so a switch-only write is refused for a play with now-invalid rules.
  • A nonexistent command is advertised. CLI help advertises playbook logs, which doesn't exist.

Proposed Solution

  1. Declare enabled on the play schema: boolean, default true, synced. It is changed only by a user or agent: playbook enable|disable, the Plays UI, node update.
  2. Declare the suspension fields suspended_reason (enum: validation_failed, action_failed, cycle_limit, schema_drift), suspended_message and suspended_at. They are system-owned and local_only, written without a version bump, and they emit a node-updated event.
  3. Runnable = participates (the governance check) ∧ enabled ∧ the rules are valid ∧ not suspended. Replace every play-specific lifecycle comparison in the engine with this one check.
  4. Clearing a suspension: setting enabled: true (even when it's already true) or saving new rules clears it; the engine re-validates and suspends again if the problem remains.
  5. Rule validation runs only when rules change, so a switch-only write always succeeds.
  6. Fix the three engine defects. After an action failure, skip that play's remaining rules for the work item; make the created-disable effective; a parse failure suspends the play instead of dropping it.
  7. The ADR-060 §8 seeded-play warning fires on enabled going true → false, or on rule edits.
  8. CLI: playbook enable|disable writes enabled; playbook list shows on / off / suspended (with reason and time); remove logs from the help.
  9. Skill guidance: update packages/skill/references/cli.md and SKILL.md to teach playbook enable|disable and enabled, remove --lifecycle-status as a play switch, and resolve the contradiction. Regenerate SKILL.md (drift check).

Architecture Impact

Implements decisions/087-lifecycle-status-is-governance-and-one-participation-rule.md §3 and §5 (nodespace-docs), with ADR-060 §8 (the seeded-play warning) and ADR-073 (per-device engine). architecture/playbook-system.md and playbook-engine.md need their enable/disable and suspension sections updated in the same PR.

Acceptance Criteria

  • The play schema declares enabled and the three local_only suspension fields
  • The engine never reads a play's lifecycle_status; runnable is the single check above (tests: disabled, suspended, archived and invalid plays don't run)
  • An engine failure writes a suspension that survives a daemon restart and leaves enabled unchanged (test)
  • Setting enabled: true, or saving fixed rules, clears a suspension (test)
  • A switch-only write succeeds for a play with invalid rules (test)
  • After an action failure, the play's later rules don't run in that work item (test); the created-disable and parse-failure defects are fixed (tests)
  • nodespace playbook enable|disable|list use enabled and the suspension fields; logs is gone from the help (CLI tests)
  • Skill guidance (cli.md, generated SKILL.md) teaches the new switch and no longer teaches lifecycle as a play switch; the drift check passes
  • Follows development/node-type-sequence.md; the node-types.md play sheet and the playbook docs updated in the same PR
  • bun run test:changed passes; bun run quality:fix clean

Technical Specifications

Reference Files

  • packages/core/src/models/core_schemas.rs (play schema)
  • packages/core/src/playbook/engine.rs (handle_play_created, handle_play_updated, startup load, the disable_play call sites)
  • packages/core/src/playbook/lifecycle.rs (PlaybookLifecycleManager)
  • packages/core/src/playbook/validation.rs (validate_play_rules)
  • packages/cli/src/commands/playbook.rs
  • packages/skill/references/cli.md, packages/skill/SKILL.md, packages/cli/examples/gen_skill_md.rs

Dependencies

Non-Goals

Activity

  1. malibio commented on Oct 2, 2026

    @malibio
    CollaboratorAuthor

    Baseline — Frontend: 303 test files passed, 5559 tests passed

  2. self-assigned this
    on Oct 2, 2026
  3. added 2 commits that reference this issue on Oct 2, 2026
    d20f859
    350fde2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions