Failure-Recovery Matrix (NSE crash-containment pass)

Status: baseline 2026-09-01. Companion to crash-safety.md and

artifacts/forensics/crash-safety-audit.json.

Every row = subsystem × failure → expected console log, state, recovery,

exit, and the test that proves it. GREEN means failure-injected → detected →

logged → safe behavior → regression exists (never "a try/except exists").

Legend — State: truthful runtime state after the failure. Log: minimum console/file record. Rec: recovery policy. Exit: CLI/process exit contract. Test: primary regression evidence.

#SubsystemFailureLog (console)StateRecExitTest
1startupmissing/invalid config at launchred panel cfg_detail=Parse error… + doctor FAILNOT READYhalt1 / EXIT_RUNTIMElauncher doctor contract; BUG-149/156 lineage
2startup_preflight_or_raise raise (model dir missing)panel with real errorhalted pre-READYhalt1launcher/CLI preflight paths
3startupMT5 connect fails ×3[MT5_CONNECT] attempts + CRITICAL + incident telemetryengine stoppedfail-closedshutdownrun_loop connect contract
4startupcorrupt/width-mismatched checkpointCRITICAL Checkpoint dimension mismatch; quarantiningmodel quarantined .corruptno silent replaceraiseBUG-141 suite
5confighot-reload save with invalid valuevalidation error, snapshot version unchangedold valid config ACTIVEreject swap0 (rejected write surfaced)runtime_config validate_field suite
6DIservice construction raises (e.g. order_manager absent at reconciliation)[EXECUTION_RECONCILIATION] STARTUP_FAILED (isolated) + incidentdegraded reconciliation, trading gatedretry next cyclen/a (loop continues)engine init-order tests (BUG-105/130)
7databaseworker batch insert failsAudit Background Worker failed to insert batch (error)queue drained (task_done per item)backoff 1s, continuen/aaudit worker tests
8databaseDB locked/corrupt on read helpererror log + exc_info=True then sentineldegraded sentinel (truthful)BUG-142 disciplinen/atest_forensic_repair_account_and_audit
9databasemigration failsDB_MIGRATION_FAILED state + web report FAILEDoriginal bytes restoredtransactional rollbackEXIT_RUNTIMEDatabaseMigrator fail_after test
10market datatick fetch failureraised → run_loop error log w/ tracebackstale feed watchdog armedwatchdog reconnect/resyncn/aG29 stalled-stream contract
11candleduplicate/late tickduplicate suppressed (no re-pipeline)last REAL decision re-surfacedskip + service workersn/aBUG-169 suite
12featuresNaN/Inf feature valueNon-finite feature sanitized warning (per index)0.0 + clip [-3,3]sanitized (documented)n/ato_tensor_input contract
1350Dwidth ≠ 50RuntimeError Feature contract violation …inference blockedfail-closedn/a50D gate tests
1470Dmissing INVALID liquidity snapshotRuntimeError refusing to feed fabricated valuesinference BLOCKED this tickfail-closedn/aBUG-125 / 70D assembly tests
1570Dbounds/hash violationSchemaContractError w/ family+indexinference blockedfail-closedn/avalidate_70d_vector tests
16tensorshape mismatch at forwardreal RuntimeError surfaced w/ component contextdecision blockednever resizen/aBUG-175 cross-schema regression
17model loadartifact hash mismatchManifestValidationError artifact hash mismatchMODEL FAILEDfail-closedEXIT_RUNTIMEmodel-doctor/validate suites
18model loaddeclared scaler missingscaler declared in manifest but file missing/corruptMODEL FAILEDfail-closedn/aruntime T24 contract
19inferenceforward raises mid-tick[INFERENCE] in-trade inference failed (isolated) w/ tracebackprobs=None, position mgmt CONTINUESprotective stops activen/aPhase-15 exit contract tests
20GPU/CPUCUDA unavailabledevice=cpu selection loggedCPU executionvalidated fallbackn/aLocalModelRuntime device pick
21regimeclassifier raisesrun_loop error log w/ tracebackprior regime state retained / UNKNOWNretry next tickn/aregime classifier suite
22liquiditygovernor snapshot invalidassembly raises → [INFERENCE] 70D assembly failed warning70D inference blockedfail-closedn/aliquidity_runtime v2 tests
23strategypolicy exception mid-evaluaterun_loop error log w/ tracebackno proposal emittedsafe NO_TRADE defaultn/apolicy suites
24risksizing input NaN/None/InfINVALID_INPUT_NAN_INF_NONE reasonvolume=0.0fail-closedn/atest_risk_engine
25riskclamp engine raisesRisk engine clamp failed; falling back to hard capHARD_MAX_LOTS boundbounded fallback (logged)n/aorder manager clamp tests
26executionambiguous market-order resultretcode %s but live position found (ticket=%s) or terminal failureverified fill OR confirmed failurebroker-truth probe, NO blind retryn/aambiguous-fill recovery tests (BUG-142 verified-safe list)
27execution3 consecutive rejectionsCRITICAL TRANSITIONED TO SAFE_MODESAFE_MODE (orders blocked)operator resetn/aexecution suite
28newsone source fails[NEWS_FETCH] source=… status=FAILURE failures=N + backoffsource degraded, others liveexponential backoff ≤1hn/afetcher health/backoff tests
29newsworker cycle fails[NEWS_WORKER] event=FAILURE + exc_infolast_error set, next cycle retriesbounded retries per articlen/anews worker tests
30workersworker loop crash (telegram)[TELEGRAM_WORKER] event=CRASH … + _worker_crash capturedtruthful failure stateloop continues w/ backoffn/atelegram notifier tests
31async_kick_worker hung > timeout[WORKER_KICK] event=TIMEOUT … detaching hung callcall detached, inflight clearedcontinuen/aworker kick contract
32web/apiendpoint raisesWEB_ERROR endpoint=… request_id=… exception_type=… + traceback (log only)safe JSON {error:{code,message,request_id}}sanitized 500HTTP 500web/errors contract tests
33SSEpayload not JSON-serializable[SSE] event=SERIALIZATION_ERROR fields=…error frame w/ failed_fields; counters bumpedstream survivesn/aBUG-110 tests
34CLIcommand raiseserror panel + EXIT_RUNTIME (human == JSON decision)structured failurecorrect non-zero exitEXIT_RUNTIMECLI e2e suites
35diagnosticsanalyzer crashes / none runFAILED/error status; check raised: health rowstatus=error (never clean)truthful verdictnon-zerodiagnostics engine tests
36forensicscheck body raisesCHECK-RAISED … group raised: … UNKNOWN rowworst-status aggregationvisible UNKNOWN (never PASS)gate exit per verdictdeploy gate tests (BUG-162)
37releasechecksum/manifest mismatchFAIL row w/ detailoverall FAILno installEXIT_RELEASEtest_release_system (4-layout matrix)
38updaterSHA-256 mismatch on downloadSHA256_MISMATCH — artifact discardedstate FAILED, install untouchedre-download cleanlyEXIT_UPDATE(4)BUG-171 probe servers
39updatercrash mid-installnext update status → ROLLBACK_REQUIRED + CRASH_REQUIRES_ROLLBACKlast-known-good preservedrollback required firstEXIT_UPDATE(8) on rollback pathupdater state-machine tests
40updaterrollback w/o backupFAILED_SAFE panel w/ actionable hintFAILED_SAFE (truthful)user data untouchedEXIT_RUNTIME(1)BUG-173 rewritten tests
41shutdownone worker stop() raiseslogged, remaining stops proceedqueue drained, no stale healthy claimcleanup never masks primaryclean/1 per primary_shutdown_async ordering tests
42lifecyclelauncher start on empty-claim pidfilegrace window (BUG-170-hardening) then liveness checksingle engine guaranteedsecond starter reports RUNNING0BUG-170 concurrency probes
43stoptaskkill rc=128 (dead pid)already stopped (stale pidfile) warningpidfile unlinkedhonest no-op0BUG-172 tests
44model CLImodel-validate w/o probabilities (fixed)REAL probs via LocalModelRuntime; cross-schema → SCHEMA_MISMATCH panelreal metrics, honest verdictfail-fast on mismatchEXIT_RUNTIMEtest_bug175_model_validate_probs (6)
45dataset CLI--schema unknown value (fixed)explicit rejection panelno ghost datasetfail-fastEXIT_USAGEtest_bug176_schema_flag (5)

