Persist the readiness signature, attempted head, result, and error kind before
the provider side effect. Reconcile queue, merge, failure, and restart states.
In scope
Add attempt-result and error-kind columns to CI per-PR state.
Round-trip the fields through every store path.
Classify only recognized legacy automatic-merge errors during migration.
Reserve an in_flight attempt in a transaction before the provider call.
Record failed and accepted results.
Reconcile active queue and merged observations as accepted.
Clear only typed automatic-merge errors.
Expire an unreconciled restart attempt to failed without resubmission.
Preserve same-head removal guards and changed-head requeue behavior.
Add store, evaluator, failure-injection, concurrency, and restart tests.
Out of scope
The HTTP retry command and frontend action.
New queue-removal classifications.
Acceptance
One readiness signature causes no more than one automatic provider request.
A storage failure causes no provider request and exposes a retryable error.
Queue or merged state repairs an ambiguous provider result safely.
Unrelated automation errors survive queue and merged reconciliation.
A changed eligible head can authorize one later attempt.
Verification
go test -tags fts5 ./internal/github ./internal/orchestrator -run 'Test.*(MergeAttempt|AutoMerge|QueueAttempt|MergeSignature)'
go test -race -tags fts5 ./internal/github ./internal/orchestrator -run 'Test.*(MergeAttempt|AutoMerge)'