feat(approvals): add the approval orchestration node producer - #538
Merged
Conversation
Wires producer #1 from the Approvals PRD: an `approval` orchestration node that parks a run for a human decision through the approvals queue. - New `approval` node type (orchestrations): resolves tool_id/arguments/ reasoning/evidence/predicted_impact/expires_in against run state and parks the run as awaiting_input, like a human node. - The engine emits an ApprovalItem (origin=node, linked to run+node) when the run settles into awaiting_input, stamping approval_id/expires_at onto the persisted required_action. - Resolution resumes the parked run via a producer-registered callback, so approvals never imports the engine (dependency points engine -> approvals). The decision (approved|rejected|expired) becomes the node's branch label: labeled edges route by decision; an unlabeled edge follows only on approval. Server-side expiry routes the run down its expired edge. - OpenAPI node schema, validation (approval requires tool_id), module docs, and an end-to-end integration test (park -> approve/reject/expire -> resume + route). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MDwNa8xgN4HGPbnchuuG82
The expiry sweeper resumes the run detached, so the run transitions through a transient 'running' state. Poll until a terminal status rather than just leaving 'awaiting_input', which raced the resume. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MDwNa8xgN4HGPbnchuuG82
Adds a direct unit test for executeApprovalNode covering the full/absent mapping cases, default vs explicit expiry, null/non-object coercion, and the missing-toolId guard — clearing the per-file branch threshold and the global 100% function-coverage threshold. All 2996 tests already pass; the job was failing on coverage only. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MDwNa8xgN4HGPbnchuuG82
Deploy Outputs
|
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MDwNa8xgN4HGPbnchuuG82
arantespp
added a commit
that referenced
this pull request
Jul 14, 2026
* docs(approvals): mark Phase 1 complete in the PRD checklist Phase 1 (approvals queue core + approval orchestration node) shipped in PRs #537 and #538. Update the implementation-status checklist and phase headings to reflect what is done vs deferred (dedup/re-classification → Phase 2/guardrails; exceptions → Phase 3; activity feed → Phase 4). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MDwNa8xgN4HGPbnchuuG82 * docs(approvals): add the approval-gate tutorial Adds an end-to-end tutorial for the approval orchestration node: create a gated orchestration, start a run that pauses awaiting approval, then approve one run and reject another and watch each resume down the matching decision edge. Registers it in the sidebar and links it from the Approvals module's Related Tutorials. Runs deterministically (no AI provider), so the tutorials-test job exercises the park -> resolve -> resume flow via the CLI end to end. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MDwNa8xgN4HGPbnchuuG82 --------- Co-authored-by: Claude <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements producer #1 of the Approvals PRD (
docs/prd-approvals.md): anapprovalorchestration node that converts a risky tool call into a human decision through the approvals queue landed previously (#537). A run parks on the node, the platform files anApprovalItem, and resolving it (approve / reject / expire) resumes the run and routes it down the matching decision edge.What's included
approvalnode type — resolvestool_id/arguments/reasoning/evidence/predicted_impact/expires_inagainst run state and parks the run asawaiting_input, like ahumannode. Extracted intoorchestrationApprovalNode.ts.awaiting_inputon an approval node, the engine emits anApprovalItem(origin: node, linked to the run + node) and stampsapproval_id/expires_atonto the persistedrequired_action.approved|rejected|expired) becomes the node's branch label. Labeled edges route by decision (the counterpart of aconditionnode); an unlabeled edge follows only on approval. Server-side expiry routes the run down itsexpirededge.approvalrequirestool_id; node schema documented inorchestrations.yaml;orchestrations.mdgains a Node Types row + an "Approval Nodes" section;approvals.mdclarified.approvalNode.test.ts): park → approve/reject/expire → resume + route, plus double-resolve409.Verification
tsctypecheck ✓, ESLint ✓, docs-lint ✓, SDK/CLI regenerated ✓. Server integration tests can't run in this environment (no Docker runtime), so they run in CIbuild-and-test.Notes
resultfield of an approved decision staysnullin v1 — the node produces the decision and a downstreamtoolnode executes the approved action, rather than the platform auto-executing at resolution.🤖 Generated with Claude Code
Generated by Claude Code