import json, datetime
rec = {
  "ts": datetime.datetime.utcnow().isoformat()+"Z",
  "agent": "amd-agent-login",
  "step": "confirm-email-blocked",
  "status": "blocked",
  "detail": ("Password ALREADY changed to target by prior worker (changepw2.out: 'Your password has been changed') and stored in creds. "
             "Re-logged in as AGENT with new pw successfully -> reaches mandatory 'Confirm your email address' screen (code field). "
             "BLOCKER: confirm code emailed to agent@exulthealthcare.com but NOT arriving in that mailbox (verified via M365 MCP, no AMD mail since 05:00 UTC today). "
             "All historical AMD codes addressed to gau***@ (gautam@), and mailbox shows 'Undeliverable: AdvancedMD Login' bounces. "
             "No 'trust this device' option exists (one-time email confirm, not per-login MFA). 'Confirm later' does NOT persist session (launch-app bounces to login). "
             "Cannot reach dashboard / ReportCenter without the confirmation code. NEED Gautam: provide the AMD confirm code (or where it lands), or point AGENT account email to a readable mailbox.")
}
with open("/tmp/orchestrator-status.jsonl","a") as f:
    f.write(json.dumps(rec)+"\n")
print("status appended")
