Skip to content

Lifecycle States

Every war-room follows a state machine defined in lifecycle.json. This document covers all standard states, transitions, retry logic, and escalation paths.

State Overview

OSTwin defines 14 states across 4 categories:

Work States

StateRoleDescription
pendingRoom created, waiting for dependencies
developingengineerPrimary implementation work
optimizeengineerFix/improve after QA feedback

Review States

StateRoleDescription
reviewqaCode review and acceptance testing
design-reviewarchitectArchitecture compliance review

Decision States

StateRoleDescription
triagemanagerDecide next action after escalation
failedmanagerAuto-decision: retry or exhaust

Terminal States

StateTypeDescription
passedterminalEpic completed and approved
failed-finalterminalEpic exhausted retries or rejected

Orchestration States

StateRoleDescription
blockedWaiting on dependency resolution
waitingPaused for external input
plan-reviewarchitectInitial plan validation
signing-offmanagerCollecting release signoffs
releasedRelease completed

lifecycle.json Schema

{
"version": 2,
"initial_state": "developing",
"max_retries": 3,
"states": {
"developing": {
"role": "engineer",
"type": "work",
"signals": {
"done": { "target": "review" },
"error": {
"target": "failed",
"actions": ["increment_retries"]
}
}
}
}
}

Top-Level Fields

FieldTypeDescription
versionintSchema version (currently 2)
initial_statestringState when room first activates
max_retriesintMaximum retries before exhaustion

State Definition

FieldTypeDescription
rolestringRole responsible in this state
typestring"work", "review", "triage", "decision", or "terminal"
auto_transitionboolAuto-transition without agent invocation
signalsobjectSignal-to-transition mapping

Signal Definition

FieldTypeDescription
targetstringTarget state name
guardstringCondition expression (e.g., "retries < max_retries")
actionsstring[]Actions to execute on transition

Standard Lifecycle Flow

pending → developing → review ─┬─► passed
▲ │
└── optimize ◄────┘ (on fail)
failed ──► failed-final (if retries exhausted)
└──► developing (if retries remain)

Transition Signals

SignalMeaningTypical Source
doneWork completedengineer, architect
passReview approvedqa
failReview rejectedqa
errorUnrecoverable errorany role
escalateNeeds higher authorityqa
fixFix and retrymanager
redesignFundamental rework neededmanager
rejectPermanently rejectmanager
retryAuto-retry (guarded)manager
exhaustRetries exhausted (guarded)manager

Retry Mechanics

Increment

The increment_retries action increments the room’s retry counter. This happens on error and fail signals.

Guard Conditions

The failed state uses guard conditions for automatic routing:

{
"failed": {
"auto_transition": true,
"signals": {
"retry": {
"target": "developing",
"guard": "retries < max_retries"
},
"exhaust": {
"target": "failed-final",
"guard": "retries >= max_retries"
}
}
}
}

The auto_transition: true flag means the manager evaluates guards automatically without spawning an agent.

Retry Flow

  1. QA sends fail signal → state moves to optimize
  2. Engineer fixes → sends done → state moves to review
  3. If QA fails again → optimize with increment_retries
  4. After max_retries failures → failed → auto-evaluates → failed-final

Escalation

The escalate signal from QA triggers the triage state:

{
"triage": {
"role": "manager",
"type": "triage",
"signals": {
"fix": { "target": "optimize", "actions": ["increment_retries"] },
"redesign": { "target": "developing", "actions": ["increment_retries", "revise_brief"] },
"reject": { "target": "failed-final" }
}
}
}

The manager decides between:

  • fix — Send back for optimization
  • redesign — Restart with a revised brief
  • reject — Permanently fail this epic

Actions

ActionDescription
increment_retriesIncrement the retry counter
post_fixPost a fix message to the channel
revise_briefUpdate the room’s brief.md

Terminal States

Terminal states have no signals and no role. Once entered, the room is complete:

{
"passed": { "type": "terminal" },
"failed-final": { "type": "terminal" }
}