=== G2.1 publish retry event ===
{"candidate":{"candidate_id":"cand-retry-local","account_id":1,"platform":"openai","model":"gpt-4.1-retry","source":"local-harness","status":"published","discovered_at":"2026-05-09T18:27:05.168183+08:00","updated_at":"2026-05-09T10:34:07.81537074Z","version":2},"package":{"package_id":1001,"platform":"openai","model":"gpt-4.1-retry","status":"active","source":"local-harness","created_at":"2026-05-09T18:33:41.078761+08:00","updated_at":"2026-05-09T10:34:07.81537074Z","version":2},"event":{"event_id":"evt-retry-local-20260509-1","account_id":1,"event_type":"supply_package_published","package_id":1001,"platform":"openai","model":"gpt-4.1-retry","occurred_at":"2026-05-09T10:29:00Z","version":2,"gateway_sync_status":"pending","retry_count":0},"gateway_sync_status":"pending"}

=== G2.2 consume once for retry ===
{"consumer":"gateway","next_cursor":"","items":[{"event_id":"evt-retry-local-20260509-1","package_id":1001,"gateway_sync_status":"pending","result":"pending","detail":"simulated retryable network failure","retry_count":1,"next_retry_at":"2026-05-09T18:35:07.823257+08:00","failure_category":"temporary_network"}]}

=== G2.3 admission-state retry ===
{"candidate":{"candidate_id":"cand-retry-local","account_id":1,"platform":"openai","model":"gpt-4.1-retry","source":"local-harness","status":"published","discovered_at":"2026-05-09T18:27:05.168183+08:00","updated_at":"2026-05-09T18:34:07.81537+08:00","version":2},"gateway_sync_status":"pending","last_event":{"event_id":"evt-retry-local-20260509-1","account_id":1,"event_type":"supply_package_published","package_id":1001,"platform":"openai","model":"gpt-4.1-retry","occurred_at":"2026-05-09T18:29:00+08:00","version":2,"gateway_sync_status":"pending","consumer_detail":"simulated retryable network failure","retry_count":1,"last_retry_at":"2026-05-09T18:34:07.823257+08:00","next_retry_at":"2026-05-09T18:35:07.823257+08:00","last_failure_category":"temporary_network","last_failure_detail":"simulated retryable network failure"},"model":"gpt-4.1-retry","package":{"package_id":1001,"platform":"openai","model":"gpt-4.1-retry","status":"active","source":"local-harness","created_at":"2026-05-09T18:33:41.078761+08:00","updated_at":"2026-05-09T18:34:07.81537+08:00","version":2},"platform":"openai"}

=== G2.4 publish fail event ===
{"candidate":{"candidate_id":"cand-fail-local","account_id":1,"platform":"openai","model":"gpt-4.1-fail","source":"local-harness","status":"published","discovered_at":"2026-05-09T18:27:05.169384+08:00","updated_at":"2026-05-09T10:34:07.837891916Z","version":2},"package":{"package_id":1002,"platform":"openai","model":"gpt-4.1-fail","status":"active","source":"local-harness","created_at":"2026-05-09T18:33:41.078761+08:00","updated_at":"2026-05-09T10:34:07.837891916Z","version":2},"event":{"event_id":"evt-fail-local-20260509-1","account_id":1,"event_type":"supply_package_published","package_id":1002,"platform":"openai","model":"gpt-4.1-fail","occurred_at":"2026-05-09T10:30:00Z","version":2,"gateway_sync_status":"pending","retry_count":0},"gateway_sync_status":"pending"}

=== G2.5 consume once for fail (+ retry re-eval) ===
{"consumer":"gateway","next_cursor":"","items":[{"event_id":"evt-fail-local-20260509-1","package_id":1002,"gateway_sync_status":"failed","result":"failed","detail":"simulated apply failure","failure_category":"unknown"},{"event_id":"evt-retry-local-20260509-1","package_id":1001,"gateway_sync_status":"pending","result":"pending","detail":"simulated retryable network failure","retry_count":2,"next_retry_at":"2026-05-09T18:39:07.849738+08:00","failure_category":"temporary_network"}]}

=== G2.6 package-changes relevant events ===
{"items":[{"event_id":"evt-fail-local-20260509-1","account_id":1,"event_type":"supply_package_published","package_id":1002,"platform":"openai","model":"gpt-4.1-fail","occurred_at":"2026-05-09T18:30:00+08:00","version":2,"gateway_sync_status":"failed","consumer":"gateway","consumer_detail":"simulated apply failure","acked_at":"2026-05-09T18:34:07.848243+08:00","retry_count":0},{"event_id":"evt-retry-local-20260509-1","account_id":1,"event_type":"supply_package_published","package_id":1001,"platform":"openai","model":"gpt-4.1-retry","occurred_at":"2026-05-09T18:29:00+08:00","version":2,"gateway_sync_status":"pending","consumer_detail":"simulated retryable network failure","retry_count":2,"last_retry_at":"2026-05-09T18:34:07.849738+08:00","next_retry_at":"2026-05-09T18:39:07.849738+08:00","last_failure_category":"temporary_network","last_failure_detail":"simulated retryable network failure"},{"event_id":"evt-smoke-local-20260509-1","account_id":1,"event_type":"supply_package_published","package_id":0,"platform":"openai","model":"gpt-4.1-mini","occurred_at":"2026-05-09T18:28:16+08:00","version":2,"gateway_sync_status":"applied","consumer":"gateway","consumer_detail":"applied to gateway snapshot","acked_at":"2026-05-09T18:28:16.176022+08:00","retry_count":0}],"next_cursor":""}

