fix(durable-demo): make fraud-detection workflow reliably runnable on Windows#427
Merged
Conversation
… 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>
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
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
observability/setup.pyprinted status emoji (✅/UnicodeEncodeErroron the default Windows cp1252 console. Theexcepthandler 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 reconfiguresstdout/stderrto UTF-8 at import and routes messages through a_safe_print()that can never raise.stdout/stderrguard toworker.pyandbackend.pyso emoji/arrows render correctly./health.backend.py/healthreturned{status: healthy}unconditionally. Now a deep readiness probe checking DTS connectivity, MCP reachability (TCP), and the Azure OpenAI Entra credential, returning503with a per-dependency breakdown.Demo ergonomics
POST /api/producer/start,POST /api/producer/stop,GET /api/producer/statusendpoints, 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), clarifiesDefaultAzureCredentialvs 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/healthreadiness 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),/healthreturnedhealthywith all three dependencies green, and the UI built successfully.