Skip to Content
turbo-12f
Architecture

Request lifecycle and orchestration

End-to-end execution from ask and confirm through Strategist DAG lanes, capacity scheduling, autonomy modes, and failure recovery ladders.

Explanation

Every feature, fix, or incident moves through turbo-12f as an append-only request under requests/<id>/. The orchestrator splits accepted specs into dependency-ordered lanes, runs deterministic gates and AI steps, merges passing lanes onto staging, and validates the release before merging to main.

Stage 1

Ask & confirm

Lock an OpenSpec change with verbatim quotes, then pass the Project Gate.

Stage 2

Strategist & lanes

Plan dependency-ordered worktrees and run each lane through 11 steps.

Stage 3

Merge to staging

Evaluate merge policy, rebase sequentially, and wait for a quiet queue.

Stage 4

Release & main

Run whole-tree staging checks, bisect failures, sign off, and merge to main.

End-to-end request flow

  1. Intake (t12 ask): Starts on --project-dir or --repo, collects quoted must-haves, images, and issues via t12 conversation issues or POST /api/c/{id}/issues, and clears readiness checks.
  2. Confirmation (t12 confirm): Binds the request to a new or adopted repository, initializes .t12/, and runs devops.Gate to verify clean branches, pinned skills, dependencies, and base checks on branches.staging.
  3. Lane execution (t12 run): Calls orchestrator.Run (orchestrator.go). Strategist splits the spec into dependency-linked tasks (EvTaskAdded) that run in parallel worktree lanes.
  4. Release lane: Once non-parked lanes merge into staging, orchestrator.Run launches the request-level release lane (ReleaseLane = "release").
  5. Release checks & bisection: factory.go runs qc, uicheck, redteam, and deploy-dry-run (plus optional qc.explorer) on staging. Failures trigger fixRelease bisection and <culprit>-rf<N> fix lanes for up to 3 passes.
  6. Promotion (t12 release merge): After t12 release gate turns green and the acceptor signs off, branches.staging merges --no-ff into branches.main (main, master, or staging).

From a sentence to main

Flow
100%
Specification to stagingRelease, promotion & SREstaging treenew ask1. AskContext creator2. Confirmspec + DevOps gate3. Strategistsplit to tasks4. Task lanesbuild · QC · review5. Stagingmerge queue tip6. Release gatetree-hash checks7. Sign-offbug bash · sign-off8. Main branchpromote dry-run9. SRE watchprobes · triageNew requestSRE defect ask

People decide at start and release; core scripts gate every lane transition through staging, sign-off, and post-deploy SRE watch.

Click any node or press Play

Lane plan and sequential vs target execution

Each worktree lane runs an 11-step sequence defined by orchestrator.LanePlan:

StepRoleResponsibility
1analyze (internal/roles/analyzer)Plans changed files, test specs, and predicted screens on staging
2engineer (internal/roles/engineer)Writes failing tests first, then production code inside a Docker cage
3qc (internal/roles/qc)Runs build, typecheck, lint, comment-ban, test-guard, scenario-text, unit, e2e, and mutation
4ui-check (internal/roles/uicheck)Settles 5s (SettleSeconds), compares PNG SHA-256 baselines, and flags overflow or unpredicted screens
5deslop (internal/roles/deslop)Runs regex, AST, and clone hygiene rules plus a read-only audit
6red-team (internal/roles/redteam)Runs gitleaks, osv-scanner, cross-origin POST checks, and visitor replay probes
7code-review (internal/roles/codereview)Checks unrequested edits, unlisted dependencies, hypotheses, and prior findings
8merge-policy (internal/mergepolicy)Evaluates data-loss, auth, licence, delivery, and review bound to git patch-id --stable
9merge (internal/mergequeue)Takes merge-queue.lock, rebases onto staging, rechecks if tree changed, and fast-forwards
10deploy-dry-run (internal/roles/devops)Validates staging deploy artifact once the quiet window clears
11sre (internal/roles/sre)Watches staging health probes over a short observation window

Sequential implementation vs. target parallel checks

design.md specifies running E2E, UI check, and Red team in parallel after qc. Today runLane in internal/orchestrator/orchestrator.go runs every step strictly sequentially.

One lane, step by step

Flow
100%
11-step LanePlan · sequential per lane · step-done checkpointspassfailfindingconflictfixrethinkpolicy park1. AnalyzeDAG split · ParallelCtx2. Engineercage · sync · lane edits3-4. QC & UI checkstatic · E2E · 5s UI settle5-7. Deslop & Reviewslop · gitleaks · review8. Merge policyrisk & protected path9. Merge queuecheck slot · staging tip10-11. Deploy & SREstaging dry-run · watchDeterministic RouterRulesEngineer fix or Analyzer retryParked lanewaits for t12 approve

Each task runs the ordered 11-step LanePlan backed by step-done checkpoints; any failure hands control to the deterministic Router.

Click any node or press Play

Concurrency, priority, and file locks

slots.go separates LLM concurrency from verification container concurrency using two semaphore pools (slotOf):

PoolSteps coveredDefault capacityPriority order
agentSlotanalyze, engineer, code-review4 (project.DefaultAgentSlots)Resumed fixes first, longest chain, then FIFO
checkSlotqc, ui-check, deslop, red-team, merge, deploy-dry-run, sremax(1, NumCPU / 2) (DockerCPUs / 2 in Docker)Same priority{fix, chain, seq} comparator
Unslottedmerge-policyUnboundedRuns immediately inside runLane

