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

sendToWorker: injection marker is not allowed

Error message

sendToWorker: injection marker is not allowed

What it means

Guard inside assertWorkerTriggerText: the trigger text must not contain the library's INJECTION_MARKER constant. The marker is used internally to verify that submitted text was consumed by the worker pane; embedding it in user text would break the delivery-verification heuristic and could be used to spoof verification.

Source

Thrown at src/team/tmux-session.ts:3744

export const normalizeTmuxCapture = sharedNormalizeTmuxCapture;

function normalizeWorkerTriggerForDraftMatch(value: string | null | undefined): string {
  // Codex/tmux can wrap long path-like trigger text after a hyphen, e.g.
  // `worker-\n  1/inbox.md`. Treat those visual wraps as the original token so
  // delivery verification does not mistake an unsent draft for consumed input.
  return normalizeTmuxCapture(value ?? '').replace(/-\s+/g, '-');
}

function assertWorkerTriggerText(text: string): void {
  if (text.length >= 200) {
    throw new Error('sendToWorker: text must be < 200 characters');
  }
  if (text.trim().length === 0) {
    throw new Error('sendToWorker: text must be non-empty');
  }
  if (text.includes(INJECTION_MARKER)) {
    throw new Error('sendToWorker: injection marker is not allowed');
  }
}

export function sendToWorkerStdin(
  stdin: Pick<NodeJS.WritableStream, 'write' | 'writable'> | null | undefined,
  text: string,
): void {
  assertWorkerTriggerText(text);
  if (!stdin || !stdin.writable) {
    throw new Error('sendToWorkerStdin: stdin is not writable');
  }
  stdin.write(`${text}\n`);
}

// Send SHORT text (<200 chars) to worker via tmux send-keys
// Validates: text < 200 chars, no injection marker
// Throws on violation
export async function sendToWorker(

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Strip or replace the marker from text before sending
  2. Do not feed captured pane output back as trigger text; construct triggers from your own constants
  3. If you need the literal marker for debugging, use a dedicated debug path rather than sendToWorker

Example fix

// before
sendToWorkerStdin(worker.stdin, capturedText); // contains INJECTION_MARKER

// after
const safe = capturedText.split(INJECTION_MARKER).join('[marker]');
sendToWorkerStdin(worker.stdin, safe);
Defensive patterns

Strategy: validation

Validate before calling

if (text.includes(INJECTION_MARKER)) text = text.split(INJECTION_MARKER).join('');

Prevention

When it happens

Trigger: Passing text that includes the INJECTION_MARKER substring to sendToWorker / sendToWorkerStdin — usually because the text was built by echoing captured pane output that already contains the marker back into a send call.

Common situations: Echoing pane captures back into send-keys; tests that reuse fixture strings containing the marker; copy-pasting from logs where the marker appears.

Related errors


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