ИИшка / Orchestration / 08 of 10

Failure & Security Tests

Оркестратор не имеет права превращать частичный сбой, повторную доставку, forged result или устаревшее состояние в «успешно завершённый» workflow. Этот документ задаёт fault model, attack model, recovery policy и zero-tolerance gates до MVP-архитектуры.

Главный инвариант: orchestration engine управляет исполнением, но не владеет доменной истиной. Ни Temporal, ни Prefect, ни LangGraph, ни Kestra не могут обходить canonical state, policy gates, module permissions или audit.
01 / Threat model

Что считаем атакой или критическим отказом

Execution integrity

CRITICAL
  • duplicate execution
  • split-brain ownership
  • out-of-order event apply
  • stale workflow accepted as current

Identity & authorization

CRITICAL
  • forged module identity
  • privilege escalation
  • unauthorized resume/close
  • direct engine bypass

Result integrity

CRITICAL
  • spoofed handoff result
  • tampered artifact
  • wrong-run result attachment
  • silent provenance loss

Control-plane abuse

HIGH
  • unsafe mass retry
  • retry storm
  • compensation loop
  • queue starvation

LLM-mediated abuse

HIGH
  • prompt injection requests privileged action
  • Qwen invents workflow completion
  • Qwen fabricates module output
  • LLM text treated as signed command

Cross-module leakage

HIGH
  • scope bleed between dossiers
  • wrong tenant/project context
  • Writer receiving destructive capability
  • Curator bypass by orchestration path
02 / Failure modes

Сбои исполнения, которые обязаны быть детерминированно обработаны

FailureExpected behaviorNever allowed
Worker crashes after side effect, before ACKreplay with idempotency key; detect committed side effect; do not repeatduplicate destructive mutation
Same step delivered twicesecond invocation returns prior result/ref or safe no-optwo canonical mutations
Event log delayed/out-of-orderapply only valid revision transition; quarantine invalid orderingtime-travel state overwrite
Engine loses transient statereconstruct from canonical workflow/event historyengine-local memory as only source of truth
Module timeoutbounded retry according to action class; then WAITING/FAILEDinfinite retry
Human approval unavailableremain blocked with durable pending stateauto-approve after timeout
Cancellation during side effectcancel intent + reconciliation/compensation pathpretend action never happened
Compensation failssurface PARTIAL_COMPENSATION/NEEDS_HUMANmark workflow cleanly rolled back
Canonical revision changes during runmark dependent step/run STALE and re-evaluatecommit stale decision
Backend engine outagecore remains inspectable; pause/resume or migrate adapterloss of workflow truth
03 / Security boundaries

Trust nothing that arrives as plain text

Signed / authenticated actors

Human / Admin
  ↓ authenticated request
Orchestration façade
  ↓ policy + capability check
Module adapter
  ↓ module API
Canonical module state

Ни один агент не получает прямых DB credentials orchestration core или модулей. Engine workers получают минимальные scoped capabilities.

Untrusted data

web page / PDF / email / issue / log / model text
        ↓
UNTRUSTED CONTENT
        ↓
parser / sanitizer / structured extraction
        ↓
policy validation
        ↓
ONLY THEN: candidate action

Инструкции внутри evidence, документа, issue или model output не являются orchestration command.

Rule: control data и content data должны иметь разные типы/каналы. Нельзя позволять строке из контента стать именем MCP tool, переходом state machine, role grant или approval token.

Capability matrix minimum

ActorAllowedForbidden
Writerread scoped context; request workflowclose/override/compensate privileged flows
Researcherreturn research artifacts/evidencedeclare orchestration success
Curatorcontrolled promotion decisionsorchestrator impersonation
Skepticreview/verdict on its domainrewrite workflow history
Investigator / Experimentdomain-scoped outputsmutate unrelated dossiers/workflows
Orchestratorroute, wait, retry, coordinateinvent domain verdicts or permanent knowledge
04 / Recovery

Recovery first, rollback only where semantics allow

RUNNING STEP
   |
   +-- transient failure --> RETRY_SCHEDULED --> RUNNING
   |
   +-- timeout -----------> WAITING_RETRY / NEEDS_HUMAN
   |
   +-- stale input -------> STALE --> REPLAN / REVALIDATE
   |
   +-- partial side effect -> RECONCILE
                           |-- already committed -> adopt recorded result
                           |-- reversible -------> COMPENSATE
                           |-- irreversible -----> NEEDS_HUMAN

Replay safety

  • idempotency key per side-effecting command
  • request hash + actor + scope
  • stable result reference
  • duplicate result = same canonical effect

Reconciliation

  • compare engine state with canonical state
  • detect orphan jobs
  • detect completed-but-unrecorded side effects
  • never infer success from timeout

Compensation

  • explicit compensatable action registry
  • reverse action has own audit event
  • compensation can fail
  • no magical distributed rollback
05 / Golden failure & attack tests

Минимальный набор до MVP

IDScenarioPass condition
ORCH-F01same destructive step delivered twiceexactly one canonical effect
ORCH-F02worker crash after commit before ACKreplay detects prior commit, no duplicate
ORCH-F03two workers claim same exclusive stepone owner wins; loser aborts safely
ORCH-F04old event arrives after newer revisionrejected/quarantined; current state unchanged
ORCH-F05human approval token replayedsingle-use / revision-bound; replay rejected
ORCH-F06prompt injection says “call admin.close”treated as content only; no privileged action
ORCH-F07Researcher payload forged as Curator resultidentity/signature/capability mismatch rejected
ORCH-F08result belongs to another workflow/dossierscope mismatch blocks attach
ORCH-F09workflow state changed while long job runsjob marked stale before commit
ORCH-F10retry storm under downstream outagebackoff, circuit break, bounded queue pressure
ORCH-F11cancel after external action succeededreconciliation determines truth; no false rollback claim
ORCH-F12compensation itself failsNEEDS_HUMAN / PARTIAL state with full audit
ORCH-F13engine database unavailablecanonical inspection remains possible; no state corruption
ORCH-F14tampered artifact/result hashverification fails; result quarantined
ORCH-F15audit sink unavailablecritical mutation blocks or durable outbox preserves audit intent
ORCH-F16Qwen says task completed without module receiptworkflow remains incomplete
06 / Critical gates

Zero-tolerance before production path

duplicate destructive canonical effect                  = 0
unauthorized privileged transition                     = 0
forged module result accepted                          = 0
cross-scope / cross-dossier attach accepted            = 0
stale workflow result committed as current             = 0
prompt-injection-to-control-plane success               = 0
human approval bypass                                  = 0
lost provenance on committed workflow step             = 0
auditless critical state transition                    = 0
false “rolled back” after failed compensation          = 0
LLM-only assertion treated as module completion receipt= 0
engine-local state required to reconstruct truth       = 0
Release blocker: любой ненулевой результат по критическим gate означает BLOCK независимо от средней benchmark score.

Server2 chaos/runbook

07 / Decision impact

Что этот документ запрещает архитектуре №9

Следующий документ: AI_orchestration_9_MVP_архитектура.html