Yeachan-Heo/oh-my-codex · critical · Error

authoritative_dispatch_rollback_discovery_failed:${[...names

Error message

authoritative_dispatch_rollback_discovery_failed:${[...names].join(',')}

What it means

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.

Source

Thrown at src/team/state.ts:2184

  workerNames: readonly string[],
  cwd: string,
): Promise<void> {
  const names = new Set(workerNames);
  await withDispatchLock(teamName, cwd, async () => {
    // Do not derive rollback IDs from bridge-normalized root records: unscoped
    // and other-team records can share a target worker name. This team's legacy
    // file is the canonical rollback scope.
    const requests = await readLegacyDispatchRequestsForRollback(teamName, cwd);
    const legacyRequestIds = requests
      .filter((request) => names.has(request.to_worker))
      .map((request) => request.request_id);
    let removedRequestIds = legacyRequestIds;
    if (isBridgeEnabled()) {
      const stateDir = resolveBridgeStateDir(cwd);
      const bridge = getDefaultBridge(stateDir);
      const snapshot = bridge.execCommand({ command: 'CaptureSnapshot' });
      if (snapshot.event !== 'SnapshotCaptured') {
        throw new Error(`authoritative_dispatch_rollback_discovery_failed:${[...names].join(',')}`);
      }
      const scopedAuthoritativeIds = bridge.readDispatchRecordsStrict()
        .filter((record) => {
          const metadataTeam = typeof record.metadata?.team_name === 'string' ? record.metadata.team_name : '';
          return metadataTeam === teamName && names.has(record.target);
        })
        .map((record) => record.request_id);
      removedRequestIds = [...new Set([...legacyRequestIds, ...scopedAuthoritativeIds])];
      if (removedRequestIds.length === 0) {
        await writeAtomic(dispatchRequestsPath(teamName, cwd), JSON.stringify(requests, null, 2));
        return;
      }
      const removal = bridge.removeDispatchRecords(removedRequestIds);
      if (
        removal.event !== 'DispatchRecordsRemoved'
        || removedRequestIds.some((requestId) => !removal.request_ids.includes(requestId))
      ) {
        throw new Error(`authoritative_dispatch_rollback_command_failed:${[...names].join(',')}`);

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Verify the bridge runtime is installed and its state dir exists/is initialized (check resolveBridgeStateDir output)
  2. Re-run the rollback — transient bridge failures may clear
  3. Upgrade/downgrade-match the bridge binary to the library version
  4. If bridge usage is optional, disable it for this operation so legacy path is used
Defensive patterns

Strategy: retry

Validate before calling

import { existsSync } from 'node:fs';
function bridgeReady(stateDir: string): boolean {
  return existsSync(stateDir); // plus a probe CaptureSnapshot
}

Try / catch

catch (e) { if ((e as Error).message.startsWith('authoritative_dispatch_rollback_discovery_failed')) { await waitForBridgeHealth(); retryRollback(); } else throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: Bridge executable not installed or wrong version; resolveBridgeStateDir(cwd) pointing at an uninitialized state dir; bridge daemon down; version skew after upgrade.

Related errors


AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27). Data as JSON: /api/errors/d95b26d4cfca21e1. Report an issue: GitHub.