=== G2.7 publish unauthorized event ===
{"candidate":{"candidate_id":"cand-unauth-local","account_id":2,"platform":"openai","model":"gpt-4.1-unauth","source":"local-harness","status":"published","discovered_at":"2026-05-09T18:27:05.170671+08:00","updated_at":"2026-05-09T10:34:07.86363489Z","version":2},"package":{"package_id":1003,"platform":"openai","model":"gpt-4.1-unauth","status":"active","source":"local-harness","created_at":"2026-05-09T18:33:41.078761+08:00","updated_at":"2026-05-09T10:34:07.86363489Z","version":2},"event":{"event_id":"evt-unauth-local-20260509-1","account_id":2,"event_type":"supply_package_published","package_id":1003,"platform":"openai","model":"gpt-4.1-unauth","occurred_at":"2026-05-09T10:31:00Z","version":2,"gateway_sync_status":"pending","retry_count":0},"gateway_sync_status":"pending"}

=== G2.8 consume once from cursor=evt-fail-local-20260509-1 (expect unauthorized skipped) ===
{"consumer":"gateway","next_cursor":"","items":[{"event_id":"evt-retry-local-20260509-1","package_id":1001,"gateway_sync_status":"failed","result":"failed","detail":"simulated retryable network failure","failure_category":"temporary_network"}]}

=== G2.9 package-changes after fail cursor (expect unauthorized pending) ===
{"items":[{"event_id":"evt-retry-local-20260509-1","account_id":1,"event_type":"supply_package_published","package_id":1001,"platform":"openai","model":"gpt-4.1-retry","occurred_at":"2026-05-09T18:29:00+08:00","version":2,"gateway_sync_status":"failed","consumer":"gateway","consumer_detail":"simulated retryable network failure","acked_at":"2026-05-09T18:34:07.872031+08:00","retry_count":2,"last_retry_at":"2026-05-09T18:34:07.849738+08:00","last_failure_category":"temporary_network","last_failure_detail":"simulated retryable network failure"},{"event_id":"evt-smoke-local-20260509-1","account_id":1,"event_type":"supply_package_published","package_id":0,"platform":"openai","model":"gpt-4.1-mini","occurred_at":"2026-05-09T18:28:16+08:00","version":2,"gateway_sync_status":"applied","consumer":"gateway","consumer_detail":"applied to gateway snapshot","acked_at":"2026-05-09T18:28:16.176022+08:00","retry_count":0}],"next_cursor":""}

=== G2.10 inspect ===
=== healthz ===
{"status":"ok"}
=== runtime status ===
{"cursor":"","failed_events":2,"last_error":"","last_poll_at":"2026-05-09T10:34:07.171985237Z","paused":false,"pending_retry_events":0,"started":true}
=== metrics excerpt ===
# HELP supply_intelligence_gateway_event_latency_seconds Gateway event processing latency
# TYPE supply_intelligence_gateway_event_latency_seconds histogram
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="0.005"} 0
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="0.01"} 0
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="0.025"} 0
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="0.05"} 0
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="0.1"} 0
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="0.25"} 2
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="0.5"} 2
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="1"} 2
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="2.5"} 2
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="5"} 2
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="10"} 2
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="+Inf"} 2
supply_intelligence_gateway_event_latency_seconds_sum{platform="openai"} 0.354977317
supply_intelligence_gateway_event_latency_seconds_count{platform="openai"} 2
# HELP supply_intelligence_gateway_event_retries_total Gateway event retries scheduled
# TYPE supply_intelligence_gateway_event_retries_total counter
supply_intelligence_gateway_event_retries_total{category="temporary_network",platform="openai"} 2
# HELP supply_intelligence_gateway_events_processed_total Gateway events processed
# TYPE supply_intelligence_gateway_events_processed_total counter
supply_intelligence_gateway_events_processed_total{event_type="supply_package_published",platform="openai",result="applied"} 2
supply_intelligence_gateway_events_processed_total{event_type="supply_package_published",platform="openai",result="failed"} 2
# HELP supply_intelligence_gateway_failed_events Gateway events in terminal failed state
# TYPE supply_intelligence_gateway_failed_events gauge
supply_intelligence_gateway_failed_events{consumer="gateway"} 2
# HELP supply_intelligence_gateway_pending_retry_events Gateway pending retry events ready or scheduled for retry
# TYPE supply_intelligence_gateway_pending_retry_events gauge
supply_intelligence_gateway_pending_retry_events{consumer="gateway"} 0
{
  "decision": "continue",
  "reasons": [],
  "applied_ratio": 1.0,
  "processed": {},
  "pending_retry_events": 0.0,
  "failed_events": 2.0,
  "runtime": {
    "cursor": "",
    "failed_events": 2,
    "last_error": "",
    "last_poll_at": "2026-05-09T10:34:07.171985237Z",
    "paused": false,
    "pending_retry_events": 0,
    "started": true
  }
}

