{
  "id": "inv_mvv2nbrq3eam05ef",
  "tenantId": "yc-recording-v1",
  "incidentId": "inc_mvv2nbjz3bjsy83m",
  "status": "completed",
  "body": {
    "mode": "deterministic",
    "modeReason": "Deterministic experiment search (non-LLM mode): AI_GATEWAY_API_KEY not set",
    "budget": {
      "maxExperiments": 14,
      "maxMillis": 60000,
      "perExperimentMillis": 10000,
      "maxTokens": 60000,
      "maxModelCostUsd": 1,
      "permissions": {
        "sandboxWrite": true,
        "productionRead": true,
        "productionWrite": false
      }
    },
    "stage": "done",
    "evidence": {
      "contract": {
        "id": "ctr_refund_executed_yc-recording-v1",
        "name": "Approved refund is issued correctly",
        "description": "When the support agent approves a refund request and resolves the ticket, the payment for the order named in the ticket must carry a succeeded refund for exactly the requested amount, in the requested currency, within two minutes. Refunds on other payments of the same customer do not count.",
        "conditions": [
          {
            "path": "refunds.succeededMinor",
            "op": "eq",
            "ref": "ticket.requestedAmountMinor",
            "id": "refund_amount_correct",
            "description": "Succeeded refunds on the named payment equal the requested amount",
            "applicableWhen": [
              {
                "path": "charge.exists",
                "op": "eq",
                "value": true
              },
              {
                "path": "ticket.requestedAmountMinor",
                "op": "neq",
                "value": null
              }
            ]
          },
          {
            "path": "refunds.succeededMinor",
            "op": "eq",
            "ref": "charge.amountMinor",
            "id": "refund_full_when_unspecified",
            "description": "Without a requested amount, the payment is refunded in full",
            "applicableWhen": [
              {
                "path": "charge.exists",
                "op": "eq",
                "value": true
              },
              {
                "path": "ticket.requestedAmountMinor",
                "op": "eq",
                "value": null
              }
            ]
          },
          {
            "path": "charge.currency",
            "op": "eq",
            "ref": "ticket.requestedCurrency",
            "id": "refund_currency_matches",
            "description": "The payment's currency matches the requested currency",
            "applicableWhen": [
              {
                "path": "charge.exists",
                "op": "eq",
                "value": true
              },
              {
                "path": "ticket.requestedCurrency",
                "op": "neq",
                "value": null
              }
            ]
          },
          {
            "path": "refunds.count",
            "op": "lte",
            "value": 1,
            "id": "refund_single",
            "description": "At most one refund was issued against the payment",
            "applicableWhen": [
              {
                "path": "charge.exists",
                "op": "eq",
                "value": true
              }
            ]
          },
          {
            "path": "siblingRefunds.sinceTicketMinor",
            "op": "eq",
            "value": 0,
            "id": "no_refund_on_other_payments",
            "description": "No other payment of the customer was refunded for this request",
            "applicableWhen": []
          }
        ],
        "deadlineSeconds": 120
      },
      "contractSnapshot": {
        "id": "ctr_refund_executed_yc-recording-v1",
        "tenantId": "yc-recording-v1",
        "name": "Approved refund is issued correctly",
        "description": "When the support agent approves a refund request and resolves the ticket, the payment for the order named in the ticket must carry a succeeded refund for exactly the requested amount, in the requested currency, within two minutes. Refunds on other payments of the same customer do not count.",
        "version": 1,
        "trigger": {
          "object": "ticket",
          "categories": [
            "refund"
          ],
          "status": "resolved",
          "requiresAgentApproval": true
        },
        "identifiers": {
          "order": {
            "source": "ticket.orderRef",
            "required": true
          }
        },
        "conditions": [
          {
            "path": "refunds.succeededMinor",
            "op": "eq",
            "ref": "ticket.requestedAmountMinor",
            "id": "refund_amount_correct",
            "description": "Succeeded refunds on the named payment equal the requested amount",
            "applicableWhen": [
              {
                "path": "charge.exists",
                "op": "eq",
                "value": true
              },
              {
                "path": "ticket.requestedAmountMinor",
                "op": "neq",
                "value": null
              }
            ]
          },
          {
            "path": "refunds.succeededMinor",
            "op": "eq",
            "ref": "charge.amountMinor",
            "id": "refund_full_when_unspecified",
            "description": "Without a requested amount, the payment is refunded in full",
            "applicableWhen": [
              {
                "path": "charge.exists",
                "op": "eq",
                "value": true
              },
              {
                "path": "ticket.requestedAmountMinor",
                "op": "eq",
                "value": null
              }
            ]
          },
          {
            "path": "charge.currency",
            "op": "eq",
            "ref": "ticket.requestedCurrency",
            "id": "refund_currency_matches",
            "description": "The payment's currency matches the requested currency",
            "applicableWhen": [
              {
                "path": "charge.exists",
                "op": "eq",
                "value": true
              },
              {
                "path": "ticket.requestedCurrency",
                "op": "neq",
                "value": null
              }
            ]
          },
          {
            "path": "refunds.count",
            "op": "lte",
            "value": 1,
            "id": "refund_single",
            "description": "At most one refund was issued against the payment",
            "applicableWhen": [
              {
                "path": "charge.exists",
                "op": "eq",
                "value": true
              }
            ]
          },
          {
            "path": "siblingRefunds.sinceTicketMinor",
            "op": "eq",
            "value": 0,
            "id": "no_refund_on_other_payments",
            "description": "No other payment of the customer was refunded for this request",
            "applicableWhen": []
          }
        ],
        "instance": {
          "eventTypes": [
            "ticket.resolved"
          ],
          "initialRetrySeconds": 30,
          "maxRetrySeconds": 600,
          "maxAgeSeconds": 86400
        },
        "deadlineSeconds": 120,
        "severity": "high",
        "approved": true,
        "approvedAt": "2026-10-30T14:32:32.938Z",
        "enabled": true,
        "draftedBy": "template",
        "provenance": {
          "sources": [
            {
              "kind": "customer_request",
              "ref": "onboarding instruction",
              "excerpt": "Approved refunds must land on the named payment for exactly the requested amount."
            },
            {
              "kind": "policy_document",
              "ref": "Approved refund workflow",
              "excerpt": "issues one refund for the requested amount (minor units, requested currency) against that charge"
            },
            {
              "kind": "api_schema",
              "ref": "Support API (requestedAmountMinor, requestedCurrency), Payments API"
            }
          ],
          "assumptions": [
            "A request without a structured amount means a full refund of the payment.",
            "Split refunds are not allowed: at most one refund per payment per request.",
            "Tickets resolved without agent approval (declined or escalated requests) are not monitored."
          ]
        },
        "createdAt": "2026-10-30T14:32:32.938Z",
        "updatedAt": "2026-10-30T14:32:32.938Z"
      },
      "evaluation": {
        "status": "violated",
        "reason": "Deadline passed with refund_amount_correct, no_refund_on_other_payments unmet.",
        "deadlineAt": "2026-10-30T14:37:40.812Z",
        "evaluatedAt": "2026-10-30T14:38:41.162Z",
        "conditions": [
          {
            "id": "refund_amount_correct",
            "description": "Succeeded refunds on the named payment equal the requested amount",
            "observed": 0,
            "expected": "refunds.succeededMinor eq ticket.requestedAmountMinor",
            "path": "refunds.succeededMinor",
            "status": "violated"
          },
          {
            "id": "refund_full_when_unspecified",
            "description": "Without a requested amount, the payment is refunded in full",
            "observed": 0,
            "expected": "refunds.succeededMinor eq charge.amountMinor",
            "path": "refunds.succeededMinor",
            "status": "not_applicable",
            "inapplicableBecause": "ticket.requestedAmountMinor eq null"
          },
          {
            "id": "refund_currency_matches",
            "description": "The payment's currency matches the requested currency",
            "observed": "usd",
            "expected": "charge.currency eq ticket.requestedCurrency",
            "path": "charge.currency",
            "status": "satisfied"
          },
          {
            "id": "refund_single",
            "description": "At most one refund was issued against the payment",
            "observed": 0,
            "expected": "refunds.count lte 1",
            "path": "refunds.count",
            "status": "satisfied"
          },
          {
            "id": "no_refund_on_other_payments",
            "description": "No other payment of the customer was refunded for this request",
            "observed": 4500,
            "expected": "siblingRefunds.sinceTicketMinor eq 0",
            "path": "siblingRefunds.sinceTicketMinor",
            "status": "violated"
          }
        ]
      },
      "snapshot": {
        "envId": "prod_yc-recording-v1",
        "capturedAt": "2026-10-30T14:38:41.244Z",
        "ticket": {
          "id": "tkt_mvv2nb3p34qkh0sn",
          "customerId": "cus_mvv2nb1t2z9p5yrs",
          "requesterEmail": "theo.mvv2nb1m@example.com",
          "subject": "Refund request",
          "body": "Hi, please refund $45.00 for order ord_mvv2nb29301zuqna. The item arrived damaged.",
          "category": "refund",
          "orderRef": "ord_mvv2nb29301zuqna",
          "status": "resolved",
          "agentApproved": true,
          "resolutionMessage": "We've refunded $45.00 to your original payment method for order ord_mvv2nb2v32ktl8rd. It should appear within 5-10 business days.",
          "createdAt": "2026-10-30T14:35:40.686Z",
          "updatedAt": "2026-10-30T14:35:40.812Z",
          "resolvedAt": "2026-10-30T14:35:40.812Z",
          "requestedAmountMinor": 4500,
          "requestedCurrency": "usd"
        },
        "order": {
          "id": "ord_mvv2nb29301zuqna",
          "customerId": "cus_mvv2nb1t2z9p5yrs",
          "status": "paid",
          "totalMinor": 4500,
          "currency": "usd",
          "createdAt": "2026-10-27T14:35:40.618Z",
          "updatedAt": "2026-10-27T14:35:40.618Z"
        },
        "charge": {
          "id": "ch_mvv2nb2h31sjgy91",
          "orderId": "ord_mvv2nb29301zuqna",
          "customerId": "cus_mvv2nb1t2z9p5yrs",
          "amountMinor": 4500,
          "currency": "usd",
          "status": "succeeded",
          "createdAt": "2026-10-30T14:35:40.649Z"
        },
        "refunds": [],
        "refundSummary": {
          "count": 0,
          "succeededMinor": 0,
          "pendingMinor": 0,
          "latestStatus": null
        },
        "shipment": null,
        "siblingOrders": [
          {
            "id": "ord_mvv2nb2v32ktl8rd",
            "customerId": "cus_mvv2nb1t2z9p5yrs",
            "status": "paid",
            "totalMinor": 8000,
            "currency": "usd",
            "createdAt": "2026-10-29T14:35:40.618Z",
            "updatedAt": "2026-10-29T14:35:40.618Z"
          }
        ],
        "siblingCharges": [
          {
            "id": "ch_mvv2nb3233da8f8y",
            "orderId": "ord_mvv2nb2v32ktl8rd",
            "customerId": "cus_mvv2nb1t2z9p5yrs",
            "amountMinor": 8000,
            "currency": "usd",
            "status": "partially_refunded",
            "createdAt": "2026-10-30T14:35:40.670Z"
          }
        ],
        "siblingRefunds": [
          {
            "refundId": "re_mvv2nb6135fd60w5",
            "chargeId": "ch_mvv2nb3233da8f8y",
            "orderId": "ord_mvv2nb2v32ktl8rd",
            "amountMinor": 4500,
            "currency": "usd",
            "status": "succeeded",
            "createdAt": "2026-10-30T14:35:40.777Z"
          }
        ],
        "siblingRefundSummary": {
          "count": 1,
          "sinceTicketCount": 1,
          "sinceTicketMinor": 4500
        },
        "missing": []
      },
      "succeeded": [
        "refund_currency_matches",
        "refund_single"
      ],
      "failed": [
        "refund_amount_correct",
        "no_refund_on_other_payments"
      ],
      "systemsInvolved": [
        "support",
        "payments"
      ],
      "observations": [
        {
          "id": "obs_cond_refund_amount_correct",
          "system": "payments",
          "text": "Succeeded refunds on the named payment equal the requested amount: violated (observed 0, expected refunds.succeededMinor eq ticket.requestedAmountMinor)."
        },
        {
          "id": "obs_cond_refund_full_when_unspecified",
          "system": "payments",
          "text": "Without a requested amount, the payment is refunded in full: not_applicable (observed 0, expected refunds.succeededMinor eq charge.amountMinor)."
        },
        {
          "id": "obs_cond_refund_currency_matches",
          "system": "payments",
          "text": "The payment's currency matches the requested currency: satisfied (observed \"usd\", expected charge.currency eq ticket.requestedCurrency)."
        },
        {
          "id": "obs_cond_refund_single",
          "system": "payments",
          "text": "At most one refund was issued against the payment: satisfied (observed 0, expected refunds.count lte 1)."
        },
        {
          "id": "obs_cond_no_refund_on_other_payments",
          "system": "payments",
          "text": "No other payment of the customer was refunded for this request: violated (observed 4500, expected siblingRefunds.sinceTicketMinor eq 0)."
        },
        {
          "id": "obs_ticket",
          "system": "support",
          "text": "Ticket tkt_mvv2nb3p34qkh0sn (refund) was approved and resolved at 2026-10-30T14:35:40.812Z; order reference quoted: ord_mvv2nb29301zuqna."
        },
        {
          "id": "obs_ticket_claims_success",
          "system": "support",
          "text": "The resolution message claims completion: \"We've refunded $45.00 to your original payment method for order ord_mvv2nb2v32ktl8rd. It should appear within 5-10 business days.\"."
        },
        {
          "id": "obs_no_shipment",
          "system": "fulfillment",
          "text": "No shipment exists for order ord_mvv2nb29301zuqna."
        },
        {
          "id": "obs_order",
          "system": "commerce",
          "text": "Order ord_mvv2nb29301zuqna is paid; last updated 2026-10-27T14:35:40.618Z."
        },
        {
          "id": "obs_sibling_orders",
          "system": "commerce",
          "text": "The requester has 1 other order(s): ord_mvv2nb2v32ktl8rd (paid)."
        },
        {
          "id": "obs_refunds",
          "system": "payments",
          "text": "Charge ch_mvv2nb2h31sjgy91 (4500 usd) has 0 refund(s) totalling 0 succeeded."
        },
        {
          "id": "obs_refundable_balance",
          "system": "payments",
          "text": "Observed charge amount 4500 usd; 0 refund(s) precede the request, leaving 4500 minor units under the sandbox provider's balance rule. Attempt-time balance and historical provider response remain unobserved."
        },
        {
          "id": "obs_request",
          "system": "support",
          "text": "The ticket carries a structured refund request for 4500 usd (minor units)."
        },
        {
          "id": "obs_refund_missing",
          "system": "payments",
          "text": "No refund of any status exists on the named payment ch_mvv2nb2h31sjgy91."
        },
        {
          "id": "obs_sibling_refunded",
          "system": "payments",
          "text": "1 refund(s) totalling 4500 were issued after the ticket was opened on other payment(s) of the same requester: re_mvv2nb6135fd60w5 on ch_mvv2nb3233da8f8y (order ord_mvv2nb2v32ktl8rd, 4500 usd)."
        }
      ],
      "unknowns": [
        "What the customer agent attempted at the time: Veycera has no logs, traces or tool-call history for it.",
        "The payments provider's response to whatever refund request was made, and how the agent derived the amount it sent."
      ],
      "documentation": [
        {
          "title": "Support API",
          "text": "GET /support/tickets?status=resolved|updatedAfter=, GET /support/tickets/:id, POST /support/tickets/:id/approve, POST /support/tickets/:id/resolve {message}. Tickets carry requesterEmail, category, optional orderRef, agentApproved, resolutionMessage, resolvedAt, and for refund requests the structured fields requestedAmountMinor / requestedCurrency."
        },
        {
          "title": "Commerce API",
          "text": "GET /commerce/orders?email=|customerId=, GET /commerce/orders/:id, POST /commerce/orders/:id/cancel. Order status: placed|paid|canceled|fulfilled. A customer may have several orders; email is not unique to an order."
        },
        {
          "title": "Payments API",
          "text": "GET /payments/charges?orderId=|customerId=, GET /payments/charges/:id/refunds, POST /payments/charges/:id/refunds {amountMinor?} (minor units; omitted = remaining balance; amounts above the refundable balance are rejected with 400 amount_exceeds_charge). Refund status: succeeded|pending|failed. A customer may have several charges; one per order."
        },
        {
          "title": "Fulfillment API",
          "text": "GET /fulfillment/shipments?orderId=, GET /fulfillment/shipments/:id/eligibility, POST /fulfillment/shipments/:id/cancel. Cancellation is subject to carrier eligibility and the caller's permissions; rejected requests return 4xx with an error code."
        },
        {
          "title": "Approved cancellation workflow",
          "text": "Support agent approves a cancellation request, cancels the order in commerce, refunds the charge in payments, cancels any pending shipment in fulfillment, then resolves the ticket. The ticket may only be resolved as complete when all steps succeeded."
        },
        {
          "title": "Approved refund workflow",
          "text": "Support agent approves a refund request, looks up the charge of the order named in the ticket, issues one refund for the requested amount (minor units, requested currency) against that charge, then resolves the ticket quoting the refunded amount. The ticket may only be resolved as complete when the provider confirmed the refund."
        }
      ]
    },
    "hypotheses": [
      {
        "id": "h_wrong_order",
        "category": "wrong_object_selected",
        "statement": "The agent refunded a different payment of the same customer because it resolves identity through an ambiguous identifier (such as the email address) instead of the order id quoted in the ticket.",
        "mechanism": "When the customer has several orders the agent acts on a different one than the ticket quotes; with a single order it acts on the right one.",
        "citedObservations": [
          "obs_sibling_refunded",
          "obs_sibling_orders",
          "obs_cond_refund_amount_correct",
          "obs_cond_no_refund_on_other_payments",
          "obs_ticket"
        ],
        "conflictingObservations": [],
        "prediction": "With a single order the workflow passes; with several orders the agent changes an order or payment other than the one quoted in the ticket, while direct API calls on the quoted order pass.",
        "distinguishingExperiment": "The same request with a single order versus several: only the multi-record run acts on the wrong one, while direct calls on the quoted id pass.",
        "sensitivity": "conditional",
        "implementationHypothesis": "Identity is resolved from the requester's email and the most recent match wins, bypassing the quoted order id. Unverified: Veycera does not read the agent's code."
      },
      {
        "id": "h_order_omitted",
        "category": "omitted_operation",
        "statement": "The agent skipped the refund step entirely and resolved the ticket anyway.",
        "mechanism": "The agent resolves the ticket without performing the operation at all, so no record of the customer changes.",
        "citedObservations": [
          "obs_cond_refund_amount_correct",
          "obs_cond_no_refund_on_other_payments",
          "obs_refund_missing",
          "obs_ticket_claims_success",
          "obs_ticket"
        ],
        "conflictingObservations": [
          "obs_sibling_refunded"
        ],
        "prediction": "The quoted order and payment stay unchanged and no other record of the customer changes either, under any conditions.",
        "distinguishingExperiment": "Any run in which a record of the customer visibly changed rules out omission; a benign control that still fails supports it.",
        "sensitivity": "unconditional",
        "implementationHypothesis": null
      },
      {
        "id": "h_state_lag",
        "category": "state_not_propagated",
        "statement": "The operation succeeded upstream but the commerce or payments record has not yet reflected it.",
        "mechanism": "The write succeeded but the read model lagged behind, so the snapshot was taken before the record reflected it.",
        "citedObservations": [
          "obs_order",
          "obs_refunds",
          "obs_cond_refund_amount_correct",
          "obs_cond_no_refund_on_other_payments"
        ],
        "conflictingObservations": [
          "obs_sibling_refunded"
        ],
        "prediction": "Re-reading the records later shows the expected state; sandbox runs pass immediately.",
        "distinguishingExperiment": "Sandbox runs read after the deadline: lag predicts passes everywhere.",
        "sensitivity": "conditional",
        "implementationHypothesis": null
      }
    ],
    "rejectedHypotheses": [],
    "plans": [
      {
        "id": "x_reproduce",
        "purpose": "reproduce",
        "title": "Reproduce under incident-like conditions via the customer agent",
        "factors": {
          "workflow": "refund",
          "requestedAmountMinor": 4500,
          "chargeAmountMinor": 4500,
          "currency": "usd",
          "priorRefunds": [],
          "minutesBeforeDispatch": null,
          "ordersForCustomer": 2,
          "quotedOrderPosition": "oldest",
          "ticketQuotesOrderId": true,
          "actor": "customer_agent",
          "fulfillmentAccess": "granted",
          "providerAvailability": "up"
        },
        "expectations": [
          {
            "hypothesisId": "h_wrong_order",
            "expectedIfTrue": "violated"
          },
          {
            "hypothesisId": "h_order_omitted",
            "expectedIfTrue": "violated"
          },
          {
            "hypothesisId": "h_state_lag",
            "expectedIfTrue": "verified"
          }
        ],
        "rationale": "If the failure is systematic it should recur with the same timing, order count, amount and ticket wording; a transient cause predicts success."
      },
      {
        "id": "x_control",
        "purpose": "control",
        "title": "Benign control: single order, small refund amount, via the customer agent",
        "factors": {
          "workflow": "refund",
          "requestedAmountMinor": 2000,
          "chargeAmountMinor": 4500,
          "currency": "usd",
          "priorRefunds": [],
          "minutesBeforeDispatch": null,
          "ordersForCustomer": 1,
          "quotedOrderPosition": "oldest",
          "ticketQuotesOrderId": true,
          "actor": "customer_agent",
          "fulfillmentAccess": "granted",
          "providerAvailability": "up"
        },
        "expectations": [
          {
            "hypothesisId": "h_wrong_order",
            "expectedIfTrue": "verified"
          },
          {
            "hypothesisId": "h_order_omitted",
            "expectedIfTrue": "violated"
          },
          {
            "hypothesisId": "h_state_lag",
            "expectedIfTrue": "verified"
          }
        ],
        "rationale": "Separates hypotheses that predict failure regardless of conditions (omitted step, missing permission, uniform conversion defect) from those tied to the incident's conditions."
      },
      {
        "id": "x_single_order",
        "purpose": "counterfactual",
        "title": "Same incident, but the customer has only one order",
        "factors": {
          "workflow": "refund",
          "requestedAmountMinor": 4500,
          "chargeAmountMinor": 4500,
          "currency": "usd",
          "priorRefunds": [],
          "minutesBeforeDispatch": null,
          "ordersForCustomer": 1,
          "quotedOrderPosition": "oldest",
          "ticketQuotesOrderId": true,
          "actor": "customer_agent",
          "fulfillmentAccess": "granted",
          "providerAvailability": "up"
        },
        "expectations": [
          {
            "hypothesisId": "h_wrong_order",
            "expectedIfTrue": "verified"
          },
          {
            "hypothesisId": "h_order_omitted",
            "expectedIfTrue": "violated"
          },
          {
            "hypothesisId": "h_state_lag",
            "expectedIfTrue": "verified"
          }
        ],
        "rationale": "One-factor counterfactual: removes identity ambiguity."
      },
      {
        "id": "x_multi_quoted",
        "purpose": "isolate_system",
        "title": "Several orders, ticket quotes the order id explicitly",
        "factors": {
          "workflow": "refund",
          "requestedAmountMinor": 4500,
          "chargeAmountMinor": 4500,
          "currency": "usd",
          "priorRefunds": [],
          "minutesBeforeDispatch": null,
          "ordersForCustomer": 2,
          "quotedOrderPosition": "oldest",
          "ticketQuotesOrderId": true,
          "actor": "customer_agent",
          "fulfillmentAccess": "granted",
          "providerAvailability": "up"
        },
        "expectations": [
          {
            "hypothesisId": "h_wrong_order",
            "expectedIfTrue": "violated"
          },
          {
            "hypothesisId": "h_order_omitted",
            "expectedIfTrue": "violated"
          },
          {
            "hypothesisId": "h_state_lag",
            "expectedIfTrue": "verified"
          }
        ],
        "rationale": "If the agent still changes the wrong record while the id is quoted, it is ignoring the stable identifier."
      },
      {
        "id": "x_direct_multi",
        "purpose": "isolate_system",
        "title": "Several orders, business APIs called directly on the quoted order",
        "factors": {
          "workflow": "refund",
          "requestedAmountMinor": 4500,
          "chargeAmountMinor": 4500,
          "currency": "usd",
          "priorRefunds": [],
          "minutesBeforeDispatch": null,
          "ordersForCustomer": 2,
          "quotedOrderPosition": "oldest",
          "ticketQuotesOrderId": true,
          "actor": "direct_api",
          "fulfillmentAccess": "granted",
          "providerAvailability": "up"
        },
        "expectations": [
          {
            "hypothesisId": "h_wrong_order",
            "expectedIfTrue": "verified"
          },
          {
            "hypothesisId": "h_order_omitted",
            "expectedIfTrue": "verified"
          },
          {
            "hypothesisId": "h_state_lag",
            "expectedIfTrue": "verified"
          }
        ],
        "rationale": "Shows the business systems themselves handle the quoted order and payment correctly."
      },
      {
        "id": "x_reversal",
        "purpose": "reversal",
        "title": "Reverse the intervention: incident conditions restored",
        "factors": {
          "workflow": "refund",
          "requestedAmountMinor": 4500,
          "chargeAmountMinor": 4500,
          "currency": "usd",
          "priorRefunds": [],
          "minutesBeforeDispatch": null,
          "ordersForCustomer": 2,
          "quotedOrderPosition": "oldest",
          "ticketQuotesOrderId": true,
          "actor": "customer_agent",
          "fulfillmentAccess": "granted",
          "providerAvailability": "up"
        },
        "expectations": [
          {
            "hypothesisId": "h_wrong_order",
            "expectedIfTrue": "violated"
          },
          {
            "hypothesisId": "h_order_omitted",
            "expectedIfTrue": "violated"
          },
          {
            "hypothesisId": "h_state_lag",
            "expectedIfTrue": "verified"
          }
        ],
        "rationale": "A verified mechanism must come back when the one changed factor is put back; if it does not, the failure is intermittent and the counterfactual proved nothing."
      }
    ],
    "verdicts": [
      {
        "hypothesisId": "h_wrong_order",
        "status": "supported",
        "supportingExperiments": [
          "x_reproduce",
          "x_control",
          "x_single_order",
          "x_multi_quoted",
          "x_reversal"
        ],
        "contradictingExperiments": [],
        "compatibleExperiments": [
          "x_direct_multi"
        ],
        "mechanismReproduced": true,
        "notSeparatedFrom": [],
        "summary": "Supported by discriminating runs x_reproduce, x_control, x_single_order, x_multi_quoted, x_reversal; its predicted failure was produced in the sandbox; no run contradicted it and every alternative was separated from it (under the sandbox conditions tested)."
      },
      {
        "hypothesisId": "h_order_omitted",
        "status": "contradicted",
        "supportingExperiments": [],
        "contradictingExperiments": [
          "x_reproduce",
          "x_control",
          "x_single_order",
          "x_multi_quoted",
          "x_reversal"
        ],
        "compatibleExperiments": [
          "x_direct_multi"
        ],
        "mechanismReproduced": false,
        "notSeparatedFrom": [],
        "summary": "Contradicted by x_reproduce, x_control, x_single_order, x_multi_quoted, x_reversal, under the sandbox conditions tested."
      },
      {
        "hypothesisId": "h_state_lag",
        "status": "contradicted",
        "supportingExperiments": [
          "x_control",
          "x_single_order"
        ],
        "contradictingExperiments": [
          "x_reproduce",
          "x_multi_quoted",
          "x_reversal"
        ],
        "compatibleExperiments": [
          "x_direct_multi"
        ],
        "mechanismReproduced": false,
        "notSeparatedFrom": [],
        "summary": "Contradicted by x_reproduce, x_multi_quoted, x_reversal (held only in x_control, x_single_order), under the sandbox conditions tested."
      }
    ],
    "report": {
      "classification": "diagnosis_supported",
      "assumptions": [
        "Synthetic payments provider rejects a refund exceeding charge amount less succeeded and pending prior refunds (amount_exceeds_charge).",
        "Historical provider responses, outages, credentials and attempt-time state are unobserved; synthetic provider behavior is an assumption.",
        "Prior refunds are derived only from records timestamped before the request; incomplete or coarse timestamps may omit history.",
        "Synthetic fulfillment cancellation cutoff is 30 minutes unless explicitly changed; current availability and access are controlled factors.",
        "Other orders use synthetic balances; only the named payment's constraints are preserved.",
        "Target version was not supplied; equivalence to the historical target version is unverified."
      ],
      "ladder": [
        {
          "level": "mechanism_reproduced",
          "reached": true,
          "basis": "The failure was produced in the sandbox under incident-like conditions (2 of 2 runs)."
        },
        {
          "level": "diagnosis_supported",
          "reached": true,
          "basis": "h_wrong_order is supported by discriminating runs; the one-factor intervention x_single_order removed the failure; alternatives were contradicted."
        },
        {
          "level": "historical_cause_established",
          "reached": false,
          "basis": "Repeated sandbox failures, reversal and a matching business-state signature do not establish the original execution. Incident-linked evidence is absent."
        }
      ],
      "hypothesisCounts": {
        "supported": 1,
        "contradicted": 2,
        "consistent": 0,
        "untested": 0
      },
      "observedDiscrepancy": "Approved refund is issued correctly: refund_amount_correct, no_refund_on_other_payments unmet for ticket tkt_mvv2nb3p34qkh0sn.",
      "mechanism": "When the customer has several orders the agent acts on a different one than the ticket quotes; with a single order it acts on the right one.",
      "implementationHypothesis": "Identity is resolved from the requester's email and the most recent match wins, bypassing the quoted order id. Unverified: Veycera does not read the agent's code.",
      "scope": {
        "environment": "sandbox",
        "amountsTestedMinor": [
          2000,
          4500
        ],
        "timingsTestedMinutes": [],
        "statement": "Tested only in a disposable sandbox with synthetic records, covering requested amounts 2000, 4500 minor units (currency usd). Values outside this range, other currencies, other customer configurations and the production environment itself were not tested; conclusions do not extend to them."
      },
      "localization": {
        "component": "customer_agent",
        "aspect": "identity resolution: the agent acts on a record other than the one quoted in the ticket (behaviour observed in the sandbox)",
        "confidence": "supported"
      },
      "reproduction": {
        "trials": 2,
        "failures": 2,
        "rate": 1
      },
      "reversal": {
        "experimentId": "x_reversal",
        "restored": true
      },
      "regressionTest": {
        "title": "Approved refund is issued correctly: wrong object selected with customer agent, refund of 4500 minor units, charge 4500 usd; prior refunds 0, 2 order(s) (quoted order is the oldest), order id quoted",
        "filename": "tests/regression/ctr-refund-executed-yc-recording-v1.test.ts",
        "code": "/**\n * Generated by Veycera from an investigation of \"Approved refund is issued correctly\".\n * Evidence level at generation: diagnosis supported.\n * Historical attribution is unverified; sandbox reproduction does not prove the original execution.\n * Contract snapshot: ctr_refund_executed_yc-recording-v1, version 1.\n * Mechanism (sandbox-observed): When the customer has several orders the agent acts on a different one than the ticket quotes; with a single order it acts on the right one.\n *\n * Target: YOUR agent, reached over HTTP at VEYCERA_AGENT_URL. The test seeds\n * the failing conditions in a disposable Veycera sandbox, sends the synthetic\n * ticket to that endpoint and asserts the outcome contract against the\n * sandbox's business records. It fails until the defect is fixed, and it\n * refuses to run against anything but an explicitly configured target.\n * Runs inside the Veycera platform package (it uses its sandbox harness);\n * it does not import or inspect your agent's code.\n * Required: VEYCERA_REGRESSION_SQLITE_PATH is an absolute path to a dedicated,\n * disposable SQLite harness shared with the intended agent. Configure that\n * agent's VEYCERA_SQLITE_PATH to the same file. A private in-memory database\n * cannot be read by an HTTP agent. Never point this harness at production.\n * SIM_API_TOKEN is forwarded only to the explicitly configured agent target.\n */\nimport { describe, expect, it } from \"vitest\";\nimport { isAbsolute } from \"node:path\";\nimport { createCausalRuntime } from \"@/lib/causal/runtime\";\nimport { SandboxLab } from \"@/lib/causal/rca/sandbox\";\nimport { experimentFactorsSchema, type ExperimentFactors } from \"@/lib/causal/rca/types\";\nimport { outcomeContractSchema } from \"@/lib/causal/contracts/schema\";\n\nconst CONTRACT = outcomeContractSchema.parse({\"id\":\"ctr_refund_executed_yc-recording-v1\",\"tenantId\":\"yc-recording-v1\",\"name\":\"Approved refund is issued correctly\",\"description\":\"When the support agent approves a refund request and resolves the ticket, the payment for the order named in the ticket must carry a succeeded refund for exactly the requested amount, in the requested currency, within two minutes. Refunds on other payments of the same customer do not count.\",\"version\":1,\"trigger\":{\"object\":\"ticket\",\"categories\":[\"refund\"],\"status\":\"resolved\",\"requiresAgentApproval\":true},\"identifiers\":{\"order\":{\"source\":\"ticket.orderRef\",\"required\":true}},\"conditions\":[{\"path\":\"refunds.succeededMinor\",\"op\":\"eq\",\"ref\":\"ticket.requestedAmountMinor\",\"id\":\"refund_amount_correct\",\"description\":\"Succeeded refunds on the named payment equal the requested amount\",\"applicableWhen\":[{\"path\":\"charge.exists\",\"op\":\"eq\",\"value\":true},{\"path\":\"ticket.requestedAmountMinor\",\"op\":\"neq\",\"value\":null}]},{\"path\":\"refunds.succeededMinor\",\"op\":\"eq\",\"ref\":\"charge.amountMinor\",\"id\":\"refund_full_when_unspecified\",\"description\":\"Without a requested amount, the payment is refunded in full\",\"applicableWhen\":[{\"path\":\"charge.exists\",\"op\":\"eq\",\"value\":true},{\"path\":\"ticket.requestedAmountMinor\",\"op\":\"eq\",\"value\":null}]},{\"path\":\"charge.currency\",\"op\":\"eq\",\"ref\":\"ticket.requestedCurrency\",\"id\":\"refund_currency_matches\",\"description\":\"The payment's currency matches the requested currency\",\"applicableWhen\":[{\"path\":\"charge.exists\",\"op\":\"eq\",\"value\":true},{\"path\":\"ticket.requestedCurrency\",\"op\":\"neq\",\"value\":null}]},{\"path\":\"refunds.count\",\"op\":\"lte\",\"value\":1,\"id\":\"refund_single\",\"description\":\"At most one refund was issued against the payment\",\"applicableWhen\":[{\"path\":\"charge.exists\",\"op\":\"eq\",\"value\":true}]},{\"path\":\"siblingRefunds.sinceTicketMinor\",\"op\":\"eq\",\"value\":0,\"id\":\"no_refund_on_other_payments\",\"description\":\"No other payment of the customer was refunded for this request\",\"applicableWhen\":[]}],\"instance\":{\"eventTypes\":[\"ticket.resolved\"],\"initialRetrySeconds\":30,\"maxRetrySeconds\":600,\"maxAgeSeconds\":86400},\"deadlineSeconds\":120,\"severity\":\"high\",\"approved\":true,\"approvedAt\":\"2026-10-30T14:32:32.938Z\",\"enabled\":true,\"draftedBy\":\"template\",\"provenance\":{\"sources\":[{\"kind\":\"customer_request\",\"ref\":\"onboarding instruction\",\"excerpt\":\"Approved refunds must land on the named payment for exactly the requested amount.\"},{\"kind\":\"policy_document\",\"ref\":\"Approved refund workflow\",\"excerpt\":\"issues one refund for the requested amount (minor units, requested currency) against that charge\"},{\"kind\":\"api_schema\",\"ref\":\"Support API (requestedAmountMinor, requestedCurrency), Payments API\"}],\"assumptions\":[\"A request without a structured amount means a full refund of the payment.\",\"Split refunds are not allowed: at most one refund per payment per request.\",\"Tickets resolved without agent approval (declined or escalated requests) are not monitored.\"]},\"createdAt\":\"2026-10-30T14:32:32.938Z\",\"updatedAt\":\"2026-10-30T14:32:32.938Z\"});\nconst FAILING_CONDITIONS = [\"refund_amount_correct\",\"no_refund_on_other_payments\"];\nconst AGENT_URL = process.env.VEYCERA_AGENT_URL;\nconst HARNESS_PATH = process.env.VEYCERA_REGRESSION_SQLITE_PATH;\nconst EXPECTED_AGENT_VERSION = null;\n\nasync function runWorkflow(factors: ExperimentFactors) {\n  if (!AGENT_URL) throw new Error(\"VEYCERA_AGENT_URL is not set. This regression test must target your agent's endpoint; it will not fall back to Veycera's example agent.\");\n  if (!HARNESS_PATH || HARNESS_PATH === \":memory:\" || !isAbsolute(HARNESS_PATH)) throw new Error(\"VEYCERA_REGRESSION_SQLITE_PATH must be an absolute path to a dedicated disposable SQLite file shared with the intended agent. Configure the agent's VEYCERA_SQLITE_PATH to the same file; private in-memory and production configuration fallbacks are refused.\");\n  if (EXPECTED_AGENT_VERSION && process.env.VEYCERA_AGENT_VERSION !== EXPECTED_AGENT_VERSION) throw new Error(\"VEYCERA_AGENT_VERSION must identify the intended tested target version.\");\n  const f = experimentFactorsSchema.parse(factors);\n  const rt = await createCausalRuntime({ sqlitePath: HARNESS_PATH, agentUrl: AGENT_URL, access: { mode: \"deterministic\", reason: \"regression test\" }, env: { SIM_API_TOKEN: process.env.SIM_API_TOKEN, VEYCERA_AGENT_VERSION: process.env.VEYCERA_AGENT_VERSION } as NodeJS.ProcessEnv });\n  const lab = new SandboxLab(rt.sql, rt.envs, rt.tenantId, rt.agentFor);\n  try {\n    const contract = CONTRACT; // immutable evaluated policy, independent of today's stored contract\n    const env = await lab.create(\"regression\", f);\n    const fixture = await lab.seed(env.id, f);\n    await lab.act(env.id, f, fixture);\n    const { evaluation } = await lab.read(env.id, contract, fixture);\n    return evaluation;\n  } finally {\n    try { await lab.disposeAll(); } finally { await rt.close(); }\n  }\n}\n\ndescribe(\"regression: Approved refund is issued correctly\", () => {\n  it(\"Approved refund is issued correctly: wrong object selected with customer agent, refund of 4500 minor units, charge 4500 usd; prior refunds 0, 2 order(s) (quoted order is the oldest), order id quoted\", async () => {\n    const evaluation = await runWorkflow({\"workflow\":\"refund\",\"requestedAmountMinor\":4500,\"chargeAmountMinor\":4500,\"currency\":\"usd\",\"priorRefunds\":[],\"minutesBeforeDispatch\":null,\"ordersForCustomer\":2,\"quotedOrderPosition\":\"oldest\",\"ticketQuotesOrderId\":true,\"actor\":\"customer_agent\",\"fulfillmentAccess\":\"granted\",\"providerAvailability\":\"up\"});\n    for (const id of FAILING_CONDITIONS) expect(evaluation.conditions.find((c) => c.id === id)?.status, id).toBe(\"satisfied\");\n    expect(evaluation.status).toBe(\"verified\");\n  });\n\n  it(\"passing control: customer agent, refund of 4500 minor units, charge 4500 usd; prior refunds 0, 1 order(s), order id quoted (the one-factor intervention that removed the failure)\", async () => {\n    const evaluation = await runWorkflow({\"workflow\":\"refund\",\"requestedAmountMinor\":4500,\"chargeAmountMinor\":4500,\"currency\":\"usd\",\"priorRefunds\":[],\"minutesBeforeDispatch\":null,\"ordersForCustomer\":1,\"quotedOrderPosition\":\"oldest\",\"ticketQuotesOrderId\":true,\"actor\":\"customer_agent\",\"fulfillmentAccess\":\"granted\",\"providerAvailability\":\"up\"});\n    expect(evaluation.status).toBe(\"verified\");\n  });\n});\n"
      },
      "failedOutcome": "Approved refund is issued correctly: refund_amount_correct, no_refund_on_other_payments unmet for ticket tkt_mvv2nb3p34qkh0sn.",
      "systemsAffected": [
        "support",
        "payments"
      ],
      "rootCause": "Supported under the tested sandbox assumptions: The agent refunded a different payment of the same customer because it resolves identity through an ambiguous identifier (such as the email address) instead of the order id quoted in the ticket. In 3 of 3 failing agent run(s), its completion message disagreed with the observed outcome. Historical attribution remains unverified.",
      "reproducibleConditions": [
        "Fails with customer agent, refund of 4500 minor units, charge 4500 usd; prior refunds 0, 2 order(s) (quoted order is the oldest), order id quoted.",
        "Passes with customer agent, refund of 4500 minor units, charge 4500 usd; prior refunds 0, 1 order(s), order id quoted (only the changed factor differs).",
        "In 3 of 3 failing agent run(s), the agent resolved the ticket with a completion message.",
        "In 3 run(s) the agent changed a different payment than the one quoted in the ticket.",
        "Under the incident's conditions the failure appeared in 2 of 2 runs (including the reversal run, which restored it)."
      ],
      "experimentsExecuted": 6,
      "evidence": [
        "x_reproduce: customer agent, refund of 4500 minor units, charge 4500 usd; prior refunds 0, 2 order(s) (quoted order is the oldest), order id quoted → Contract violated; the agent reported completion anyway; the payment refunded belongs to order ord_mvv2nbwe3kqo194b, not the quoted ord_mvv2nbvs3ilv7yhf.",
        "x_control: customer agent, refund of 2000 minor units, charge 4500 usd; prior refunds 0, 1 order(s), order id quoted → Contract verified.",
        "x_single_order: customer agent, refund of 4500 minor units, charge 4500 usd; prior refunds 0, 1 order(s), order id quoted → Contract verified.",
        "x_multi_quoted: customer agent, refund of 4500 minor units, charge 4500 usd; prior refunds 0, 2 order(s) (quoted order is the oldest), order id quoted → Contract violated; the agent reported completion anyway; the payment refunded belongs to order ord_mvv2ncyb44oc5ohy, not the quoted ord_mvv2ncxp42g5ovfs.",
        "x_direct_multi: direct API, refund of 4500 minor units, charge 4500 usd; prior refunds 0, 2 order(s) (quoted order is the oldest), order id quoted → Contract verified.",
        "x_reversal: customer agent, refund of 4500 minor units, charge 4500 usd; prior refunds 0, 2 order(s) (quoted order is the oldest), order id quoted → Contract violated; the agent reported completion anyway; the payment refunded belongs to order ord_mvv2ndnr4k3mhvnx, not the quoted ord_mvv2ndn34iui6bvd."
      ],
      "alternativesRuledOut": [
        {
          "hypothesisId": "h_order_omitted",
          "statement": "The agent skipped the refund step entirely and resolved the ticket anyway.",
          "because": "Contradicted by x_reproduce, x_control, x_single_order, x_multi_quoted, x_reversal, under the sandbox conditions tested."
        },
        {
          "hypothesisId": "h_state_lag",
          "statement": "The operation succeeded upstream but the commerce or payments record has not yet reflected it.",
          "because": "Contradicted by x_reproduce, x_multi_quoted, x_reversal (held only in x_control, x_single_order), under the sandbox conditions tested."
        }
      ],
      "remediation": [
        "Resolve the order and its payment from the stable identifier quoted in the ticket (orderRef), never from the requester's email alone.",
        "When several records match and none is quoted, ask the customer which one they mean instead of picking the most recent.",
        "Verify the order and payment ids in the confirmation message match the ticket before resolving."
      ],
      "unknowns": [
        "What the customer agent attempted at the time: Veycera has no logs, traces or tool-call history for it.",
        "The payments provider's response to whatever refund request was made, and how the agent derived the amount it sent.",
        "The historical run itself was not observed: Veycera has no logs, traces or execution history of the agent, only the business records and the sandbox runs it executed.",
        "Even repeated failures, a successful intervention, reversal and a matching business-state signature cannot establish the historical execution. Another mechanism with the same signature remains possible without incident-linked evidence.",
        "Tested only in a disposable sandbox with synthetic records, covering requested amounts 2000, 4500 minor units (currency usd). Values outside this range, other currencies, other customer configurations and the production environment itself were not tested; conclusions do not extend to them."
      ],
      "boundary": null,
      "amountMapping": [
        {
          "requestedMinor": 2000,
          "issuedMinor": 2000,
          "experimentId": "x_control"
        },
        {
          "requestedMinor": 4500,
          "issuedMinor": 4500,
          "experimentId": "x_single_order"
        }
      ]
    },
    "log": [
      {
        "at": "2026-10-30T14:32:41.598Z",
        "message": "Collected 15 observations; failed conditions: refund_amount_correct, no_refund_on_other_payments."
      },
      {
        "at": "2026-10-30T14:32:41.615Z",
        "message": "3 hypotheses accepted, 0 rejected by validation."
      },
      {
        "at": "2026-10-30T14:32:41.632Z",
        "message": "Planned 5 initial experiments."
      },
      {
        "at": "2026-10-30T14:32:42.119Z",
        "message": "x_reproduce: Contract violated; the agent reported completion anyway; the payment refunded belongs to order ord_mvv2nbwe3kqo194b, not the quoted ord_mvv2nbvs3ilv7yhf."
      },
      {
        "at": "2026-10-30T14:32:42.557Z",
        "message": "x_control: Contract verified."
      },
      {
        "at": "2026-10-30T14:32:43.002Z",
        "message": "x_single_order: Contract verified."
      },
      {
        "at": "2026-10-30T14:32:43.484Z",
        "message": "x_multi_quoted: Contract violated; the agent reported completion anyway; the payment refunded belongs to order ord_mvv2ncyb44oc5ohy, not the quoted ord_mvv2ncxp42g5ovfs."
      },
      {
        "at": "2026-10-30T14:32:43.912Z",
        "message": "x_direct_multi: Contract verified."
      },
      {
        "at": "2026-10-30T14:32:44.395Z",
        "message": "x_reversal: Contract violated; the agent reported completion anyway; the payment refunded belongs to order ord_mvv2ndnr4k3mhvnx, not the quoted ord_mvv2ndn34iui6bvd."
      },
      {
        "at": "2026-10-30T14:32:44.438Z",
        "message": "Report: diagnosis_supported."
      }
    ],
    "usage": {
      "inputTokens": 0,
      "outputTokens": 0,
      "calls": 0,
      "estimatedCostUsd": 0
    },
    "startedAt": "2026-10-30T14:32:41.558Z",
    "finishedAt": "2026-10-30T14:32:44.415Z",
    "durationMs": 2857,
    "error": null,
    "provenance": {
      "capturedAt": "2026-10-30T14:32:41.558Z",
      "outcomeId": "out_mvv2nbbz385j2rdt",
      "outcomeCheckedAt": "2026-10-30T14:38:41.162Z",
      "contract": {
        "id": "ctr_refund_executed_yc-recording-v1",
        "tenantId": "yc-recording-v1",
        "name": "Approved refund is issued correctly",
        "description": "When the support agent approves a refund request and resolves the ticket, the payment for the order named in the ticket must carry a succeeded refund for exactly the requested amount, in the requested currency, within two minutes. Refunds on other payments of the same customer do not count.",
        "version": 1,
        "trigger": {
          "object": "ticket",
          "categories": [
            "refund"
          ],
          "status": "resolved",
          "requiresAgentApproval": true
        },
        "identifiers": {
          "order": {
            "source": "ticket.orderRef",
            "required": true
          }
        },
        "conditions": [
          {
            "path": "refunds.succeededMinor",
            "op": "eq",
            "ref": "ticket.requestedAmountMinor",
            "id": "refund_amount_correct",
            "description": "Succeeded refunds on the named payment equal the requested amount",
            "applicableWhen": [
              {
                "path": "charge.exists",
                "op": "eq",
                "value": true
              },
              {
                "path": "ticket.requestedAmountMinor",
                "op": "neq",
                "value": null
              }
            ]
          },
          {
            "path": "refunds.succeededMinor",
            "op": "eq",
            "ref": "charge.amountMinor",
            "id": "refund_full_when_unspecified",
            "description": "Without a requested amount, the payment is refunded in full",
            "applicableWhen": [
              {
                "path": "charge.exists",
                "op": "eq",
                "value": true
              },
              {
                "path": "ticket.requestedAmountMinor",
                "op": "eq",
                "value": null
              }
            ]
          },
          {
            "path": "charge.currency",
            "op": "eq",
            "ref": "ticket.requestedCurrency",
            "id": "refund_currency_matches",
            "description": "The payment's currency matches the requested currency",
            "applicableWhen": [
              {
                "path": "charge.exists",
                "op": "eq",
                "value": true
              },
              {
                "path": "ticket.requestedCurrency",
                "op": "neq",
                "value": null
              }
            ]
          },
          {
            "path": "refunds.count",
            "op": "lte",
            "value": 1,
            "id": "refund_single",
            "description": "At most one refund was issued against the payment",
            "applicableWhen": [
              {
                "path": "charge.exists",
                "op": "eq",
                "value": true
              }
            ]
          },
          {
            "path": "siblingRefunds.sinceTicketMinor",
            "op": "eq",
            "value": 0,
            "id": "no_refund_on_other_payments",
            "description": "No other payment of the customer was refunded for this request",
            "applicableWhen": []
          }
        ],
        "instance": {
          "eventTypes": [
            "ticket.resolved"
          ],
          "initialRetrySeconds": 30,
          "maxRetrySeconds": 600,
          "maxAgeSeconds": 86400
        },
        "deadlineSeconds": 120,
        "severity": "high",
        "approved": true,
        "approvedAt": "2026-10-30T14:32:32.938Z",
        "enabled": true,
        "draftedBy": "template",
        "provenance": {
          "sources": [
            {
              "kind": "customer_request",
              "ref": "onboarding instruction",
              "excerpt": "Approved refunds must land on the named payment for exactly the requested amount."
            },
            {
              "kind": "policy_document",
              "ref": "Approved refund workflow",
              "excerpt": "issues one refund for the requested amount (minor units, requested currency) against that charge"
            },
            {
              "kind": "api_schema",
              "ref": "Support API (requestedAmountMinor, requestedCurrency), Payments API"
            }
          ],
          "assumptions": [
            "A request without a structured amount means a full refund of the payment.",
            "Split refunds are not allowed: at most one refund per payment per request.",
            "Tickets resolved without agent approval (declined or escalated requests) are not monitored."
          ]
        },
        "createdAt": "2026-10-30T14:32:32.938Z",
        "updatedAt": "2026-10-30T14:32:32.938Z"
      },
      "contractVersion": 1,
      "contractSource": "captured_version",
      "approvalAtEvaluation": "2026-10-30T14:32:32.938Z",
      "evaluation": {
        "status": "violated",
        "reason": "Deadline passed with refund_amount_correct, no_refund_on_other_payments unmet.",
        "deadlineAt": "2026-10-30T14:37:40.812Z",
        "evaluatedAt": "2026-10-30T14:38:41.162Z",
        "conditions": [
          {
            "id": "refund_amount_correct",
            "description": "Succeeded refunds on the named payment equal the requested amount",
            "observed": 0,
            "expected": "refunds.succeededMinor eq ticket.requestedAmountMinor",
            "path": "refunds.succeededMinor",
            "status": "violated"
          },
          {
            "id": "refund_full_when_unspecified",
            "description": "Without a requested amount, the payment is refunded in full",
            "observed": 0,
            "expected": "refunds.succeededMinor eq charge.amountMinor",
            "path": "refunds.succeededMinor",
            "status": "not_applicable",
            "inapplicableBecause": "ticket.requestedAmountMinor eq null"
          },
          {
            "id": "refund_currency_matches",
            "description": "The payment's currency matches the requested currency",
            "observed": "usd",
            "expected": "charge.currency eq ticket.requestedCurrency",
            "path": "charge.currency",
            "status": "satisfied"
          },
          {
            "id": "refund_single",
            "description": "At most one refund was issued against the payment",
            "observed": 0,
            "expected": "refunds.count lte 1",
            "path": "refunds.count",
            "status": "satisfied"
          },
          {
            "id": "no_refund_on_other_payments",
            "description": "No other payment of the customer was refunded for this request",
            "observed": 4500,
            "expected": "siblingRefunds.sinceTicketMinor eq 0",
            "path": "siblingRefunds.sinceTicketMinor",
            "status": "violated"
          }
        ]
      },
      "businessSnapshot": {
        "envId": "prod_yc-recording-v1",
        "capturedAt": "2026-10-30T14:38:41.244Z",
        "ticket": {
          "id": "tkt_mvv2nb3p34qkh0sn",
          "customerId": "cus_mvv2nb1t2z9p5yrs",
          "requesterEmail": "theo.mvv2nb1m@example.com",
          "subject": "Refund request",
          "body": "Hi, please refund $45.00 for order ord_mvv2nb29301zuqna. The item arrived damaged.",
          "category": "refund",
          "orderRef": "ord_mvv2nb29301zuqna",
          "status": "resolved",
          "agentApproved": true,
          "resolutionMessage": "We've refunded $45.00 to your original payment method for order ord_mvv2nb2v32ktl8rd. It should appear within 5-10 business days.",
          "createdAt": "2026-10-30T14:35:40.686Z",
          "updatedAt": "2026-10-30T14:35:40.812Z",
          "resolvedAt": "2026-10-30T14:35:40.812Z",
          "requestedAmountMinor": 4500,
          "requestedCurrency": "usd"
        },
        "order": {
          "id": "ord_mvv2nb29301zuqna",
          "customerId": "cus_mvv2nb1t2z9p5yrs",
          "status": "paid",
          "totalMinor": 4500,
          "currency": "usd",
          "createdAt": "2026-10-27T14:35:40.618Z",
          "updatedAt": "2026-10-27T14:35:40.618Z"
        },
        "charge": {
          "id": "ch_mvv2nb2h31sjgy91",
          "orderId": "ord_mvv2nb29301zuqna",
          "customerId": "cus_mvv2nb1t2z9p5yrs",
          "amountMinor": 4500,
          "currency": "usd",
          "status": "succeeded",
          "createdAt": "2026-10-30T14:35:40.649Z"
        },
        "refunds": [],
        "refundSummary": {
          "count": 0,
          "succeededMinor": 0,
          "pendingMinor": 0,
          "latestStatus": null
        },
        "shipment": null,
        "siblingOrders": [
          {
            "id": "ord_mvv2nb2v32ktl8rd",
            "customerId": "cus_mvv2nb1t2z9p5yrs",
            "status": "paid",
            "totalMinor": 8000,
            "currency": "usd",
            "createdAt": "2026-10-29T14:35:40.618Z",
            "updatedAt": "2026-10-29T14:35:40.618Z"
          }
        ],
        "siblingCharges": [
          {
            "id": "ch_mvv2nb3233da8f8y",
            "orderId": "ord_mvv2nb2v32ktl8rd",
            "customerId": "cus_mvv2nb1t2z9p5yrs",
            "amountMinor": 8000,
            "currency": "usd",
            "status": "partially_refunded",
            "createdAt": "2026-10-30T14:35:40.670Z"
          }
        ],
        "siblingRefunds": [
          {
            "refundId": "re_mvv2nb6135fd60w5",
            "chargeId": "ch_mvv2nb3233da8f8y",
            "orderId": "ord_mvv2nb2v32ktl8rd",
            "amountMinor": 4500,
            "currency": "usd",
            "status": "succeeded",
            "createdAt": "2026-10-30T14:35:40.777Z"
          }
        ],
        "siblingRefundSummary": {
          "count": 1,
          "sinceTicketCount": 1,
          "sinceTicketMinor": 4500
        },
        "missing": []
      },
      "target": {
        "kind": "in_process",
        "endpoint": "example-support-agent",
        "version": null
      },
      "environmentAssumptions": [
        "Disposable synthetic sandbox; business-state constraints are recorded per experiment.",
        "Agent target version is unknown unless explicitly supplied; an endpoint alone does not establish historical code identity.",
        "Provider rules are simulated, not evidence of a historical provider response."
      ]
    }
  },
  "cancelRequested": false,
  "createdAt": "2026-10-30T14:32:41.558Z",
  "updatedAt": "2026-10-30T14:32:44.446Z",
  "experiments": [
    {
      "seq": 1,
      "plan": {
        "id": "x_reproduce",
        "purpose": "reproduce",
        "title": "Reproduce under incident-like conditions via the customer agent",
        "factors": {
          "workflow": "refund",
          "requestedAmountMinor": 4500,
          "chargeAmountMinor": 4500,
          "currency": "usd",
          "priorRefunds": [],
          "minutesBeforeDispatch": null,
          "ordersForCustomer": 2,
          "quotedOrderPosition": "oldest",
          "ticketQuotesOrderId": true,
          "actor": "customer_agent",
          "fulfillmentAccess": "granted",
          "providerAvailability": "up"
        },
        "expectations": [
          {
            "hypothesisId": "h_wrong_order",
            "expectedIfTrue": "violated"
          },
          {
            "hypothesisId": "h_order_omitted",
            "expectedIfTrue": "violated"
          },
          {
            "hypothesisId": "h_state_lag",
            "expectedIfTrue": "verified"
          }
        ],
        "rationale": "If the failure is systematic it should recur with the same timing, order count, amount and ticket wording; a transient cause predicts success."
      },
      "result": {
        "sandboxEnvId": "sbx_mvv2nbuh3gdnae2a",
        "startedAt": "2026-10-30T14:32:41.657Z",
        "finishedAt": "2026-10-30T14:32:42.028Z",
        "manifest": {
          "target": {
            "kind": "in_process",
            "endpoint": "example-support-agent",
            "version": null
          },
          "chargeAmountMinor": 4500,
          "refundableBalanceMinor": 4500,
          "currency": "usd",
          "priorRefunds": [],
          "requestedAmountMinor": 4500,
          "providerAssumptions": [
            "Synthetic payments provider rejects a refund exceeding charge amount less succeeded and pending prior refunds (amount_exceeds_charge).",
            "Historical provider responses, outages, credentials and attempt-time state are unobserved; synthetic provider behavior is an assumption.",
            "Prior refunds are derived only from records timestamped before the request; incomplete or coarse timestamps may omit history.",
            "Synthetic fulfillment cancellation cutoff is 30 minutes unless explicitly changed; current availability and access are controlled factors."
          ],
          "fidelity": "constraints_preserved",
          "limitations": [
            "Other orders use synthetic balances; only the named payment's constraints are preserved.",
            "Target version was not supplied; equivalence to the historical target version is unverified."
          ]
        },
        "evaluation": {
          "status": "violated",
          "reason": "Deadline passed with refund_amount_correct, no_refund_on_other_payments unmet.",
          "deadlineAt": "2026-10-30T14:34:41.902Z",
          "evaluatedAt": "2026-10-30T14:34:42.993Z",
          "conditions": [
            {
              "id": "refund_amount_correct",
              "description": "Succeeded refunds on the named payment equal the requested amount",
              "observed": 0,
              "expected": "refunds.succeededMinor eq ticket.requestedAmountMinor",
              "path": "refunds.succeededMinor",
              "status": "violated"
            },
            {
              "id": "refund_full_when_unspecified",
              "description": "Without a requested amount, the payment is refunded in full",
              "observed": 0,
              "expected": "refunds.succeededMinor eq charge.amountMinor",
              "path": "refunds.succeededMinor",
              "status": "not_applicable",
              "inapplicableBecause": "ticket.requestedAmountMinor eq null"
            },
            {
              "id": "refund_currency_matches",
              "description": "The payment's currency matches the requested currency",
              "observed": "usd",
              "expected": "charge.currency eq ticket.requestedCurrency",
              "path": "charge.currency",
              "status": "satisfied"
            },
            {
              "id": "refund_single",
              "description": "At most one refund was issued against the payment",
              "observed": 0,
              "expected": "refunds.count lte 1",
              "path": "refunds.count",
              "status": "satisfied"
            },
            {
              "id": "no_refund_on_other_payments",
              "description": "No other payment of the customer was refunded for this request",
              "observed": 4500,
              "expected": "siblingRefunds.sinceTicketMinor eq 0",
              "path": "siblingRefunds.sinceTicketMinor",
              "status": "violated"
            }
          ]
        },
        "observedState": {
          "orderStatus": "paid",
          "refundedMinor": 0,
          "shipmentStatus": null,
          "ticketStatus": "resolved",
          "ticketMessage": "We've refunded $45.00 to your original payment method for order ord_mvv2nbwe3kqo194b. It should appear within 5-10 business days.",
          "targetOrderId": "ord_mvv2nbvs3ilv7yhf",
          "orderActedOn": "ord_mvv2nbwe3kqo194b",
          "agentClaimedSuccess": true,
          "requestedMinor": 4500,
          "chargeAmountMinor": 4500,
          "refundOnOtherChargeMinor": 4500
        },
        "directCalls": [],
        "agentResponse": {
          "status": "resolved",
          "message": "We've refunded $45.00 to your original payment method for order ord_mvv2nbwe3kqo194b. It should appear within 5-10 business days."
        }
      },
      "verdicts": [
        {
          "hypothesisId": "h_wrong_order",
          "effect": "supports",
          "discriminatesFrom": [
            "h_order_omitted",
            "h_state_lag"
          ],
          "because": "predicted violated, observed violated, while the prediction of h_order_omitted, h_state_lag failed"
        },
        {
          "hypothesisId": "h_order_omitted",
          "effect": "contradicts",
          "discriminatesFrom": [],
          "because": "predicted violated, observed violated, but the operation did run (on ord_mvv2nbwe3kqo194b), so it was not omitted"
        },
        {
          "hypothesisId": "h_state_lag",
          "effect": "contradicts",
          "discriminatesFrom": [],
          "because": "predicted verified, observed violated"
        }
      ],
      "conclusion": "Contract violated; the agent reported completion anyway; the payment refunded belongs to order ord_mvv2nbwe3kqo194b, not the quoted ord_mvv2nbvs3ilv7yhf.",
      "error": null
    },
    {
      "seq": 2,
      "plan": {
        "id": "x_control",
        "purpose": "control",
        "title": "Benign control: single order, small refund amount, via the customer agent",
        "factors": {
          "workflow": "refund",
          "requestedAmountMinor": 2000,
          "chargeAmountMinor": 4500,
          "currency": "usd",
          "priorRefunds": [],
          "minutesBeforeDispatch": null,
          "ordersForCustomer": 1,
          "quotedOrderPosition": "oldest",
          "ticketQuotesOrderId": true,
          "actor": "customer_agent",
          "fulfillmentAccess": "granted",
          "providerAvailability": "up"
        },
        "expectations": [
          {
            "hypothesisId": "h_wrong_order",
            "expectedIfTrue": "verified"
          },
          {
            "hypothesisId": "h_order_omitted",
            "expectedIfTrue": "violated"
          },
          {
            "hypothesisId": "h_state_lag",
            "expectedIfTrue": "verified"
          }
        ],
        "rationale": "Separates hypotheses that predict failure regardless of conditions (omitted step, missing permission, uniform conversion defect) from those tied to the incident's conditions."
      },
      "result": {
        "sandboxEnvId": "sbx_mvv2nc813owjr03v",
        "startedAt": "2026-10-30T14:32:42.145Z",
        "finishedAt": "2026-10-30T14:32:42.465Z",
        "manifest": {
          "target": {
            "kind": "in_process",
            "endpoint": "example-support-agent",
            "version": null
          },
          "chargeAmountMinor": 4500,
          "refundableBalanceMinor": 4500,
          "currency": "usd",
          "priorRefunds": [],
          "requestedAmountMinor": 2000,
          "providerAssumptions": [
            "Synthetic payments provider rejects a refund exceeding charge amount less succeeded and pending prior refunds (amount_exceeds_charge).",
            "Historical provider responses, outages, credentials and attempt-time state are unobserved; synthetic provider behavior is an assumption.",
            "Prior refunds are derived only from records timestamped before the request; incomplete or coarse timestamps may omit history.",
            "Synthetic fulfillment cancellation cutoff is 30 minutes unless explicitly changed; current availability and access are controlled factors."
          ],
          "fidelity": "constraints_preserved",
          "limitations": [
            "Target version was not supplied; equivalence to the historical target version is unverified."
          ]
        },
        "evaluation": {
          "status": "verified",
          "reason": "Every applicable condition holds in the systems of record.",
          "deadlineAt": "2026-10-30T14:34:42.364Z",
          "evaluatedAt": "2026-10-30T14:34:43.443Z",
          "conditions": [
            {
              "id": "refund_amount_correct",
              "description": "Succeeded refunds on the named payment equal the requested amount",
              "observed": 2000,
              "expected": "refunds.succeededMinor eq ticket.requestedAmountMinor",
              "path": "refunds.succeededMinor",
              "status": "satisfied"
            },
            {
              "id": "refund_full_when_unspecified",
              "description": "Without a requested amount, the payment is refunded in full",
              "observed": 2000,
              "expected": "refunds.succeededMinor eq charge.amountMinor",
              "path": "refunds.succeededMinor",
              "status": "not_applicable",
              "inapplicableBecause": "ticket.requestedAmountMinor eq null"
            },
            {
              "id": "refund_currency_matches",
              "description": "The payment's currency matches the requested currency",
              "observed": "usd",
              "expected": "charge.currency eq ticket.requestedCurrency",
              "path": "charge.currency",
              "status": "satisfied"
            },
            {
              "id": "refund_single",
              "description": "At most one refund was issued against the payment",
              "observed": 1,
              "expected": "refunds.count lte 1",
              "path": "refunds.count",
              "status": "satisfied"
            },
            {
              "id": "no_refund_on_other_payments",
              "description": "No other payment of the customer was refunded for this request",
              "observed": 0,
              "expected": "siblingRefunds.sinceTicketMinor eq 0",
              "path": "siblingRefunds.sinceTicketMinor",
              "status": "satisfied"
            }
          ]
        },
        "observedState": {
          "orderStatus": "paid",
          "refundedMinor": 2000,
          "shipmentStatus": null,
          "ticketStatus": "resolved",
          "ticketMessage": "We've refunded $20.00 to your original payment method for order ord_mvv2nc9a3q3hfilo. It should appear within 5-10 business days.",
          "targetOrderId": "ord_mvv2nc9a3q3hfilo",
          "orderActedOn": "ord_mvv2nc9a3q3hfilo",
          "agentClaimedSuccess": true,
          "requestedMinor": 2000,
          "chargeAmountMinor": 4500,
          "refundOnOtherChargeMinor": 0
        },
        "directCalls": [],
        "agentResponse": {
          "status": "resolved",
          "message": "We've refunded $20.00 to your original payment method for order ord_mvv2nc9a3q3hfilo. It should appear within 5-10 business days."
        }
      },
      "verdicts": [
        {
          "hypothesisId": "h_wrong_order",
          "effect": "supports",
          "discriminatesFrom": [
            "h_order_omitted"
          ],
          "because": "predicted verified, observed verified, while the prediction of h_order_omitted failed"
        },
        {
          "hypothesisId": "h_order_omitted",
          "effect": "contradicts",
          "discriminatesFrom": [],
          "because": "predicted violated, observed verified"
        },
        {
          "hypothesisId": "h_state_lag",
          "effect": "supports",
          "discriminatesFrom": [
            "h_order_omitted"
          ],
          "because": "predicted verified, observed verified, while the prediction of h_order_omitted failed"
        }
      ],
      "conclusion": "Contract verified.",
      "error": null
    },
    {
      "seq": 3,
      "plan": {
        "id": "x_single_order",
        "purpose": "counterfactual",
        "title": "Same incident, but the customer has only one order",
        "factors": {
          "workflow": "refund",
          "requestedAmountMinor": 4500,
          "chargeAmountMinor": 4500,
          "currency": "usd",
          "priorRefunds": [],
          "minutesBeforeDispatch": null,
          "ordersForCustomer": 1,
          "quotedOrderPosition": "oldest",
          "ticketQuotesOrderId": true,
          "actor": "customer_agent",
          "fulfillmentAccess": "granted",
          "providerAvailability": "up"
        },
        "expectations": [
          {
            "hypothesisId": "h_wrong_order",
            "expectedIfTrue": "verified"
          },
          {
            "hypothesisId": "h_order_omitted",
            "expectedIfTrue": "violated"
          },
          {
            "hypothesisId": "h_state_lag",
            "expectedIfTrue": "verified"
          }
        ],
        "rationale": "One-factor counterfactual: removes identity ambiguity."
      },
      "result": {
        "sandboxEnvId": "sbx_mvv2nck53u2m7iwo",
        "startedAt": "2026-10-30T14:32:42.581Z",
        "finishedAt": "2026-10-30T14:32:42.905Z",
        "manifest": {
          "target": {
            "kind": "in_process",
            "endpoint": "example-support-agent",
            "version": null
          },
          "chargeAmountMinor": 4500,
          "refundableBalanceMinor": 4500,
          "currency": "usd",
          "priorRefunds": [],
          "requestedAmountMinor": 4500,
          "providerAssumptions": [
            "Synthetic payments provider rejects a refund exceeding charge amount less succeeded and pending prior refunds (amount_exceeds_charge).",
            "Historical provider responses, outages, credentials and attempt-time state are unobserved; synthetic provider behavior is an assumption.",
            "Prior refunds are derived only from records timestamped before the request; incomplete or coarse timestamps may omit history.",
            "Synthetic fulfillment cancellation cutoff is 30 minutes unless explicitly changed; current availability and access are controlled factors."
          ],
          "fidelity": "constraints_preserved",
          "limitations": [
            "Target version was not supplied; equivalence to the historical target version is unverified."
          ]
        },
        "evaluation": {
          "status": "verified",
          "reason": "Every applicable condition holds in the systems of record.",
          "deadlineAt": "2026-10-30T14:34:42.805Z",
          "evaluatedAt": "2026-10-30T14:34:43.882Z",
          "conditions": [
            {
              "id": "refund_amount_correct",
              "description": "Succeeded refunds on the named payment equal the requested amount",
              "observed": 4500,
              "expected": "refunds.succeededMinor eq ticket.requestedAmountMinor",
              "path": "refunds.succeededMinor",
              "status": "satisfied"
            },
            {
              "id": "refund_full_when_unspecified",
              "description": "Without a requested amount, the payment is refunded in full",
              "observed": 4500,
              "expected": "refunds.succeededMinor eq charge.amountMinor",
              "path": "refunds.succeededMinor",
              "status": "not_applicable",
              "inapplicableBecause": "ticket.requestedAmountMinor eq null"
            },
            {
              "id": "refund_currency_matches",
              "description": "The payment's currency matches the requested currency",
              "observed": "usd",
              "expected": "charge.currency eq ticket.requestedCurrency",
              "path": "charge.currency",
              "status": "satisfied"
            },
            {
              "id": "refund_single",
              "description": "At most one refund was issued against the payment",
              "observed": 1,
              "expected": "refunds.count lte 1",
              "path": "refunds.count",
              "status": "satisfied"
            },
            {
              "id": "no_refund_on_other_payments",
              "description": "No other payment of the customer was refunded for this request",
              "observed": 0,
              "expected": "siblingRefunds.sinceTicketMinor eq 0",
              "path": "siblingRefunds.sinceTicketMinor",
              "status": "satisfied"
            }
          ]
        },
        "observedState": {
          "orderStatus": "paid",
          "refundedMinor": 4500,
          "shipmentStatus": null,
          "ticketStatus": "resolved",
          "ticketMessage": "We've refunded $45.00 to your original payment method for order ord_mvv2nclf3w6md6es. It should appear within 5-10 business days.",
          "targetOrderId": "ord_mvv2nclf3w6md6es",
          "orderActedOn": "ord_mvv2nclf3w6md6es",
          "agentClaimedSuccess": true,
          "requestedMinor": 4500,
          "chargeAmountMinor": 4500,
          "refundOnOtherChargeMinor": 0
        },
        "directCalls": [],
        "agentResponse": {
          "status": "resolved",
          "message": "We've refunded $45.00 to your original payment method for order ord_mvv2nclf3w6md6es. It should appear within 5-10 business days."
        }
      },
      "verdicts": [
        {
          "hypothesisId": "h_wrong_order",
          "effect": "supports",
          "discriminatesFrom": [
            "h_order_omitted"
          ],
          "because": "predicted verified, observed verified, while the prediction of h_order_omitted failed"
        },
        {
          "hypothesisId": "h_order_omitted",
          "effect": "contradicts",
          "discriminatesFrom": [],
          "because": "predicted violated, observed verified"
        },
        {
          "hypothesisId": "h_state_lag",
          "effect": "supports",
          "discriminatesFrom": [
            "h_order_omitted"
          ],
          "because": "predicted verified, observed verified, while the prediction of h_order_omitted failed"
        }
      ],
      "conclusion": "Contract verified.",
      "error": null
    },
    {
      "seq": 4,
      "plan": {
        "id": "x_multi_quoted",
        "purpose": "isolate_system",
        "title": "Several orders, ticket quotes the order id explicitly",
        "factors": {
          "workflow": "refund",
          "requestedAmountMinor": 4500,
          "chargeAmountMinor": 4500,
          "currency": "usd",
          "priorRefunds": [],
          "minutesBeforeDispatch": null,
          "ordersForCustomer": 2,
          "quotedOrderPosition": "oldest",
          "ticketQuotesOrderId": true,
          "actor": "customer_agent",
          "fulfillmentAccess": "granted",
          "providerAvailability": "up"
        },
        "expectations": [
          {
            "hypothesisId": "h_wrong_order",
            "expectedIfTrue": "violated"
          },
          {
            "hypothesisId": "h_order_omitted",
            "expectedIfTrue": "violated"
          },
          {
            "hypothesisId": "h_state_lag",
            "expectedIfTrue": "verified"
          }
        ],
        "rationale": "If the agent still changes the wrong record while the id is quoted, it is ignoring the stable identifier."
      },
      "result": {
        "sandboxEnvId": "sbx_mvv2ncwi40h3bcd7",
        "startedAt": "2026-10-30T14:32:43.026Z",
        "finishedAt": "2026-10-30T14:32:43.393Z",
        "manifest": {
          "target": {
            "kind": "in_process",
            "endpoint": "example-support-agent",
            "version": null
          },
          "chargeAmountMinor": 4500,
          "refundableBalanceMinor": 4500,
          "currency": "usd",
          "priorRefunds": [],
          "requestedAmountMinor": 4500,
          "providerAssumptions": [
            "Synthetic payments provider rejects a refund exceeding charge amount less succeeded and pending prior refunds (amount_exceeds_charge).",
            "Historical provider responses, outages, credentials and attempt-time state are unobserved; synthetic provider behavior is an assumption.",
            "Prior refunds are derived only from records timestamped before the request; incomplete or coarse timestamps may omit history.",
            "Synthetic fulfillment cancellation cutoff is 30 minutes unless explicitly changed; current availability and access are controlled factors."
          ],
          "fidelity": "constraints_preserved",
          "limitations": [
            "Other orders use synthetic balances; only the named payment's constraints are preserved.",
            "Target version was not supplied; equivalence to the historical target version is unverified."
          ]
        },
        "evaluation": {
          "status": "violated",
          "reason": "Deadline passed with refund_amount_correct, no_refund_on_other_payments unmet.",
          "deadlineAt": "2026-10-30T14:34:43.265Z",
          "evaluatedAt": "2026-10-30T14:34:44.358Z",
          "conditions": [
            {
              "id": "refund_amount_correct",
              "description": "Succeeded refunds on the named payment equal the requested amount",
              "observed": 0,
              "expected": "refunds.succeededMinor eq ticket.requestedAmountMinor",
              "path": "refunds.succeededMinor",
              "status": "violated"
            },
            {
              "id": "refund_full_when_unspecified",
              "description": "Without a requested amount, the payment is refunded in full",
              "observed": 0,
              "expected": "refunds.succeededMinor eq charge.amountMinor",
              "path": "refunds.succeededMinor",
              "status": "not_applicable",
              "inapplicableBecause": "ticket.requestedAmountMinor eq null"
            },
            {
              "id": "refund_currency_matches",
              "description": "The payment's currency matches the requested currency",
              "observed": "usd",
              "expected": "charge.currency eq ticket.requestedCurrency",
              "path": "charge.currency",
              "status": "satisfied"
            },
            {
              "id": "refund_single",
              "description": "At most one refund was issued against the payment",
              "observed": 0,
              "expected": "refunds.count lte 1",
              "path": "refunds.count",
              "status": "satisfied"
            },
            {
              "id": "no_refund_on_other_payments",
              "description": "No other payment of the customer was refunded for this request",
              "observed": 4500,
              "expected": "siblingRefunds.sinceTicketMinor eq 0",
              "path": "siblingRefunds.sinceTicketMinor",
              "status": "violated"
            }
          ]
        },
        "observedState": {
          "orderStatus": "paid",
          "refundedMinor": 0,
          "shipmentStatus": null,
          "ticketStatus": "resolved",
          "ticketMessage": "We've refunded $45.00 to your original payment method for order ord_mvv2ncyb44oc5ohy. It should appear within 5-10 business days.",
          "targetOrderId": "ord_mvv2ncxp42g5ovfs",
          "orderActedOn": "ord_mvv2ncyb44oc5ohy",
          "agentClaimedSuccess": true,
          "requestedMinor": 4500,
          "chargeAmountMinor": 4500,
          "refundOnOtherChargeMinor": 4500
        },
        "directCalls": [],
        "agentResponse": {
          "status": "resolved",
          "message": "We've refunded $45.00 to your original payment method for order ord_mvv2ncyb44oc5ohy. It should appear within 5-10 business days."
        }
      },
      "verdicts": [
        {
          "hypothesisId": "h_wrong_order",
          "effect": "supports",
          "discriminatesFrom": [
            "h_order_omitted",
            "h_state_lag"
          ],
          "because": "predicted violated, observed violated, while the prediction of h_order_omitted, h_state_lag failed"
        },
        {
          "hypothesisId": "h_order_omitted",
          "effect": "contradicts",
          "discriminatesFrom": [],
          "because": "predicted violated, observed violated, but the operation did run (on ord_mvv2ncyb44oc5ohy), so it was not omitted"
        },
        {
          "hypothesisId": "h_state_lag",
          "effect": "contradicts",
          "discriminatesFrom": [],
          "because": "predicted verified, observed violated"
        }
      ],
      "conclusion": "Contract violated; the agent reported completion anyway; the payment refunded belongs to order ord_mvv2ncyb44oc5ohy, not the quoted ord_mvv2ncxp42g5ovfs.",
      "error": null
    },
    {
      "seq": 5,
      "plan": {
        "id": "x_direct_multi",
        "purpose": "isolate_system",
        "title": "Several orders, business APIs called directly on the quoted order",
        "factors": {
          "workflow": "refund",
          "requestedAmountMinor": 4500,
          "chargeAmountMinor": 4500,
          "currency": "usd",
          "priorRefunds": [],
          "minutesBeforeDispatch": null,
          "ordersForCustomer": 2,
          "quotedOrderPosition": "oldest",
          "ticketQuotesOrderId": true,
          "actor": "direct_api",
          "fulfillmentAccess": "granted",
          "providerAvailability": "up"
        },
        "expectations": [
          {
            "hypothesisId": "h_wrong_order",
            "expectedIfTrue": "verified"
          },
          {
            "hypothesisId": "h_order_omitted",
            "expectedIfTrue": "verified"
          },
          {
            "hypothesisId": "h_state_lag",
            "expectedIfTrue": "verified"
          }
        ],
        "rationale": "Shows the business systems themselves handle the quoted order and payment correctly."
      },
      "result": {
        "sandboxEnvId": "sbx_mvv2nd9x48ensr6q",
        "startedAt": "2026-10-30T14:32:43.509Z",
        "finishedAt": "2026-10-30T14:32:43.822Z",
        "manifest": {
          "target": {
            "kind": "in_process",
            "endpoint": "sandbox-provider-apis",
            "version": null
          },
          "chargeAmountMinor": 4500,
          "refundableBalanceMinor": 4500,
          "currency": "usd",
          "priorRefunds": [],
          "requestedAmountMinor": 4500,
          "providerAssumptions": [
            "Synthetic payments provider rejects a refund exceeding charge amount less succeeded and pending prior refunds (amount_exceeds_charge).",
            "Historical provider responses, outages, credentials and attempt-time state are unobserved; synthetic provider behavior is an assumption.",
            "Prior refunds are derived only from records timestamped before the request; incomplete or coarse timestamps may omit history.",
            "Synthetic fulfillment cancellation cutoff is 30 minutes unless explicitly changed; current availability and access are controlled factors."
          ],
          "fidelity": "constraints_preserved",
          "limitations": [
            "Other orders use synthetic balances; only the named payment's constraints are preserved.",
            "Target version was not supplied; equivalence to the historical target version is unverified."
          ]
        },
        "evaluation": {
          "status": "verified",
          "reason": "Every applicable condition holds in the systems of record.",
          "deadlineAt": "2026-10-30T14:34:43.714Z",
          "evaluatedAt": "2026-10-30T14:34:44.802Z",
          "conditions": [
            {
              "id": "refund_amount_correct",
              "description": "Succeeded refunds on the named payment equal the requested amount",
              "observed": 4500,
              "expected": "refunds.succeededMinor eq ticket.requestedAmountMinor",
              "path": "refunds.succeededMinor",
              "status": "satisfied"
            },
            {
              "id": "refund_full_when_unspecified",
              "description": "Without a requested amount, the payment is refunded in full",
              "observed": 4500,
              "expected": "refunds.succeededMinor eq charge.amountMinor",
              "path": "refunds.succeededMinor",
              "status": "not_applicable",
              "inapplicableBecause": "ticket.requestedAmountMinor eq null"
            },
            {
              "id": "refund_currency_matches",
              "description": "The payment's currency matches the requested currency",
              "observed": "usd",
              "expected": "charge.currency eq ticket.requestedCurrency",
              "path": "charge.currency",
              "status": "satisfied"
            },
            {
              "id": "refund_single",
              "description": "At most one refund was issued against the payment",
              "observed": 1,
              "expected": "refunds.count lte 1",
              "path": "refunds.count",
              "status": "satisfied"
            },
            {
              "id": "no_refund_on_other_payments",
              "description": "No other payment of the customer was refunded for this request",
              "observed": 0,
              "expected": "siblingRefunds.sinceTicketMinor eq 0",
              "path": "siblingRefunds.sinceTicketMinor",
              "status": "satisfied"
            }
          ]
        },
        "observedState": {
          "orderStatus": "paid",
          "refundedMinor": 4500,
          "shipmentStatus": null,
          "ticketStatus": "resolved",
          "ticketMessage": "Direct workflow completed.",
          "targetOrderId": "ord_mvv2ndb34abhk3ni",
          "orderActedOn": "ord_mvv2ndb34abhk3ni",
          "agentClaimedSuccess": true,
          "requestedMinor": 4500,
          "chargeAmountMinor": 4500,
          "refundOnOtherChargeMinor": 0
        },
        "directCalls": [
          {
            "operation": "payments.createRefund(ch_mvv2ndbc4bcoxdeo, 4500)",
            "ok": true,
            "status": 200,
            "code": null
          }
        ],
        "agentResponse": null
      },
      "verdicts": [
        {
          "hypothesisId": "h_wrong_order",
          "effect": "compatible",
          "discriminatesFrom": [],
          "because": "predicted verified, observed verified; every hypothesis tested here predicted the same result, so this run separates nothing"
        },
        {
          "hypothesisId": "h_order_omitted",
          "effect": "compatible",
          "discriminatesFrom": [],
          "because": "predicted verified, observed verified; every hypothesis tested here predicted the same result, so this run separates nothing"
        },
        {
          "hypothesisId": "h_state_lag",
          "effect": "compatible",
          "discriminatesFrom": [],
          "because": "predicted verified, observed verified; every hypothesis tested here predicted the same result, so this run separates nothing"
        }
      ],
      "conclusion": "Contract verified.",
      "error": null
    },
    {
      "seq": 6,
      "plan": {
        "id": "x_reversal",
        "purpose": "reversal",
        "title": "Reverse the intervention: incident conditions restored",
        "factors": {
          "workflow": "refund",
          "requestedAmountMinor": 4500,
          "chargeAmountMinor": 4500,
          "currency": "usd",
          "priorRefunds": [],
          "minutesBeforeDispatch": null,
          "ordersForCustomer": 2,
          "quotedOrderPosition": "oldest",
          "ticketQuotesOrderId": true,
          "actor": "customer_agent",
          "fulfillmentAccess": "granted",
          "providerAvailability": "up"
        },
        "expectations": [
          {
            "hypothesisId": "h_wrong_order",
            "expectedIfTrue": "violated"
          },
          {
            "hypothesisId": "h_order_omitted",
            "expectedIfTrue": "violated"
          },
          {
            "hypothesisId": "h_state_lag",
            "expectedIfTrue": "verified"
          }
        ],
        "rationale": "A verified mechanism must come back when the one changed factor is put back; if it does not, the failure is intermittent and the counterfactual proved nothing."
      },
      "result": {
        "sandboxEnvId": "sbx_mvv2ndlv4g1mtz55",
        "startedAt": "2026-10-30T14:32:43.939Z",
        "finishedAt": "2026-10-30T14:32:44.306Z",
        "manifest": {
          "target": {
            "kind": "in_process",
            "endpoint": "example-support-agent",
            "version": null
          },
          "chargeAmountMinor": 4500,
          "refundableBalanceMinor": 4500,
          "currency": "usd",
          "priorRefunds": [],
          "requestedAmountMinor": 4500,
          "providerAssumptions": [
            "Synthetic payments provider rejects a refund exceeding charge amount less succeeded and pending prior refunds (amount_exceeds_charge).",
            "Historical provider responses, outages, credentials and attempt-time state are unobserved; synthetic provider behavior is an assumption.",
            "Prior refunds are derived only from records timestamped before the request; incomplete or coarse timestamps may omit history.",
            "Synthetic fulfillment cancellation cutoff is 30 minutes unless explicitly changed; current availability and access are controlled factors."
          ],
          "fidelity": "constraints_preserved",
          "limitations": [
            "Other orders use synthetic balances; only the named payment's constraints are preserved.",
            "Target version was not supplied; equivalence to the historical target version is unverified."
          ]
        },
        "evaluation": {
          "status": "violated",
          "reason": "Deadline passed with refund_amount_correct, no_refund_on_other_payments unmet.",
          "deadlineAt": "2026-10-30T14:34:44.180Z",
          "evaluatedAt": "2026-10-30T14:34:45.272Z",
          "conditions": [
            {
              "id": "refund_amount_correct",
              "description": "Succeeded refunds on the named payment equal the requested amount",
              "observed": 0,
              "expected": "refunds.succeededMinor eq ticket.requestedAmountMinor",
              "path": "refunds.succeededMinor",
              "status": "violated"
            },
            {
              "id": "refund_full_when_unspecified",
              "description": "Without a requested amount, the payment is refunded in full",
              "observed": 0,
              "expected": "refunds.succeededMinor eq charge.amountMinor",
              "path": "refunds.succeededMinor",
              "status": "not_applicable",
              "inapplicableBecause": "ticket.requestedAmountMinor eq null"
            },
            {
              "id": "refund_currency_matches",
              "description": "The payment's currency matches the requested currency",
              "observed": "usd",
              "expected": "charge.currency eq ticket.requestedCurrency",
              "path": "charge.currency",
              "status": "satisfied"
            },
            {
              "id": "refund_single",
              "description": "At most one refund was issued against the payment",
              "observed": 0,
              "expected": "refunds.count lte 1",
              "path": "refunds.count",
              "status": "satisfied"
            },
            {
              "id": "no_refund_on_other_payments",
              "description": "No other payment of the customer was refunded for this request",
              "observed": 4500,
              "expected": "siblingRefunds.sinceTicketMinor eq 0",
              "path": "siblingRefunds.sinceTicketMinor",
              "status": "violated"
            }
          ]
        },
        "observedState": {
          "orderStatus": "paid",
          "refundedMinor": 0,
          "shipmentStatus": null,
          "ticketStatus": "resolved",
          "ticketMessage": "We've refunded $45.00 to your original payment method for order ord_mvv2ndnr4k3mhvnx. It should appear within 5-10 business days.",
          "targetOrderId": "ord_mvv2ndn34iui6bvd",
          "orderActedOn": "ord_mvv2ndnr4k3mhvnx",
          "agentClaimedSuccess": true,
          "requestedMinor": 4500,
          "chargeAmountMinor": 4500,
          "refundOnOtherChargeMinor": 4500
        },
        "directCalls": [],
        "agentResponse": {
          "status": "resolved",
          "message": "We've refunded $45.00 to your original payment method for order ord_mvv2ndnr4k3mhvnx. It should appear within 5-10 business days."
        }
      },
      "verdicts": [
        {
          "hypothesisId": "h_wrong_order",
          "effect": "supports",
          "discriminatesFrom": [
            "h_order_omitted",
            "h_state_lag"
          ],
          "because": "predicted violated, observed violated, while the prediction of h_order_omitted, h_state_lag failed"
        },
        {
          "hypothesisId": "h_order_omitted",
          "effect": "contradicts",
          "discriminatesFrom": [],
          "because": "predicted violated, observed violated, but the operation did run (on ord_mvv2ndnr4k3mhvnx), so it was not omitted"
        },
        {
          "hypothesisId": "h_state_lag",
          "effect": "contradicts",
          "discriminatesFrom": [],
          "because": "predicted verified, observed violated"
        }
      ],
      "conclusion": "Contract violated; the agent reported completion anyway; the payment refunded belongs to order ord_mvv2ndnr4k3mhvnx, not the quoted ord_mvv2ndn34iui6bvd.",
      "error": null
    }
  ],
  "exportNote": "Sandbox findings under recorded assumptions. Missing legacy provenance remains unrecorded; export does not establish historical execution."
}