Skip to content

fix(bpmn): fix AI Email Support Agent layout and lint issues#94

Open
HanselIdes wants to merge 5 commits intomainfrom
fix/ai-email-support-agent-bpmn-layout
Open

fix(bpmn): fix AI Email Support Agent layout and lint issues#94
HanselIdes wants to merge 5 commits intomainfrom
fix/ai-email-support-agent-bpmn-layout

Conversation

@HanselIdes
Copy link
Copy Markdown
Contributor

@HanselIdes HanselIdes commented Apr 13, 2026

Summary

Fixes two issues reported in Slack (thread) with the AI Email Support Agent blueprint.

Logic fix: Swapped "Review case resolution" and "Final answer to customer" so the human reviewer approves the agent's response before it is sent to the customer. The previous order inverted the human-in-the-loop step.

Layout and DI fixes:

  • Moved "Case solved" end event to the right of both tasks; resolved overlapping sequence flow edges in that area
  • Added missing <bpmndi:BPMNLabel /> on unnamed join gateway Gateway_0kp1fqr — this element was omitted by the modeling tool for unnamed gateways, which surfaced a serialization bug
  • Added explicit XOR join gateway (Gateway_join_specialist) before "Specialist answered" inside the ad-hoc sub-process to fix a fake-join lint violation
  • Added explicit end event downstream of the escalation throw to satisfy no-implicit-end
  • Added BPMNShape/BPMNEdge for TextAnnotation_loan_approval_intro and its association, which were in the process XML but missing from the diagram (no-bpmndi errors)
  • Consolidated three duplicate escalation elements and two duplicate error elements; removed unused Message_0fr5ip9

Result: 0 bpmnlint errors, 0 warnings (down from 2 errors, 8 warnings).

Test fix: Updated test cases to complete the user task ("Review case resolution") before the service task ("Final answer to customer") to match the corrected flow order.

Test plan

  • npx bpmnlint --config .bpmnlintrc "solutions/bank-ai-loan-approval/AI Email Support Agent.bpmn" — exits 0, 0 errors, 0 warnings
  • Diagram flow reads left-to-right: Review case resolution → Final answer to customer → Case solved
  • "Case solved" end event is rightmost element in the top path
  • Camunda Modeler shows "No problems found"
  • mvn test passes in CI

🤖 Generated with Claude Code

HanselIdes and others added 4 commits April 13, 2026 11:48
- Swap order of Review case resolution and Final answer tasks so human
  review happens before sending the customer email (correct HiL flow)
- Move Case solved end event to the right of both tasks, fix overlapping
  sequence flow edges
- Add missing BPMNLabel on unnamed joining gateway (Gateway_0kp1fqr)
- Fix fake-join on Specialist answered event by introducing an XOR join
  gateway (Gateway_join_specialist) inside the ad-hoc sub-process
- Convert implicit-end escalation throw event to explicit end by adding
  Event_human_control_end downstream of Event_1jfz6dk
- Add missing BPMNShape/BPMNEdge for TextAnnotation_loan_approval_intro
  and its association (no-bpmndi lint errors)
- Consolidate duplicate global escalation and error elements; remove
  unused Message_0fr5ip9

Reported via: https://camunda.slack.com/archives/C05S2QM684U/p1776068928897879

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Review case resolution (user task) now precedes Final answer to customer
(service task) in the AGENT_SUCCESS path. Update both affected test
cases to complete Activity_1647ldd before Activity_0d9av47, and add
ASSERT_ELEMENT_INSTANCES routing validation before the user task step.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e overlaps

Manual layout refinements: relocated TextAnnotation_loan_approval_intro
and resized elements to eliminate the remaining overlap warnings detected
by bpmnlint.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@HanselIdes
Copy link
Copy Markdown
Contributor Author

HanselIdes commented Apr 13, 2026

Diagram screenshot (post-fix)

image

Rendered via camunda-viewer + Playwright after all visual and lint fixes were applied.

Screenshot is saved locally at `/tmp/ai-email-support-agent.png` — attach it here by dragging into the GitHub web editor if you want it embedded.

What to verify visually:

  • Happy path (top): Customer email received → Handle customer request → Save customer interaction → Agent as a Judge → Review case resolutionFinal answer to customer → Case solved (left to right, no overlap)
  • "Finalize case manually" branch terminates cleanly at "Case resolution applied by human"
  • "Human control required" event subprocess sits below the main flow, clearly separated
  • No overlapping elements or crossing flow lines

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the AI Email Support Agent blueprint by correcting the human-in-the-loop ordering (review happens before sending the final customer email), and resolves multiple bpmnlint/diagram (DI) issues to reach a clean lint state.

Changes:

  • Reordered the “Review case resolution” user task to occur before “Final answer to customer”.
  • Added/adjusted BPMN elements and DI (explicit join gateway, explicit end event, missing labels/shapes/edges) to eliminate bpmnlint errors/warnings.
  • Updated JSON process test cases to match the corrected execution order.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
solutions/bank-ai-loan-approval/AI Email Support Agent.bpmn Corrects task sequencing and fixes DI/lint issues (explicit join/end, labels, shapes/edges, de-dup of escalation/error elements).
solutions/bank-ai-loan-approval/test/src/test/resources/test-cases/AI Email Support Agent.test.json Updates test instruction order to complete the review user task before the final email service task, adding assertions for expected active elements.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@philippfromme
Copy link
Copy Markdown

image

Is this correct?

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@HanselIdes
Copy link
Copy Markdown
Contributor Author

image Is this correct?

@philippfromme No, that's a weird arrow, thanks for catching it.
image
Fix is live

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.

3 participants