### mode refused
ERR   x Integrator: deployment: client never fast-forwards (integration.mode local-ff)
rc=3 reason=[integration-mode-refused: deployment: client never fast-forwards (integration.mode local-ff)] pr=[|] story_pr=[]
### no base head
rc=3 reason=[integrator-no-base-head] pr=[|] story_pr=[]
### land: scoped tests green, integration check and merged build pass
CALL run_scoped_tests [<base>]
LOG   + Integrator: main fast-forwarded to <T-1 work> (factory/task/T-1)
METRIC {"event":"integration_completed","task_id":"T-1","branch":"factory/task/T-1","base_sha":"<T-1 work>","at":"2026-10-18T00:00:00+00:00"}
rc=0 reason=[] pr=[|] story_pr=[]
-- main:
   T-1 work
   base
-- recorded base is the new head: [yes]
   log: integration-build-20261018-000000-T-1.log
   log: integration-check-20261018-000000-T-1.log
### no-op: the lane's tip is already in the base
LOG   = Integrator: factory/task/T-1 is already contained in the base — no-op
METRIC {"event":"integration_noop","task_id":"T-1","branch":"factory/task/T-1","at":"2026-10-18T00:00:00+00:00"}
rc=0 reason=[] pr=[|] story_pr=[]
### no workspace package changed
LOG   Integrator: no workspace package changed in this merge — merged-tree scoped tests not applicable
LOG   + Integrator: main fast-forwarded to <T-2 work> (factory/task/T-2)
METRIC {"event":"integration_completed","task_id":"T-2","branch":"factory/task/T-2","base_sha":"<T-2 work>","at":"2026-10-18T00:00:00+00:00"}
rc=0 reason=[] pr=[|] story_pr=[]
### merged tree red
CALL run_scoped_tests [<T-2 work>]
ERR   x Integrator: factory/task/T-3 is green alone but RED once merged — base unmoved
rc=2 reason=[merged-tree-tests-failed in: pkg-a pkg-b (log: <T>/ctl/harness/state/logs/scoped.log)] pr=[|] story_pr=[]
-- without scoped_test_packages:
CALL run_scoped_tests [<T-2 work>]
ERR   x Integrator: factory/task/T-3 is green alone but RED once merged — base unmoved
rc=2 reason=[merged-tree-tests-failed] pr=[|] story_pr=[]
### merged-tree check fails
CALL run_scoped_tests [<T-2 work>]
ERR   x Integrator: merged-tree check failed on factory/task/T-3 — base unmoved
rc=2 reason=[merged-tree-check-failed (log: <T>/ctl/harness/state/logs/integration-check-20261018-000000-T-3.log)] pr=[|] story_pr=[]
### merged build fails
ERR   x Integrator: could not build the merged tree for factory/task/T-3 — base unmoved
ERR     This is an environment failure, not a verdict on T-3.
rc=3 reason=[merged-tree-build-failed (log: <T>/ctl/harness/state/logs/integration-build-20261018-000000-T-3.log)] pr=[|] story_pr=[]
-- branch kept, base unmoved:
-- main:
   T-2 work
   T-1 work
   base