Residual gaps (YELLOW, tracked)

GapEvidenceRiskNext action
381 silent handlers (except-Exception: pass/continue/return-default) now flagged as P1 violations by the static checkartifacts/forensics/anti_crash_static_report.json (rev-2 regex)P1 tracking / P2 per-site (majority are reviewed fail-safe defaults)triage top files: live_engine (48), debug_snapshot (16), pro_auto (13), server (13) — add exc_info, truthful state, or # anti-crash: allow
8 thread-spawn sites without add_done_callbacksame report SPAWN_NO_DONE_CALLBACKLOW each (all capture crashes in-loop) — but none is centrally monitoredoptional watchdog aggregation task
2 check=False subprocess sites with wide windowssame reportLOW (runner kills tree + status TIMEOUT)narrow result-inspection window
BUG-164 regression does not pin the "Dataset not found" panel textreviewer report (1f60832)P2 test confidencepin panel text
model-replay returns prediction error INSIDE payload with exit 0reviewer report (1f60832)P2 misleading-success classfold into BUG-175 family follow-up
no automated GPU-failure injection test (CUDA OOM/driver)this matrixP3 (CPU fallback documented + device-pick tested)add device-forced unit probe
no automated disk-full injection on audit workerthis matrixP3add tmpfs-limited probe

