feat(flow): consolidate routing, approvals, and failure handling - #475
Merged
esafwan merged 3 commits intoJul 26, 2026
Merged
Conversation
…oval routing/permissions; add approvals inbox bell - Engine: honor loop executor next_node_id; reject decisions no longer follow approval-path edges; approval_type 'user'/'users' treated as synonyms in notifications, permission checks, and pending-approvals API - Validation: allow trigger.schedule and trigger.doc-event node types - Permissions: Huf Manager can create Flow Runs; approve endpoint requires read + approver identity; agent tool handlers enforce permissions and approver identity; webhook runs execute as flow owner instead of Guest - Builder: edge editor writes edgeType/condition keys the serializer reads, adds priority and approval-outcome (meta.outcome) controls; trigger types round-trip through the serializer - New ApprovalsBell in the unified header: pending-approvals inbox with badge, realtime + polled refresh, inline approve/reject, run deep link
Adds 'flow_failed' to the forwarded flowEvents array so the ApprovalsBell updates immediately on flow rejection without waiting for the 60s poll. Mirrors existing flow_completed forwarding.
- Approval routing: rejection without a meta.outcome=rejected edge fails the run (was: fell through success path); loop nodes route body/done via executor next_node_id - Huf Manager role has create on Flow Run (bench migrate required) - Agent tool handlers (run/get/resume/approve flow) enforce the same permission checks as REST endpoints - Note user/users approval_type synonym handling
esafwan
marked this pull request as ready for review
July 26, 2026 21:18
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
Consolidates the flow execution work from:
flow_failedrealtime forwarding and Flow Engine docs updatesThis umbrella branch was created cleanly from current
origin/developand preserves the source commit order/history:flow_failedrealtime forwarding follow-upSource PRs are intentionally left open and unmodified.
Preserved Scope
next_node_id, including body/done routing and graceful completion without adone_nodeedgeType,condition, priority, and approval outcome metadataapproval_typeuser/userscompatibilityApprovalsBellflow_failedrealtime event forwarding to the frontend socket contexttrigger.scheduleandtrigger.doc-eventAGENTS.mdChecks
python3 -m py_compile huf/ai/flow_api.py huf/ai/flow_engine.py huf/huf/doctype/flow_definition/flow_definition.py- passednpm --prefix frontend ci- passednpm --prefix frontend run typecheck- failed on existing develop baseline issue:src/components/chat/chatMessageList.mappers.ts(507,31): error TS2339: Property 'injectedMemories' does not exist on type 'ChatMessage'.origin/developworktree at28ff5f2; it fails with the same error.Notes
This PR does not merge or close #397 or #408. It is an umbrella consolidation branch for review/testing against current
developonly.