Skip to content

feat(flow): consolidate routing, approvals, and failure handling - #475

Merged
esafwan merged 3 commits into
developfrom
consolidation/flow-routing-approvals-failures-2026-07
Jul 26, 2026
Merged

feat(flow): consolidate routing, approvals, and failure handling#475
esafwan merged 3 commits into
developfrom
consolidation/flow-routing-approvals-failures-2026-07

Conversation

@esafwan

@esafwan esafwan commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Consolidates the flow execution work from:

This umbrella branch was created cleanly from current origin/develop and preserves the source commit order/history:

  1. Flow engine: fix loop routing, edge serialization, approval routing & permissions; add approvals inbox #397 feature/fix commit
  2. flow_failed realtime forwarding follow-up
  3. Flow Engine documentation update

Source PRs are intentionally left open and unmodified.

Preserved Scope

  • Loop routing via executor next_node_id, including body/done routing and graceful completion without a done_node
  • Edge serialization fixes for edgeType, condition, priority, and approval outcome metadata
  • Approval routing fixes, including rejected approvals not falling through approved/success paths
  • Approval permissions and approval_type user/users compatibility
  • Pending approvals inbox UI via ApprovalsBell
  • flow_failed realtime event forwarding to the frontend socket context
  • Huf Manager Flow Run create permission
  • Agent tool handler permission parity for run/get/resume/approve flow actions
  • Webhook-triggered flows executing as the flow owner
  • Validation support for trigger.schedule and trigger.doc-event
  • Flow Engine docs in AGENTS.md

Checks

  • python3 -m py_compile huf/ai/flow_api.py huf/ai/flow_engine.py huf/huf/doctype/flow_definition/flow_definition.py - passed
  • npm --prefix frontend ci - passed
  • npm --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'.
    • Verified by rerunning the same install/typecheck on a clean origin/develop worktree at 28ff5f2; 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 develop only.

esafwan added 3 commits July 27, 2026 00:38
…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
esafwan marked this pull request as ready for review July 26, 2026 21:18
@esafwan
esafwan merged commit 09209de into develop Jul 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant