ИИшка / Orchestration / 04 of 10

Benchmark и Golden Set

Практический benchmark должен ответить не на вопрос «какой orchestrator моднее», а на вопрос: какой execution layer даёт ИИшке нужную надёжность, восстановление, прозрачность и resource fit, не забирая у canonical core доменную политику и не мешая Qwen 30B на server2.

Запрет: никаких выдуманных p50/p95, CPU/RAM или throughput. Здесь фиксируется harness, golden cases, pass/fail policy и runbook; реальные числа собираются только на server2.
Benchmark harness

Один canonical сценарий — разные engines

Каждый кандидат получает одинаковые workflow definitions, module mocks, side-effect adapters, idempotency keys и failure injection. Сравнивается execution behaviour, а не удобство конкретного DSL.

Canonical WorkflowSpec
  |- workflow_id / workflow_version
  |- steps[]
  |- dependencies[]
  |- retry_policy
  |- timeout_policy
  |- human_gate
  |- permission_scope
  |- resource_class
  |- idempotency_scope
  `- audit_requirements
          |
          +--> Temporal adapter
          +--> Prefect adapter
          +--> LangGraph adapter (agent-local cases only)
          `--> Kestra adapter

Shared fixture layer
  |- FakeResearcher
  |- FakeSkeptic
  |- FakeWriter
  |- FakeCurator
  |- FakeExperiment
  |- FakeInvestigator
  |- SideEffectLedger
  |- FailureInjector
  `- AuditCollector

Canonical first

Golden workflow описывается вне движка. Adapter обязан отображать semantics без изменения domain model.

Failure injection

Kill worker, kill server, timeout, duplicate delivery, lost callback, stale input, poisoned event, resource starvation.

Deterministic ledger

Все необратимые side effects пишутся в отдельный ledger, чтобы обнаружить replay/duplication.

Trace export

Каждый run экспортирует canonical trace: step, attempt, engine event, domain decision, input/output hashes.

Golden set

30 controlled workflows

ГруппаКол-воЧто проверяет
Linear / branching5Последовательность, fan-out/fan-in, conditional routing.
Retries / timeouts5Transient failure, exponential retry, timeout boundaries, retry exhaustion.
Human-in-the-loop4Pause, approval, rejection, late approval after workflow version changes.
Crash recovery5Worker crash, orchestration service restart, continuation from persisted state.
Idempotency / replay4Duplicate delivery, repeated callback, replay after acknowledgement loss.
Cross-module policy3Unauthorized route, budget gate, escalation to human.
Server2 pressure2Heavy Qwen workload + orchestration background pressure.
Version / stale state2Old run pinned to old definition; stale module output rejected or marked stale.

Representative golden cases

G01  Researcher -> Skeptic -> Writer                     PASS path
G02  Researcher fails once -> retry -> Skeptic           transient recovery
G03  Skeptic returns REVISE -> Writer -> Skeptic         bounded loop
G04  Curator promotion side effect -> ACK lost           no duplicate promotion
G05  Human approval waits 12h equivalent                 durable wait
G06  Approval arrives after WorkflowSpec v2 published    run stays pinned to v1
G07  Qwen task hangs                                     timeout + cancel/cleanup
G08  Worker killed after side effect, before checkpoint  idempotent resume
G09  Unauthorized Writer -> Curator write                policy block
G10  Researcher callback replayed twice                  one domain transition
G11  Orchestrator DB/service restart                     state recovery
G12  Dossier context revision changed mid-run            stale-input handling
G13  Budget exhausted                                    pause/escalate, not silent continue
G14  Engine unavailable                                  canonical audit remains queryable
G15  Corrupted engine event                              reject / quarantine
G16  Module output hash mismatch                         integrity failure
G17  Cancellation during retry backoff                   deterministic terminal state
G18  Child task fails after parent success               explicit compensation/partial state
G19  Qwen high-priority request arrives under load       orchestration yields resources
G20  Workflow engine switched for same canonical spec    domain semantics preserved
Engine-specific spikes

Что обязан доказать каждый финалист

EngineMandatory spikesKey risk
TemporalLong wait, signals, worker restart, activity retry, side-effect replay protection, workflow version pinning.Operational complexity / footprint; Temporal semantics leaking into domain model.
PrefectWorker outage, retry, schedule, concurrency limits, deployment restart, result/state persistence.Whether durability is sufficient for long-lived cross-module workflows.
LangGraphCheckpoint, interrupt/resume, human correction, state migration, Qwen loop recovery.Agent graph accidentally becoming global workflow/state source of truth.
KestraEvent trigger, multi-language task, retry, pause/resume, worker isolation, UI trace.JVM/platform overhead and policy leakage into YAML/plugin surface.
Comparison rule: LangGraph не штрафуется за отсутствие функций глобального scheduler — он оценивается только в agent-local role. Аналогично Temporal не обязан быть самым удобным Python batch runner.
Metrics

Надёжность важнее throughput

Correctness

  • lost transition count
  • duplicate irreversible side effects
  • wrong terminal state
  • stale result accepted
  • unauthorized route executed

Recovery

  • resume success
  • manual intervention required
  • recovery position correctness
  • orphaned run count

Observability

  • canonical trace completeness
  • attempt/retry visibility
  • input/output hash presence
  • failure cause attribution

Resource fit

  • idle RSS/CPU
  • active CPU/RAM
  • queue delay
  • storage growth
  • impact on Qwen p50/p95

Qualitative scoring bands

BandMeaning
PASSGolden semantics preserved; no critical gate violation.
PASS_WITH_LIMITSCorrectness passes, but operational/resource limitations require bounded role.
SPIKE_MOREInsufficient evidence; targeted rerun required.
REJECT_FOR_ROLECritical semantic, security or resource gate fails for the tested role.
server2 protocol

Qwen 30B остаётся primary workload

Orchestration не имеет права «победить» benchmark ценой деградации основной LLM. Поэтому ресурсные тесты идут совместно с контролируемой Qwen-нагрузкой.

Phase A — idle baseline
  measure: host CPU/RAM, engine idle footprint, DB footprint

Phase B — orchestration only
  run: 1 / 5 / 20 concurrent workflows
  measure: queue delay, worker CPU/RAM, DB writes, recovery time

Phase C — Qwen baseline
  fixed prompt set -> capture Qwen p50/p95 latency + throughput

Phase D — co-load
  same Qwen prompt set + orchestration workload
  capture delta vs Phase C

Phase E — failure under co-load
  worker kill / engine restart / timeout / retries while Qwen active

NO NUMBERS ARE FILLED UNTIL SERVER2 RUN.
MeasurementRecord
EnvironmentOS, kernel, CPU, RAM, GPU, storage, container/runtime versions.
EngineName, exact version/commit, config, DB version.
QwenModel build/quantization/runtime, context, concurrency.
WorkloadGolden case IDs, concurrency, failure seed, run count.
OutputsJSON metrics, logs, canonical trace, engine trace, resource snapshots.
Hard gates

Zero tolerance

duplicate irreversible domain side effect      = 0
lost canonical workflow transition             = 0
unauthorized cross-module execution             = 0
stale input silently accepted                   = 0
old run silently moved to new workflow version  = 0
missing audit for terminal decision             = 0
recovery to semantically wrong step             = 0
engine-specific ID replacing canonical ID       = 0
engine outage destroying canonical readability  = 0
resource policy bypass under server2 pressure   = 0

Idempotency gate

Backend retries are never sufficient alone. Domain side-effect endpoint requires canonical idempotency key and ledger verification.

Version gate

WorkflowRun pins WorkflowSpec version; definition update never mutates active run semantics silently.

Policy gate

Engine cannot invoke a module merely because graph/YAML/activity says so. Canonical permission resolver authorizes every protected transition.

Audit gate

Terminal state without trace, policy version, decision reason and relevant input hashes is invalid.

Runbook

Как проводить practical spike

1. Pin engine + DB + adapter versions.
2. Build the same canonical WorkflowSpec fixtures.
3. Reset test DB / side-effect ledger.
4. Run deterministic happy-path suite.
5. Run retry/timeout suite.
6. Run kill/restart suite.
7. Run duplicate/replay suite.
8. Run permission/version/stale-input suite.
9. Run Qwen coexistence suite on server2.
10. Export artifacts:
    - canonical_trace.jsonl
    - engine_trace.*
    - metrics.json
    - resource_samples.csv
    - failures.json
    - environment.json
11. Compare against hard gates.
12. Produce ADR evidence table: REUSE / ADAPT / BUILD / REJECT_FOR_ROLE.

ADR evidence matrix

RoleLeading hypothesis before real runWhat would change decision
Durable cross-module workflowsTemporalResource/operational cost too high or canonical adapter complexity unacceptable.
Operational Python jobsPrefectRecovery semantics fail required golden cases or footprint unexpectedly high.
Agent-local Qwen graphLangGraph optionalClear reduction in custom state-machine code without domain-state lock-in.
Declarative/event platformKestra reference/optionalOperational UI/integration value materially outweighs platform footprint.
Expected architectural outcome: likely layered orchestration, not one universal engine. Canonical core + domain policy remain ours; execution adapters are replaceable.
Next

Следующий документ

AI_orchestration_5_workflow_policy_и_state_machine.html