{"record":{"id":"d40d3561a74a0edf","repo":"Yeachan-Heo/oh-my-codex","slug":"canonical-scale-down-config-verification-failed","errorCode":null,"errorMessage":"canonical_scale_down_config_verification_failed","messagePattern":"canonical_scale_down_config_verification_failed","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"src/team/scaling.ts","lineNumber":2167,"sourceCode":"                index: worker.index,\n                pane_id: worker.pane_id,\n                pid: worker.pid ?? null,\n              })),\n            resource_workers: removableWorkers.map((worker) => ({\n              name: worker.name,\n              worktree_path: worker.worktree_path,\n              worktree_repo_root: worker.worktree_repo_root,\n              worktree_branch: worker.worktree_branch,\n              worktree_detached: worker.worktree_detached,\n              worktree_created: worker.worktree_created,\n              team_state_root: worker.team_state_root,\n            })),\n          };\n          await writeAtomic(cleanupDebtPath, JSON.stringify(cleanupDebtBase, null, 2));\n          await commitTeamMembershipTaskTransaction(sanitized, leaderCwd, membershipTransaction);\n          const committed = await readTeamConfig(sanitized, leaderCwd);\n          if (!committed || committed.workers.some((worker) => removableWorkerNames.has(worker.name))) {\n            throw new Error('canonical_scale_down_config_verification_failed');\n          }\n          config.workers = committed.workers;\n          config.worker_count = committed.worker_count;\n          for (const task of reconciledTasks) {\n            const reconciled = await readTask(sanitized, task.id, leaderCwd);\n            if (reconciled && (removableWorkerNames.has(reconciled.owner ?? '') || removableWorkerNames.has(reconciled.claim?.owner ?? ''))) {\n              throw new Error(`canonical_scale_down_task_verification_failed:${task.id}`);\n            }\n          }\n\n          // PID-less rollback records are cleanup debt, not effect authority. A\n          // fresh gone proof may resolve one, but a live or unavailable proof\n          // must remain debt rather than letting teardown adopt its current PID.\n          const pinnedPaneWorkers = removableWorkers.filter((worker): worker is WorkerInfo & {\n            pane_id: string;\n            pid: number;\n          } => (\n            typeof worker.pane_id === 'string'","sourceCodeStart":2149,"sourceCodeEnd":2185,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/scaling.ts#L2149-L2185","documentation":"After committing the scale-down membership transaction, re-reading the config still shows at least one removable worker present. The committed state does not reflect the removal, indicating a transaction/verification failure.","triggerScenarios":"scaleDown commits membershipTransaction then readTeamConfig returns a config containing a worker in removableWorkerNames.","commonSituations":"Another writer mutated the config between commit and verification; transaction journal replay overwriting the commit; filesystem caching or torn writes on the config file.","solutions":["Check for concurrent processes writing team config and stop them","Inspect/clear .membership-task-transaction.json and re-run scaleDown to reconcile","Read the config directly to confirm current membership, then retry removal for remaining workers"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (e) {\n  if ((e as Error).message === 'canonical_scale_down_config_verification_failed') {\n    await stopConcurrentWriters(team);\n    return retryScaleDownOnce();\n  }\n  throw e;\n}","preventionTips":["Ensure a single writer for team config (no concurrent CLI processes)","Investigate stuck membership transaction journals promptly"],"tags":["team","scale-down","transaction","verification","consistency"],"backgroundTag":"transaction-rollback-verification-failed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}