### dependency sync before the merged-tree checks
-- no lockfiles declared: hash-gating off, always sync
LOG   Integrator: base moved lockfiles under the lane ((hash-gating off)) — syncing: echo "sync [$LANE_CHANGED_LOCKFILES]"
LOG   + Integrator: dependency tree synced to the merged tree (0s)
METRIC {"event":"integration_sync","task_id":"T-3","slot":1,"lockfiles":"(hash-gating off)","duration_s":0,"at":"2026-10-18T00:00:00+00:00"}
CALL run_scoped_tests [<T-2 work>]
LOG   + Integrator: main fast-forwarded to <T-3 work> (factory/task/T-3)
METRIC {"event":"integration_completed","task_id":"T-3","branch":"factory/task/T-3","base_sha":"<T-3 work>","at":"2026-10-18T00:00:00+00:00"}
rc=0 reason=[] pr=[|] story_pr=[]
-- a pooled lane whose stamp matches the merged tree: skipped
LOG   Integrator: merged tree's lockfiles match the lane's dependency tree — sync skipped
METRIC {"event":"integration_sync_skipped","task_id":"T-4","slot":1,"reason":"lockfile-hash-unchanged","at":"2026-10-18T00:00:00+00:00"}
CALL run_scoped_tests [<T-3 work>]
LOG   + Integrator: main fast-forwarded to <T-4 work> (factory/task/T-4)
METRIC {"event":"integration_completed","task_id":"T-4","branch":"factory/task/T-4","base_sha":"<T-4 work>","at":"2026-10-18T00:00:00+00:00"}
rc=0 reason=[] pr=[|] story_pr=[]
-- the rebase carries a lockfile change in: sync, then stamp
LOG   Integrator: base moved lockfiles under the lane (pkg/lock.txt) — syncing: echo "sync [$LANE_CHANGED_LOCKFILES]"
LOG   + Integrator: dependency tree synced to the merged tree (0s)
METRIC {"event":"integration_sync","task_id":"T-5","slot":1,"lockfiles":"pkg/lock.txt","duration_s":0,"at":"2026-10-18T00:00:00+00:00"}
CALL run_scoped_tests [<T-4 work>]
LOG   + Integrator: main fast-forwarded to <T-5 work> (factory/task/T-5)
METRIC {"event":"integration_completed","task_id":"T-5","branch":"factory/task/T-5","base_sha":"<T-5 work>","at":"2026-10-18T00:00:00+00:00"}
rc=0 reason=[] pr=[|] story_pr=[]
-- lanes dir files:
   ./.gitignore: # Worktree lanes: runtime state, never committed (STORY-212).|*|
   ./base.sha: <T-5 work>|
   ./control-heads.log: <T-1 work>|<T-1 work>|<T-1 work>|<T-2 work>|<T-2 work>|<T-3 work>|<T-3 work>|<T-4 work>|<T-4 work>|<T-5 work>|<T-5 work>|
   ./meta/1/last-acquire: mode: reset|needs_bootstrap: false|seconds: 0|reason: |needs_build: true|base: <T-4 work>|
   ./meta/1/lockfiles.hash: pkg/lock.txt:29785418248 
-- the sync fails: infrastructure, the stamp is dropped
LOG   Integrator: base moved lockfiles under the lane (pkg/lock.txt) — syncing: exit 3
METRIC {"event":"integration_sync_failed","task_id":"T-6","slot":1,"lockfiles":"pkg/lock.txt","duration_s":0,"at":"2026-10-18T00:00:00+00:00"}
ERR   x Integrator: could not sync the merged tree's dependencies for factory/task/T-6 — base unmoved
ERR     This is an environment failure, not a verdict on T-6.
rc=3 reason=[merged-tree-sync-failed (log: <T>/ctl/harness/state/logs/integration-sync-20261018-000000-T-6.log)] pr=[|] story_pr=[]
-- lanes dir files:
   ./.gitignore: # Worktree lanes: runtime state, never committed (STORY-212).|*|
   ./base.sha: <T-5 work>|
   ./control-heads.log: <T-1 work>|<T-1 work>|<T-1 work>|<T-2 work>|<T-2 work>|<T-3 work>|<T-3 work>|<T-4 work>|<T-4 work>|<T-5 work>|<T-5 work>|
   ./meta/1/last-acquire: mode: reset|needs_bootstrap: false|seconds: 0|reason: |needs_build: true|base: <T-5 work>|