Scorecard (evidence-based, 2026-09-01)

SubsystemScoreEvidence anchor
startupGREENdoctor/preflight contracts + engine runtime launch test
configGREENruntime store validate + hot-reload reject tests
DIYELLOWreconciliation isolation tested; no generic DI container exists
databaseGREENworker drain tests + BUG-142 read-helper exc_info
filesystemYELLOWworkspace anchoring (BUG-149/156) tested; no disk-full injection
market dataGREENwatchdog + honest tick contract (G29/BUG-169)
candlesGREENreseed/REPLACE+ALIGN tests
featuresGREENsanitize + width-raise contract tests
50DGREEN50D gate tests
70DGREENvalidate_70d_vector + BUG-125 + BUG-141 suites
tensorGREENBUG-175 cross-schema regression + real RuntimeError surfacing
model loadGREENmanifest/hash/scaler hard-fail tests
model inferenceGREENisolated in-trade failure w/ mgmt continuation
GPU/CPUYELLOWCPU fallback validated; no OOM injection
regimeGREENclassifier suites
liquidityGREENLIQUIDITY_RUNTIME v2 status matrix tests
strategyGREENpolicy suites (0 swallowed exceptions)
riskGREENINVALID_* fail-closed matrix + clamp fallback
executionGREENidempotency + ambiguous-fill + SAFE_MODE tests
newsGREENper-source backoff + worker FAILURE exc_info
workersGREENper-worker capture (telegram/audit/candle/shadow70)
asyncGREENkick timeout detach + task tracking + shutdown cancel
web/apiGREENsafe-error envelope + middleware 500 sanitize
SSEGREENBUG-110 serialization diagnostic + stream survival
CLIGREENexit-code contract suites (66 e2e + 170..176 nets)
releaseGREEN4-layout verify matrix + tamper probe
updaterGREENstate machine + crash recovery + BUG-170..173 nets
shutdownGREENordered guarded teardown tests

Verdict: HARDENED_WITH_GAPS — no known silent-crash / false-success / lost-traceback path on any P0 boundary; the honest caveat is the tracked 381-site silent-handler backlog (see residual gaps), which is observability/ documentation debt on mostly-fail-safe sites, not a proven safety hole.