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

delegation_only_violation

Error message

delegation_only_violation

What it means

Thrown when the team manifest's governance policy has delegation_only enabled and the assignment targets the reserved worker name 'leader-fixed'. Delegation-only mode forbids the leader from executing tasks directly.

Source

Thrown at src/team/runtime.ts:4694

export async function assignTask(
  teamName: string,
  workerName: string,
  taskId: string,
  cwd: string,
): Promise<void> {
  const sanitized = sanitizeTeamName(teamName);
  return await withTeamTaskMembershipBarrier(sanitized, cwd, async () => {
    const phaseState = await readTeamPhaseState(sanitized, cwd);
    if (phaseState?.terminal_epoch || (phaseState && isTerminalPhase(phaseState.current_phase))) {
      throw new Error(teamContinuationRequiredDiagnostic(phaseState));
    }
    const task = await readTask(sanitized, taskId, cwd);
    if (!task) throw new Error(`Task ${taskId} not found`);
  const manifest = await readTeamManifestV2(sanitized, cwd);
  const governance = resolveGovernancePolicy(manifest?.governance);

  if (governance.delegation_only && workerName === 'leader-fixed') {
    throw new Error('delegation_only_violation');
  }

  if (governance.plan_approval_required && task.requires_code_change === true) {
    const approved = await isTaskApprovedForExecution(sanitized, taskId, cwd);
    if (!approved) {
      throw new Error('plan_approval_required');
    }
  }
  const config = await readTeamConfig(sanitized, cwd);
  if (!config) throw new Error(`Team ${sanitized} not found`);
  const workerInfo = config.workers.find(w => w.name === workerName);
  if (!workerInfo) throw new Error(`Worker ${workerName} not found in team`);
  const dispatchPolicy = resolveDispatchPolicy(manifest?.policy, config.worker_launch_mode);

  const claim = await claimTask(sanitized, taskId, workerName, task.version ?? 1, cwd);
  if (!claim.ok) {
    if (claim.error === 'blocked_dependency') {
      throw new Error(`blocked_dependency:${(claim.dependencies ?? []).join(',')}`);

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Dispatch to a real worker name from config.workers instead of 'leader-fixed'
  2. If the leader must execute, disable delegation_only in the team manifest governance
  3. List valid worker names from the team config before choosing the assignee

Example fix

// before
await assignTask(team, taskId, 'leader-fixed', cwd);

// after
const config = await readTeamConfig(team, cwd);
const worker = config?.workers.find(w => w.name !== 'leader-fixed');
if (!worker) throw new Error('no delegatable worker configured');
await assignTask(team, taskId, worker.name, cwd);
Defensive patterns

Strategy: validation

Validate before calling

const config = await readTeamConfig(teamName, cwd);
const governance = resolveGovernancePolicy((await readTeamManifestV2(teamName, cwd))?.governance);
if (governance.delegation_only && workerName === 'leader-fixed') throw new Error('pick a real worker');

Try / catch

try { await assignTask(t, id, w, cwd); } catch (e) { if ((e as Error).message === 'delegation_only_violation') w = pickDelegatableWorker(t); else throw e; }

Prevention

When it happens

Trigger: Calling task assignment with workerName === 'leader-fixed' while the manifest governance resolves delegation_only to true (explicitly set or via defaults from resolveGovernancePolicy).

Common situations: Legacy scripts that hardcoded 'leader-fixed' as the worker; enabling delegation_only on an existing team without updating dispatch callers; default governance flipping delegation_only on after a version upgrade.

Related errors


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