Skip to content

fix(durable-demo): make fraud-detection workflow reliably runnable on Windows#427

Merged
james-tn merged 2 commits into
mainfrom
fix/durable-workflow-windows-demo
Jun 10, 2026
Merged

fix(durable-demo): make fraud-detection workflow reliably runnable on Windows#427
james-tn merged 2 commits into
mainfrom
fix/durable-workflow-windows-demo

Conversation

@james-tn

@james-tn james-tn commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Makes the durable fraud-detection demo (agentic_ai/workflow/fraud_detection_durable) reliably runnable on Windows, adds presenter-friendly controls, and clarifies setup docs. Found while preparing the demo for a lab session.

Bug fixes

  • Emoji-print crash (blocker on Windows). observability/setup.py printed status emoji (✅/⚠️/❌) which raises UnicodeEncodeError on the default Windows cp1252 console. The except handler then double-faulted on its own emoji print, so "non-fatal" observability became a hard startup crash that killed the worker whenever App Insights was configured. Now reconfigures stdout/stderr to UTF-8 at import and routes messages through a _safe_print() that can never raise.
  • Mojibake in logs. Added an early UTF-8 stdout/stderr guard to worker.py and backend.py so emoji/arrows render correctly.
  • Shallow /health. backend.py /health returned {status: healthy} unconditionally. Now a deep readiness probe checking DTS connectivity, MCP reachability (TCP), and the Azure OpenAI Entra credential, returning 503 with a per-dependency breakdown.

Demo ergonomics

  • Event producer defaults OFF so a presenter controls when the ambient feed begins. New POST /api/producer/start, POST /api/producer/stop, GET /api/producer/status endpoints, plus a power-button toggle in the UI Live Feed panel.
  • start.ps1 / stop.ps1 — Windows launchers that force UTF-8, start MCP → worker → backend → UI in order with health gating, and stop the stack cleanly.

Docs

  • .env.sample: documents DTS Mode A (local emulator) vs Mode B (Azure DTS), clarifies DefaultAzureCredential vs API key, and the event-producer defaults.
  • README.md: splits Running the Demo into the two DTS modes, adds the Windows quick-start, and documents the /health readiness check.

Validation

Ran the workflow end-to-end against a live Azure DTS taskhub:
orchestration scheduling → multi-specialist fraud analysis (risk=0.79) → durable HITL external-event wait → approve decision → exactly-once account-lock activity → terminal COMPLETED. Worker started cleanly with App Insights enabled (the previously-crashing path), /health returned healthy with all three dependencies green, and the UI built successfully.

Note: observability/setup.py is shared, but the change is defensive only (UTF-8 console + non-raising prints) and does not alter telemetry behavior.

… Windows

Fixes several issues found while running the durable fraud-detection demo on
Windows, and adds presenter-friendly controls and launch scripts.

Bug fixes:
- observability/setup.py: emoji in print() crashed services on Windows cp1252
  (UnicodeEncodeError), and the except handler double-faulted on its own emoji
  print, turning 'non-fatal' observability into a hard startup crash. Now
  reconfigures stdout/stderr to UTF-8 at import and routes status messages
  through a _safe_print() that can never raise.
- worker.py / backend.py: add an early UTF-8 stdout/stderr guard so emoji and
  arrows in logs render correctly instead of mojibake/escapes.
- backend.py /health: was a shallow {status: healthy}. Now a deep readiness
  probe that checks DTS connectivity, MCP reachability (TCP), and the Azure
  OpenAI Entra credential, returning 503 with a per-dependency breakdown.

Demo ergonomics:
- Event producer now defaults OFF so a presenter controls when the ambient
  feed starts. New endpoints POST /api/producer/start, /stop and GET
  /api/producer/status, plus a power-button toggle in the UI Live Feed panel.
- start.ps1 / stop.ps1: Windows launchers that force UTF-8, start
  MCP -> worker -> backend -> UI in order with health gating, and stop the
  stack cleanly (match demo processes by command line).

Docs:
- .env.sample: document DTS Mode A (local emulator) vs Mode B (Azure DTS),
  clarify DefaultAzureCredential vs API key, and the event-producer defaults.
- README.md: split Running the Demo into the two DTS modes, add the Windows
  quick-start via start.ps1, and document the /health readiness check.

Validated end-to-end against a live Azure DTS taskhub: orchestration scheduling,
multi-specialist fraud analysis, durable HITL external-event wait, approve
decision, exactly-once account-lock activity, and terminal COMPLETED status.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@james-tn james-tn merged commit e038ec0 into main Jun 10, 2026
18 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