=== G2.11 consume once with only unauthorized pending (expect items=[]) ===
{"consumer":"gateway","next_cursor":"","items":[]}

=== G2.12 package-changes full (expect unauthorized remains pending) ===
{"items":[{"event_id":"evt-unauth-local-20260509-1","account_id":2,"event_type":"supply_package_published","package_id":1003,"platform":"openai","model":"gpt-4.1-unauth","occurred_at":"2026-05-09T18:31:00+08:00","version":2,"gateway_sync_status":"pending","retry_count":0},{"event_id":"evt-fail-local-20260509-1","account_id":1,"event_type":"supply_package_published","package_id":1002,"platform":"openai","model":"gpt-4.1-fail","occurred_at":"2026-05-09T18:30:00+08:00","version":2,"gateway_sync_status":"failed","consumer":"gateway","consumer_detail":"simulated apply failure","acked_at":"2026-05-09T18:34:07.848243+08:00","retry_count":0},{"event_id":"evt-retry-local-20260509-1","account_id":1,"event_type":"supply_package_published","package_id":1001,"platform":"openai","model":"gpt-4.1-retry","occurred_at":"2026-05-09T18:29:00+08:00","version":2,"gateway_sync_status":"failed","consumer":"gateway","consumer_detail":"simulated retryable network failure","acked_at":"2026-05-09T18:34:07.872031+08:00","retry_count":2,"last_retry_at":"2026-05-09T18:34:07.849738+08:00","last_failure_category":"temporary_network","last_failure_detail":"simulated retryable network failure"},{"event_id":"evt-smoke-local-20260509-1","account_id":1,"event_type":"supply_package_published","package_id":0,"platform":"openai","model":"gpt-4.1-mini","occurred_at":"2026-05-09T18:28:16+08:00","version":2,"gateway_sync_status":"applied","consumer":"gateway","consumer_detail":"applied to gateway snapshot","acked_at":"2026-05-09T18:28:16.176022+08:00","retry_count":0}],"next_cursor":""}


=== G2.13 inspect after parser fix ===
=== healthz ===
{"status":"ok"}
=== runtime status ===
{"cursor":"","failed_events":2,"last_error":"","last_poll_at":"2026-05-09T10:35:27.173034723Z","paused":false,"pending_retry_events":0,"started":true}
=== metrics excerpt ===
# HELP supply_intelligence_gateway_event_latency_seconds Gateway event processing latency
# TYPE supply_intelligence_gateway_event_latency_seconds histogram
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="0.005"} 0
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="0.01"} 0
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="0.025"} 0
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="0.05"} 0
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="0.1"} 0
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="0.25"} 2
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="0.5"} 2
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="1"} 2
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="2.5"} 2
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="5"} 2
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="10"} 2
supply_intelligence_gateway_event_latency_seconds_bucket{platform="openai",le="+Inf"} 2
supply_intelligence_gateway_event_latency_seconds_sum{platform="openai"} 0.354977317
supply_intelligence_gateway_event_latency_seconds_count{platform="openai"} 2
# HELP supply_intelligence_gateway_event_retries_total Gateway event retries scheduled
# TYPE supply_intelligence_gateway_event_retries_total counter
supply_intelligence_gateway_event_retries_total{category="temporary_network",platform="openai"} 2
# HELP supply_intelligence_gateway_events_processed_total Gateway events processed
# TYPE supply_intelligence_gateway_events_processed_total counter
supply_intelligence_gateway_events_processed_total{event_type="supply_package_published",platform="openai",result="applied"} 2
supply_intelligence_gateway_events_processed_total{event_type="supply_package_published",platform="openai",result="failed"} 2
# HELP supply_intelligence_gateway_failed_events Gateway events in terminal failed state
# TYPE supply_intelligence_gateway_failed_events gauge
supply_intelligence_gateway_failed_events{consumer="gateway"} 2
# HELP supply_intelligence_gateway_pending_retry_events Gateway pending retry events ready or scheduled for retry
# TYPE supply_intelligence_gateway_pending_retry_events gauge
supply_intelligence_gateway_pending_retry_events{consumer="gateway"} 0
{
  "decision": "pause",
  "reasons": [
    "applied_ratio_below_threshold"
  ],
  "applied_ratio": 0.5,
  "processed": {
    "applied": 2.0,
    "failed": 2.0
  },
  "pending_retry_events": 0.0,
  "failed_events": 2.0,
  "runtime": {
    "cursor": "",
    "failed_events": 2,
    "last_error": "",
    "last_poll_at": "2026-05-09T10:35:27.173034723Z",
    "paused": false,
    "pending_retry_events": 0,
    "started": true
  }
}