Three coordination rules in queue.go and slots.go prevent lane collisions:

  • File locks (fileLocks): Active when overlap is "wait" (vs. default "parallel"). Engineer locks Analyze target paths in sorted order before editing and releases on Merge or send-back.
  • Quiet window (waitQuiet): Delays deploy-dry-run until queued == 0 (counting lanes between code-review and merge) and 120s (DefaultQuietWindowS) pass without queue changes.
  • Live capacity resizing: Every 15s (LiveCapacityEvery), reads .t12/config.json and .t12/preferences.json from refs/heads/<staging> and updates pool limits live.

Strategist task planning and parallel lanes

Before launching lanes, Orchestrator calls strategist.Route (plan.go, dag.go) to build a task DAG, falling back to strategist.Tasks when planning is skipped or invalid.

MechanismHow Orchestrator handles it
Upfront queue & snapshotsQueueTasks writes EvTaskAdded upfront (Tasks replays on resume); each step snapshots Ctx.Tasks under tasksMu.
Dynamic seam splitsOversized tasks split into <parent.ID>-1..N via checkSplit and strategist.Split. Split children require size_waiver (parking below turbo).
Task Gate statusdesign.md defines a pre-lane Task Gate to drop duplicate/passing work; today Strategist checks DAG partitions and Orchestrator enforces depsDone/pausedDeps.

See Strategist internals for PlanTimeout and partition rules.

Strategist rules, send-back sync, and fallback decisions

When a step fails or reports blocking findings, orchestrator.route checks deterministic rules (rules.Match) before calling strategist.Decide:

  • merge send-back sync (sendback.go): handleSendBack emits EvSendBack with "sync_staging": true. At Engineer start, syncWorktreeIfPending calls gitio.SyncOntoStaging, squashes onto staging, blocks on binary/UD conflicts, and leaves text conflict markers with a cleared index for the caged Engineer.
  • Fallback & rule proposals: Unmatched steps (analyze) or repeat rootHash hits (state.hashes[hash] == 1) invoke strategist.Decide and feed proposals/strategist-rule-*.json.

Failure routing and budgets

Flow
100%
mechdesignyescap hitnew2nd3rdyes0 leftretryStep failsany lane stepPick routerules or conflictFixes < 3?mech budgetSeen cause?root hashToken left?pool: 2/taskSend backlane retries2nd repeat freeswitches routeProblem pausepauses this lane

Fix attempts and retry tokens stay on separate budgets; one repeated root cause triggers a free route switch before stopping on a third.

Click any node or press Play

Recovery ladders and autonomy levels

Before spending a retry token or parking a lane, Orchestrator climbs five recovery rungs:

  1. In-place retry (StepRetries): Retries infrastructure errors (couldNotRun) with no open questions, appending EvRetried.
  2. Auto-answer (AnswerQuestions): Calls answerForYou when questions stop a step, logs "answered-for-you" (EvAnswer), and reruns (i--).
  3. Engineer fix attempts (FixAttempts, default 3): Handles Conflict, turn-cap, and engineer-routed failures at zero request tokens (diff-cap checks gitio.Tree.AddedLineCount).
  4. Analyze retry tokens (tokenPool, default 2): Restarts from analyze (ctx.Resume = "analyze"). diff-cap send-backs and second hits (state.hashes[hash] == 1) of a rootHash run with free: true.
  5. Lane pause (EvProblem): Triggers on a third identical rootHash (state.hashes[hash] >= 2) or exhausted budgets, setting errPaused and pausedDeps while other lanes continue.

autonomy.go resolves four presets via Preferences.ResolveAutonomy(os.Getenv("T12_AUTONOMY")). Selecting a mode in t12 ui writes <home>/access/mode.json and injects T12_AUTONOMY into worker subprocesses; in review (Request Review), every shell command also waits in internal/approvals.

LevelFixAttemptsRetryTokens per taskStepRetriesAnswerQuestionsMerge-policy and review waits
reviewConfig value (default 3)Config value (default 2)00PartsWait: true (every lane waits), MatchesWait: true, diff-cap-waiver waits
defaultConfig value (default 3)Config value (default 2)00MatchesWait true unless merge_policy.mode is "auto"; diff-cap-waiver waits
autoMinimum 4Minimum 321Same match waits as default; diff-cap-waiver waits
turboMinimum 5Minimum 543MatchesWait: false; only "data-loss" waits (diff-cap-waiver waived)

Five-layer recovery ladder

Flow
100%
Escalation hierarchy · cheapest at bottomcaptuneL5 · Person or ObserverPersont12 run --answer or t12 approve --send-backL4 · Problem raisedLane stopsPaused lane isolates fault; sibling lanes keep runningL3 · Retry token1 TokenAnalyzer re-plans task · pool = tokens x top-level tasksL2 · Fix attempt1 FixEngineer repairs code or merge conflict · cap 3 (1 to 5)L1 · Transient retryFreeDeploy network and 5xx glitches retry up to 3 timesSafety boundscaps 1-5 · modeEscalationcap spent climbs +1

Every failure starts at the cheapest automatic retry and climbs one layer at a time until a budget stops or a person steps in.

Click any node or press Play

Key takeaway

Orchestrator keeps model judgment out of lane progression: every split, retry, merge lock, and pause is driven by deterministic Go state over requests/<id>/events.jsonl.

Next steps

On this page