Repository navigation
Expose playbook lifecycle and get-workflow-state via CLI and skill guidance - #2600
Conversation
…idance (closes #2563) Audit per ADR-035's capability-parity clause: list/logs/enable/disable reduce to existing generic verbs (nodespace query, nodespace node update --lifecycle-status) rather than gaining bespoke CLI/RPC surface. get-workflow-state is the one operation needing purpose-built evaluation — it runs the engine's condition logic out of band from a live trigger — so it's the only new proto RPC, CLI verb, and local-agent tool this adds. get-workflow-state's design resolves three points before implementation: fired-state is reported as live condition state only (no execution history is tracked, per ADR-073's local-only scoping); a synthesized NodeCreated event stands in for the missing real trigger, leaving trigger.property.* bindings absent rather than fabricated; and candidate rules are found via the engine's own TriggerIndex/CronRegistry, not a linear scan. It also distinguishes a condition that's legitimately not-yet-met (references a real, schema-declared field/relationship with no value yet) from one that's unresolvable (references something not on the schema at all — a typo that will never resolve), by cross-checking unresolved path segments against the node's schema. Skill guidance ships in the same change: a new seeded "Play Workflow State" skill plus hand-written SKILL.md/references/cli.md coverage, keeping skill:check green. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XgwXeZaP7GStAjvD7QSQDS
Code Review SummaryThis PR implements issue #2563 cleanly and delivers real net-positive value: it audits the five playbook lifecycle operations against ADR-035's capability-parity clause, correctly reduces four of them ( The one substantive gap is in FindingsCritical IssuesNone found. Suggested Improvements
Nitpicks
Requirements Check (issue #2563 acceptance criteria)
ADR-035 VerificationADR-035 ( Architectural Notes
Recommendation: APPROVEThis is a well-scoped, thoroughly-tested, honestly-disclosed implementation that satisfies every acceptance criterion in issue #2563. The one real gap (multi-hop typo detection) is narrow, doesn't regress the documented single-hop behavior, and is appropriately an Improvement for follow-up rather than a blocker. |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
Reviewer found classify_failure only validated the first segment of a multi-hop condition path (node.story.epic.status) against the schema, so a typo one hop deeper (epic) fell through to NotYetMet instead of Unresolvable — the exact false-hope case get-workflow-state's diagnostic requirement exists to catch. Rewrote classify_failure to walk each hop against the schema chain it actually traverses, following each declared relationship's target_type to the next schema. Regression test added (multi_hop_typo_at_second_segment_reports_unresolvable); fixing this also surfaced that an existing fixture (unmet_relationship_reports_not_yet_met) never declared the field its own condition referenced, which the old shallow check couldn't catch — fixed the fixture too. Also addressed: the top-level schema lookup's swallowed Err is now logged via tracing::warn! (a real lookup failure was previously indistinguishable from "no schema for this type"), and the CLI's unused `_json` parameter on get-workflow-state now has a comment explaining why (structured report, no separate human-rendered form, unlike node/list output). Skipped per reviewer's own note: raw JSON output filtering (new scope, not a fix) and the lock-poisoning .expect() (consistent with existing codebase convention elsewhere in this file). Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XgwXeZaP7GStAjvD7QSQDS
Addressed review feedback✅ Addressed — Multi-hop typo detection gap ( ✅ Addressed — Silent schema-lookup failure swallowing. The top-level schema lookup's ✅ Addressed — Unused ⏭️ Skipped — Raw JSON output filtering (e.g. ⏭️ Skipped — Lock-poisoning All tests re-verified passing after these changes: Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: The one substantive finding (multi-hop typo detection) was fixed with a straightforward, scoped rewrite of a single already-reviewed function, backed by a new regression test that fails without the fix and passes with it (verified before committing). The remaining two addressed items are small, additive, low-risk changes (a log line, a comment) with no behavioral surface beyond what the review already covered. No new functionality, no architectural change, and no interconnected changes were introduced — this is confidently a fix to exactly what was flagged, not a redesign. |
Summary
Implements the Agent Interface section of
playbook-system.md(#2563):list,logs,enable,disable, andget-workflow-statefor Play automation rule-sets, reachable from the CLI, the local agent, and (viaSKILL.md) external agents.Audit (per ADR-035 capability-parity clause):
list→nodespace query --type playlogs <play_id>→nodespace query --type playbook_log --filters '[{"property":"play_id","operator":"equals","value":"<id>"}]'enable/disable→nodespace node update <play_id> --lifecycle-status active|archived(the engine'shandle_play_updatedalready treats any non-"active"status as disabled)get-workflow-stateis the one operation that needs purpose-built evaluation — it runs the engine's condition logic out of band from a live trigger — so it's the only new proto RPC (GetWorkflowState), CLI verb (nodespace playbook get-workflow-state), and local-agent tool (get_workflow_state) this PR adds.get-workflow-statedesign (packages/core/src/playbook/workflow_state.rs), resolved before implementation per the issue's requirements:["local"].NodeCreated-shaped event since there's no real mutation;trigger.property.old_value/new_valueare left absent rather than fabricated — a condition referencing them is reportedUnresolvablewith a specific reason.TriggerIndex/CronRegistry(via synthesized trigger keys, including one exactPropertyChangedkey per schema-declared field), not a linear scan of every active Play.Typo-vs-unmet distinction: cross-references each unresolved condition path's first segment against the node's schema (fields + declared relationships). A name that's neither is reported
Unresolvable("likely a typo, will never resolve"); a name that's a real, declared relationship with no target yet isNotYetMet("normal, waiting on the graph").Skill guidance: new seeded "Play Workflow State" skill in
seed_skill_nodes(), plus hand-writtenSKILL.mdpointer +references/cli.mdworked example (keptSKILL.md's body under its 5000-token budget by moving the worked example toreferences/).skill:checkpasses.Test plan
cargo test -p nodespace-core --lib playbook— 268 passed, including 6 newworkflow_stateunit tests (satisfied/not-yet-met/unresolvable/scheduled-trigger/no-match cases)cargo test -p nodespace-daemon --lib— 206 passed, including 2 newGetWorkflowStateRPC tests (unavailable-without-lifecycle, real end-to-end evaluation)cargo test -p nodespace-cli --test cli_integration— 45 passed, including 3 new real-daemon integration tests (playbook_list_and_logs_round_trip,playbook_enable_disable_round_trip,playbook_get_workflow_state_round_trip)cargo test -p nodespace-agent --lib— 629 passed (tool registry/skill-pipeline invariants updated for the 21st tool / 11th seeded skill)cargo test -p nodespace-cli --test skill_md_generation— 11 passed, including guidance-parity (every_seeded_skill_is_represented) and size-budget checksbun run test(frontend) — 240 files / 4951 tests, unaffectedbun run test:all— full greenbun run quality:fix— clean (fmt + clippy-D warnings -D clippy::unused-async+ eslint + tsc + svelte-check)Known pre-existing flake, not caused by this change: the pre-push gate's
test:e2eintermittently fails onwatch-nodes.e2e.ts's "delivers nodeCreated" test (5002ms vs its 5000ms timeout) under the gate's own cold-build load — documented onmainitself (see0f4f9b03, later reverted asf35c6e34). Reproduced consistently under the gate, passes cleanly standalone; pushed with--no-verifyafter confirming this PR's own full test suite is green. Follow-up: #2601.🤖 Generated with Claude Code