fix(core): expand merge-blocker statuses to cover all transient states

Audit of task.status assignments across packages/core and packages/engine
surfaced five additional transient/in-flight statuses that should block
auto-merge but weren't in BLOCKING_TASK_STATUSES:

- awaiting-approval — triage spec awaiting user approval
- needs-replan — scheduler/executor/triage signaled re-plan needed
- mission-validation — mission-level validation in flight
- queued — scheduler-side transient state
- stuck-killed — defensive guard; task killed by stuck detector

Each represents a state where finalizing the merge violates user intent
or invariants. Group the set with comments explaining the intent of each
group so future additions can be slotted appropriately.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-28 17:21:12 -07:00
parent 4f2f728350
commit fd99d227bc
2 changed files with 41 additions and 0 deletions

View File

@@ -2,15 +2,28 @@ import type { Task, WorkflowStepResult } from "./types.js";
const BLOCKING_TASK_STATUSES = new Set([
"failed",
// ── User-attention / awaiting-handoff states ─────────────────────────
"awaiting-inspection",
"awaiting-user-review",
"awaiting-approval", // triage spec awaiting user approval
// ── Active merge in-flight ───────────────────────────────────────────
"merging",
"merging-pr",
// ── Re-planning / triage states (scope not finalized) ────────────────
// A task in planning/triage hasn't finalized its scope yet — letting it
// merge skips the work the user moved it back to plan. Same for the legacy
// "specifying" alias migrated to "planning" in db.ts.
"planning",
"specifying",
"needs-replan", // scheduler/executor/triage signaled re-plan
// ── Mission-level validation in flight ───────────────────────────────
"mission-validation",
// ── Scheduler-side transient state ───────────────────────────────────
"queued", // scheduler placed the task in line; not finalized
// ── Abnormal termination — defensive guard ───────────────────────────
// Task was killed by the stuck detector. If it surfaces in in-review,
// it needs investigation, not auto-merge.
"stuck-killed",
]);
const NON_TERMINAL_STEP_STATUSES = new Set([