{"record":{"id":"dd543f51c48408f2","repo":"Yeachan-Heo/oh-my-codex","slug":"shutdown-gate-blocked-pending-gate-pending-bloc","errorCode":null,"errorMessage":"shutdown_gate_blocked:pending=${gate.pending},blocked=${gate.blocked},in_progress=${gate.in_progress},failed=${gate.failed}","messagePattern":"shutdown_gate_blocked:pending=(.+?),blocked=(.+?),in_progress=(.+?),failed=(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"src/team/runtime.ts","lineNumber":4941,"sourceCode":"  );\n\n  const classification = await withTeamTaskMembershipBarrier(sanitized, cwd, async () => {\n    const current = await classifyShutdown({\n      teamName: sanitized,\n      cwd,\n      config: config!,\n      governance,\n      confirmIssues,\n    });\n    const { gate, requiresIssueConfirmation } = current;\n\n    if (!force && !gate.allowed) {\n      if (requiresIssueConfirmation) {\n        throw new Error(\n          `shutdown_confirm_issues_required:failed=${gate.failed}:rerun=omx team shutdown ${sanitized} --confirm-issues`,\n        );\n      }\n      throw new Error(\n        `shutdown_gate_blocked:pending=${gate.pending},blocked=${gate.blocked},in_progress=${gate.in_progress},failed=${gate.failed}`,\n      );\n    }\n\n    const now = new Date().toISOString();\n    const existingPhase = await readTeamPhaseState(sanitized, cwd);\n    const terminalReason = force ? 'forced_shutdown' : 'shutdown_gate_passed';\n    await writeTeamPhaseState(sanitized, {\n      current_phase: existingPhase?.current_phase ?? 'team-exec',\n      max_fix_attempts: existingPhase?.max_fix_attempts ?? 3,\n      current_fix_attempt: existingPhase?.current_fix_attempt ?? 0,\n      transitions: existingPhase?.transitions ?? [],\n      updated_at: now,\n      terminal_epoch: existingPhase?.terminal_epoch ?? now,\n      terminal_reason: existingPhase?.terminal_reason ?? terminalReason,\n      final_task_counts: {\n        total: gate.total,\n        pending: gate.pending,","sourceCodeStart":4923,"sourceCodeEnd":4959,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/runtime.ts#L4923-L4959","documentation":"Shutdown gate refusal: the gate is not allowed and issue confirmation is not the reason, so the message reports counts of pending, blocked, in_progress and failed tasks. Shutdown is blocked while work is still in flight.","triggerScenarios":"Calling shutdown without force while tasks are still pending, blocked, in_progress (or failed); the embedded counts tell you which categories are holding the gate.","commonSituations":"Shutting down a busy team; long-running tasks not yet finished; blocked tasks stuck on dependencies that were never resolved.","solutions":["Wait for or drive the listed in_progress/pending tasks to completion, unblock or cancel blocked tasks, then retry shutdown","Cancel/abandon tasks that no longer matter so the gate counts drop to zero","If deliberate, use the force shutdown option (with the caveat that in-flight work is destroyed)"],"exampleFix":"# before\nomx team shutdown myteam\n# error: pending=3,blocked=1,in_progress=2,failed=0\n\n# after\nomx team task wait myteam --all   # drain work first\nomx team shutdown myteam","handlingStrategy":"validation","validationCode":"const { gate } = await evaluateShutdownGate(teamName, {});\nif (!gate.allowed) throw new Error(`pending=${gate.pending} in_progress=${gate.in_progress}`);","typeGuard":null,"tryCatchPattern":"try { await shutdownTeam(t, cwd, {}); } catch (e) { if (/^shutdown_gate_blocked:/.test((e as Error).message)) { await drainTasks(t); await shutdownTeam(t, cwd, {}); } else throw e; }","preventionTips":["Drain or cancel all tasks before shutdown","Monitor gate counts as a pre-shutdown check","Reserve force for decommission scenarios"],"tags":["shutdown","gate","tasks-in-flight"],"backgroundTag":"operation-blocked-by-inflight-work","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}