-- a lane outside the pool: the rebase's own lockfile diff decides
LOG   Integrator: base moved lockfiles under the lane (pkg/lock.txt) — syncing: echo "sync [$LANE_CHANGED_LOCKFILES]"
LOG   + Integrator: dependency tree synced to the merged tree (0s)
METRIC {"event":"integration_sync","task_id":"T-7","slot":null,"lockfiles":"pkg/lock.txt","duration_s":0,"at":"2026-10-18T00:00:00+00:00"}
CALL run_scoped_tests [<main bumps the lockfile again>]
LOG   + Integrator: main fast-forwarded to <T-7 work#2> (factory/task/T-7)
METRIC {"event":"integration_completed","task_id":"T-7","branch":"factory/task/T-7","base_sha":"<T-7 work#2>","at":"2026-10-18T00:00:00+00:00"}
rc=0 reason=[] pr=[|] story_pr=[]
### rebase conflict (and the dependency resolver is consulted)
CALL dep_conflicts_resolve_rebase [ctl/harness/state/lanes/1] [T-8]
ERR   x Integrator: factory/task/T-8 conflicts with the base — rebase aborted, branch kept
rc=1 reason=[rebase-conflict] pr=[|] story_pr=[]
### fast-forward refused (the control checkout holds an edit the merge would overwrite)
CALL run_scoped_tests [<main edits app.txt>]
ERR   x Integrator: fast-forward of main to factory/task/T-9 refused — base unmoved
rc=1 reason=[fast-forward-refused] pr=[|] story_pr=[]
### integration.mode: pr
-- no forge adapter
ERR   x Integrator: integration.mode is pr but no forge adapter is loaded — base unmoved
rc=3 reason=[forge-adapter-missing (lib/forge-github.sh not loaded)] pr=[|] story_pr=[]
-- the remote base cannot be fetched
CALL forge_remote_base [ctl/harness/state/lanes/1] [main]
ERR   x Integrator: could not fetch the remote main — fetch-failed: origin unreachable
rc=3 reason=[fetch-failed: origin unreachable] pr=[|] story_pr=[]
-- push refused
CALL forge_remote_base [ctl/harness/state/lanes/1] [main]
CALL run_scoped_tests [<main edits app.txt>]
CALL forge_push_branch [ctl/harness/state/lanes/1] [factory/task/T-9] [factory/STORY-1/T-9]
ERR   x Integrator: push of factory/STORY-1/T-9 failed — push-rejected: non-fast-forward
rc=1 reason=[push-rejected: non-fast-forward] pr=[|] story_pr=[]
-- gh fails
CALL forge_remote_base [ctl/harness/state/lanes/1] [main]
CALL run_scoped_tests [<main edits app.txt>]
CALL forge_push_branch [ctl/harness/state/lanes/1] [factory/task/T-9] [factory/STORY-1/T-9]
CALL forge_open_pr [ctl/harness/state/lanes/1] [factory/STORY-1/T-9] [main] [feat: T-9] [body(T-9|STORY-1|factory/STORY-1/T-9|main|marker=|base=)]
ERR   x Integrator: could not open a PR for factory/STORY-1/T-9 — gh-failed: 502
rc=3 reason=[gh-failed: 502] pr=[|] story_pr=[]
-- opened
CALL forge_remote_base [ctl/harness/state/lanes/1] [main]
CALL run_scoped_tests [<main edits app.txt>]
CALL forge_push_branch [ctl/harness/state/lanes/1] [factory/task/T-9] [factory/STORY-1/T-9]
CALL forge_open_pr [ctl/harness/state/lanes/1] [factory/STORY-1/T-9] [main] [feat: T-9] [body(T-9|STORY-1|factory/STORY-1/T-9|main|marker=|base=)]
LOG   + Integrator: pushed factory/STORY-1/T-9 and opened https://forge.invalid/pr/7 — main unmoved
METRIC {"event":"integration_pr_opened","task_id":"T-9","branch":"factory/STORY-1/T-9","pr_url":"https://forge.invalid/pr/7","at":"2026-10-18T00:00:00+00:00"}
rc=0 reason=[] pr=[https://forge.invalid/pr/7|factory/STORY-1/T-9] story_pr=[]
-- main:
   main edits app.txt
   T-7 work
   main bumps the lockfile again
   T-5 work
   main bumps the lockfile
   T-4 work
   T-3 work
   T-2 work
   T-1 work
   base
### pr-story: the story branch and its one PR
-- no story
CALL run_scoped_tests [<main edits app.txt>]
rc=3 reason=[story-pr-unplaceable: T-10 has no story (or no state dir) under integration.pr_granularity: story] pr=[|] story_pr=[]
-- not on a story branch
CALL run_scoped_tests [<main edits app.txt>]
rc=3 reason=[story-pr-not-on-story-branch: 'main' does not match team.branch_pattern] pr=[|] story_pr=[]
-- synced and landed (the last task: ready)
CALL run_scoped_tests [<main edits app.txt>]
CALL forge_push_branch [ctl/harness/state/lanes/1] [factory/task/T-10] [main]
CALL forge_story_pr_sync [ctl/harness/state/lanes/1] [main] [main] [feat(STORY-2): story PR] ready=[true] was_ready=[false]
   | story-body(STORY-2|main|main|2)
   |   row: T-10	<T-10 work>	1 file changed, 1 insertion(+) · merged-tree tests passed (pkg-a) · integration check not configured
LOG   + Integrator: pushed main and synced https://forge.invalid/pr/9 (ready for review)
METRIC {"event":"integration_story_pr_synced","task_id":"T-10","story_id":"STORY-2","pr_url":"https://forge.invalid/pr/9","ready":true,"at":"2026-10-18T00:00:00+00:00"}
LOG   + Integrator: main fast-forwarded to <T-10 work> (factory/task/T-10)
METRIC {"event":"integration_completed","task_id":"T-10","branch":"factory/task/T-10","base_sha":"<T-10 work>","at":"2026-10-18T00:00:00+00:00"}
rc=0 reason=[] pr=[|] story_pr=[https://forge.invalid/pr/9]
-- the story record:
   url=https://forge.invalid/pr/9
   branch=main
   base=main
   ready=true
   tasks: T-10	<T-10 work>	1 file changed, 1 insertion(+) · merged-tree tests passed (pkg-a) · integration check not configured
-- main:
   T-10 work
   main edits app.txt
   T-7 work
   main bumps the lockfile again
   T-5 work
   main bumps the lockfile
   T-4 work
   T-3 work
   T-2 work
   T-1 work
   base
-- push refused: nothing recorded, base unmoved
CALL run_scoped_tests [<T-10 work>]
CALL forge_push_branch [ctl/harness/state/lanes/1] [factory/task/T-11] [main]
ERR   x Integrator: story PR sync for STORY-2 failed — push-rejected: non-fast-forward; main unmoved
rc=1 reason=[push-rejected: non-fast-forward] pr=[|] story_pr=[]
   tasks: T-10	<T-10 work>	1 file changed, 1 insertion(+) · merged-tree tests passed (pkg-a) · integration check not configured
### FactoryOS handoff tasks
-- outside pr mode
ERR   x Integrator: handoff-needs-pr-mode: H-1 is a FactoryOS handoff, which only ever opens a PR (integration.mode is local-ff)
rc=3 reason=[handoff-needs-pr-mode: H-1 is a FactoryOS handoff, which only ever opens a PR (integration.mode is local-ff)] pr=[|] story_pr=[]
-- a malformed marker
ERR   x Integrator: handoff-marker-invalid: 'bogus' in harness/state/handoffs/H-1
rc=3 reason=[handoff-marker-invalid: 'bogus' in harness/state/handoffs/H-1] pr=[|] story_pr=[]
-- the target branch moved
CALL forge_remote_base [ctl/harness/state/lanes/1] [release]
CALL handoff_base_current [<T-10 work>] [<T-10 work>] [origin/release] [ctl/harness/state/lanes/1]
ERR   x Integrator: handoff-base-advanced: release moved
METRIC {"event":"handoff_base_advanced","recorded":"<T-10 work>","remote":"<T-10 work>","reason":"handoff-base-advanced","at":"2026-10-18T00:00:00+00:00"}
rc=1 reason=[handoff-base-advanced: release moved] pr=[|] story_pr=[]
-- moved forward under handoff_base: descendant; PR opened from the recorded base
CALL forge_remote_base [ctl/harness/state/lanes/1] [release]
CALL handoff_base_current [<T-10 work>] [<T-10 work>] [origin/release] [ctl/harness/state/lanes/1]
LOG   ! Integrator: origin/release moved forward from the handoff's recorded base (<T-10 work> → <T-10 work>) — opening the PR from the recorded base, not rebasing (integration.handoff_base: descendant); rebasing is explicit: harness story rebase
METRIC {"event":"handoff_base_descendant","recorded":"<T-10 work>","remote":"<T-10 work>","at":"2026-10-18T00:00:00+00:00"}
CALL run_scoped_tests [<T-10 work>]
CALL handoff_pr_branch_guard [ctl/harness/state/lanes/1] [<H-1 work>] [factory/task/H-1] [release]
CALL forge_push_branch [ctl/harness/state/lanes/1] [factory/task/H-1] [factory/task/H-1]
CALL forge_open_pr [ctl/harness/state/lanes/1] [factory/task/H-1] [release] [feat: H-1] [body(H-1||factory/task/H-1|release|marker=factory-work:v1:00000000-0000-0000-0000-000000000001|base=<T-10 work>)]
LOG   + Integrator: pushed factory/task/H-1 and opened https://forge.invalid/pr/7 — release unmoved
METRIC {"event":"integration_pr_opened","task_id":"H-1","branch":"factory/task/H-1","pr_url":"https://forge.invalid/pr/7","at":"2026-10-18T00:00:00+00:00"}
rc=0 reason=[] pr=[https://forge.invalid/pr/7|factory/task/H-1] story_pr=[]
-- the lane does not start from the recorded base
CALL forge_remote_base [ctl/harness/state/lanes/1] [release]
CALL handoff_base_current [<main moves past the handoff base>] [<main moves past the handoff base>] [origin/release] [ctl/harness/state/lanes/1]
ERR   x Integrator: handoff-lane-off-base: the lane does not start from the recorded base <main moves past the handoff base> — nothing pushed
rc=1 reason=[handoff-lane-off-base: the lane does not start from the recorded base <main moves past the handoff base> — nothing pushed] pr=[|] story_pr=[]
### base drift (team mode only, report only)
solo rc=0
LOG   ! Integrator: base drift not checked — no origin remote
fetch failed rc=0
LOG   ! Integrator: base drift not checked — no merge base with origin/main
no merge base rc=0
LOG   = Integrator: origin/main has not moved past the base of main (aaaaaaaaaaaa)
not moved rc=0
LOG   ! Integrator: origin/main has moved 3 commit(s) past the base of main (aaaaaaaaaaaa → bbbbbbbbbbbb) — integrating onto the branch as it is; rebasing is explicit: harness story rebase KEY-1
METRIC {"event":"integration_base_moved","branch":"main","default_branch":"main","behind":3,"base":"aaaaaaaaaaaaaaaa","origin_tip":"bbbbbbbbbbbbbbbb","at":"2026-10-18T00:00:00+00:00"}
moved rc=0
-- inside an integration:
LOG   ! Integrator: origin/main has moved 3 commit(s) past the base of main (aaaaaaaaaaaa → bbbbbbbbbbbb) — integrating onto the branch as it is; rebasing is explicit: harness story rebase KEY-1
METRIC {"event":"integration_base_moved","branch":"main","default_branch":"main","behind":3,"base":"aaaaaaaaaaaaaaaa","origin_tip":"bbbbbbbbbbbbbbbb","at":"2026-10-18T00:00:00+00:00"}
CALL run_scoped_tests [<main moves past the handoff base>]
LOG   + Integrator: main fast-forwarded to <T-12 work> (factory/task/T-12)
METRIC {"event":"integration_completed","task_id":"T-12","branch":"factory/task/T-12","base_sha":"<T-12 work>","at":"2026-10-18T00:00:00+00:00"}
rc=0 reason=[] pr=[|] story_pr=[]
### integrator_commit_state
first rc=0
clean rc=0
CALL queue_hash_guard [a hand-edited queue]
guard refuses rc=0
CALL queue_hash_guard [team]
LOG   = Team mode: orchestrator state stays local — no state commit (team)
team rc=0
CALL queue_hash_guard [solo]
LOG   + Committed orchestrator state (solo)
solo rc=0
   -- chore(state): solo
   Scheduler-authored orchestrator bookkeeping (queue transitions, blockers,
   metrics). Written by the integrator while holding integration.lock — a lane
   commits no state, so this is the only path queue history has (STORY-212).
   
   committed: exec-queue.txt
   committed: harness/state/blockers.md
   committed: harness/state/queue.txt
-- left uncommitted: [?? harness/state/.queue-guard/digest ?? harness/state/cancel/T-1 ?? harness/state/inbox/e.json ?? harness/state/leases/T-1/record ?? harness/state/stashed/x ]
CALL queue_hash_guard [a locked index]
ERR   ! Could not commit orchestrator state (a locked index) — see <T>/ctl/harness/state/logs/state-commit-20261018-000000-<PID>.log
commit failure rc=0
### park_commit_state
lanes off rc=0
dry run rc=0
LOG   + Committed orchestrator state (park at runner quota limit (2026-10-18 00:00:00))
lanes on rc=0
   lock: free (INTEGRATION_LOCK_HELD=false)
   -- chore(state): park at runner quota limit (2026-10-18 00:00:00)
LOG   + Committed orchestrator state (park at runner quota limit (2026-10-18 00:00:00))
lock already held rc=0
   lock: held by this shell (INTEGRATION_LOCK_HELD=true)
-- main:
   chore(state): park at runner quota limit (2026-10-18 00:00:00)
   chore(state): park at runner quota limit (2026-10-18 00:00:00)
   chore(state): solo
   T-12 work
   main moves past the handoff base
   T-10 work
   main edits app.txt
   T-7 work
   main bumps the lockfile again
   T-5 work
   main bumps the lockfile
   T-4 work
   T-3 work
   T-2 work
   T-1 work
   base
-- lanes dir files:
   ./.gitignore: # Worktree lanes: runtime state, never committed (STORY-212).|*|
   ./base.sha: <chore(state): park at runner quota limit (2026-10-18 00:00:00)#2>|
   ./control-heads.log: <T-1 work>|<T-1 work>|<T-1 work>|<T-2 work>|<T-2 work>|<T-3 work>|<T-3 work>|<T-4 work>|<T-4 work>|<T-5 work>|<T-5 work>|<T-7 work#2>|<T-7 work#2>|<T-9 work>|<T-10 work>|<T-10 work>|<T-12 work>|<T-12 work>|<chore(state): park at runner quota limit (2026-10-18 00:00:00)>|<chore(state): park at runner quota limit (2026-10-18 00:00:00)#2>|
   ./meta/1/last-acquire: mode: reset|needs_bootstrap: true|seconds: 0|reason: |needs_build: true|base: <main moves past the handoff base>|
   ./runtime.txt: lane runtime|
