Solutions / Use Case
Resilient Human-in-the-Loop Workflows: Leave Approval
A leave approval flow looks simple until edge cases show up: cancel, rejection, delayed manager action, and retries after edits.
Leave Approval Flow
Submit Leave Request
# request.create
Wait For Manager Action
# hitl.wait_for_response
Flow Gateway
# decide
Complete Request
# approval.complete
The Challenge: State Persistence and Initialization
In a hand-built system, submit-time durability is on the developer. You need to write and maintain request initialization, persistence, and recovery paths. If submission and persistence are loosely coupled, transient failures can drop requests.
In Unmeshed, request state is initialized and persisted when the workflow starts, with a unique tracking ID. This removes a common class of custom plumbing code and reduces lost-request failure modes.
Handling Logic: Flow Gateway vs Hard-Coded If-Else
Large if-else trees are hard to maintain once routing grows beyond a few branches. Flow Gateway steps keep this routing explicit and reviewable in the workflow map.
- Automatic transitions: a Cancel action exits early and stops unnecessary execution.
- Safety checks: a request cannot move to Approved unless required prior states are satisfied.
- Loopback routing: rejected requests can be sent back to the employee for correction without custom rollback code.
Implementing Human-in-the-Loop Patterns
Approval flows spend most of their lifetime waiting for people. In many systems, developers build custom wake-up logic, polling, or callback orchestration to resume execution later.
With Unmeshed Human-in-the-Loop patterns, the process pauses at the wait point and resumes at the same step when input arrives. The platform handles pause/resume mechanics so long-lived flows do not require custom wait infrastructure.
Exception Handling and Terminal States
Rejection paths should not become dead ends. They should be modeled as explicit states and transitions.
- Rejections are explicit states in the workflow map, not hidden side effects in code.
- Returned requests can re-enter the approval path after edits.
- Operational debugging stays visual and traceable instead of log-hunting across services.
Ready to build flows like this?
Start with a basic approval workflow, add gateway conditions, then layer loopbacks and human-input steps as your process grows.