{"record":{"id":"d95b26d4cfca21e1","repo":"Yeachan-Heo/oh-my-codex","slug":"authoritative-dispatch-rollback-discovery-failed","errorCode":null,"errorMessage":"authoritative_dispatch_rollback_discovery_failed:${[...names].join(',')}","messagePattern":"authoritative_dispatch_rollback_discovery_failed:(.+?)","errorType":"error_code","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"src/team/state.ts","lineNumber":2184,"sourceCode":"  workerNames: readonly string[],\n  cwd: string,\n): Promise<void> {\n  const names = new Set(workerNames);\n  await withDispatchLock(teamName, cwd, async () => {\n    // Do not derive rollback IDs from bridge-normalized root records: unscoped\n    // and other-team records can share a target worker name. This team's legacy\n    // file is the canonical rollback scope.\n    const requests = await readLegacyDispatchRequestsForRollback(teamName, cwd);\n    const legacyRequestIds = requests\n      .filter((request) => names.has(request.to_worker))\n      .map((request) => request.request_id);\n    let removedRequestIds = legacyRequestIds;\n    if (isBridgeEnabled()) {\n      const stateDir = resolveBridgeStateDir(cwd);\n      const bridge = getDefaultBridge(stateDir);\n      const snapshot = bridge.execCommand({ command: 'CaptureSnapshot' });\n      if (snapshot.event !== 'SnapshotCaptured') {\n        throw new Error(`authoritative_dispatch_rollback_discovery_failed:${[...names].join(',')}`);\n      }\n      const scopedAuthoritativeIds = bridge.readDispatchRecordsStrict()\n        .filter((record) => {\n          const metadataTeam = typeof record.metadata?.team_name === 'string' ? record.metadata.team_name : '';\n          return metadataTeam === teamName && names.has(record.target);\n        })\n        .map((record) => record.request_id);\n      removedRequestIds = [...new Set([...legacyRequestIds, ...scopedAuthoritativeIds])];\n      if (removedRequestIds.length === 0) {\n        await writeAtomic(dispatchRequestsPath(teamName, cwd), JSON.stringify(requests, null, 2));\n        return;\n      }\n      const removal = bridge.removeDispatchRecords(removedRequestIds);\n      if (\n        removal.event !== 'DispatchRecordsRemoved'\n        || removedRequestIds.some((requestId) => !removal.request_ids.includes(requestId))\n      ) {\n        throw new Error(`authoritative_dispatch_rollback_command_failed:${[...names].join(',')}`);","sourceCodeStart":2166,"sourceCodeEnd":2202,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/state.ts#L2166-L2202","documentation":"During dispatch rollback with the bridge enabled, the authoritative runtime failed to capture a snapshot (event !== 'SnapshotCaptured'), so the system cannot discover which authoritative dispatch records exist for the workers being removed. The message includes the comma-separated worker names.","triggerScenarios":"Calling dispatch rollback for workers while isBridgeEnabled() is true and bridge.execCommand({command:'CaptureSnapshot'}) returns an unexpected/failure event — bridge binary missing, crashed, protocol mismatch, or bad state dir.","commonSituations":"Bridge executable not installed or wrong version; resolveBridgeStateDir(cwd) pointing at an uninitialized state dir; bridge daemon down; version skew after upgrade.","solutions":["Verify the bridge runtime is installed and its state dir exists/is initialized (check resolveBridgeStateDir output)","Re-run the rollback — transient bridge failures may clear","Upgrade/downgrade-match the bridge binary to the library version","If bridge usage is optional, disable it for this operation so legacy path is used"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"import { existsSync } from 'node:fs';\nfunction bridgeReady(stateDir: string): boolean {\n  return existsSync(stateDir); // plus a probe CaptureSnapshot\n}","typeGuard":null,"tryCatchPattern":"catch (e) { if ((e as Error).message.startsWith('authoritative_dispatch_rollback_discovery_failed')) { await waitForBridgeHealth(); retryRollback(); } else throw e; }","preventionTips":["Health-check the bridge before rollback","Pin bridge and library versions together","Initialize the bridge state dir during setup"],"tags":["dispatch","rollback","bridge","snapshot"],"backgroundTag":"external-process-command-failed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}