{"record":{"id":"f918c1662697734b","repo":"Yeachan-Heo/oh-my-codex","slug":"sendtoworker-text-must-be-200-characters","errorCode":null,"errorMessage":"sendToWorker: text must be < 200 characters","messagePattern":"sendToWorker: text must be < 200 characters","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/team/tmux-session.ts","lineNumber":3738,"sourceCode":"  sleepFractionalSeconds(0.12);\n  const secondTarget = resolveTarget();\n  if (!secondTarget) return false;\n  runTmux(['send-keys', '-t', secondTarget, 'Enter']);\n  return true;\n}\n\nexport const normalizeTmuxCapture = sharedNormalizeTmuxCapture;\n\nfunction normalizeWorkerTriggerForDraftMatch(value: string | null | undefined): string {\n  // Codex/tmux can wrap long path-like trigger text after a hyphen, e.g.\n  // `worker-\\n  1/inbox.md`. Treat those visual wraps as the original token so\n  // delivery verification does not mistake an unsent draft for consumed input.\n  return normalizeTmuxCapture(value ?? '').replace(/-\\s+/g, '-');\n}\n\nfunction assertWorkerTriggerText(text: string): void {\n  if (text.length >= 200) {\n    throw new Error('sendToWorker: text must be < 200 characters');\n  }\n  if (text.trim().length === 0) {\n    throw new Error('sendToWorker: text must be non-empty');\n  }\n  if (text.includes(INJECTION_MARKER)) {\n    throw new Error('sendToWorker: injection marker is not allowed');\n  }\n}\n\nexport function sendToWorkerStdin(\n  stdin: Pick<NodeJS.WritableStream, 'write' | 'writable'> | null | undefined,\n  text: string,\n): void {\n  assertWorkerTriggerText(text);\n  if (!stdin || !stdin.writable) {\n    throw new Error('sendToWorkerStdin: stdin is not writable');\n  }\n  stdin.write(`${text}\\n`);","sourceCodeStart":3720,"sourceCodeEnd":3756,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/tmux-session.ts#L3720-L3756","documentation":"Guard inside assertWorkerTriggerText: worker trigger/draft text sent through tmux send-keys must stay under 200 characters. Long payloads wrapped in a single send-keys call can get truncated, interleaved, or misinterpreted by the terminal, so the library rejects them upfront rather than corrupting the worker's input stream.","triggerScenarios":"Calling sendToWorker / sendToWorkerStdin / submit flows with a text argument whose .length >= 200 — e.g. pasting a long prompt, a multi-line instruction, or programmatically generated command text into the trigger argument.","commonSituations":"User copy-pastes a long prompt into a trigger config; an orchestrator builds a trigger string from a template that grows past 200 chars; feeding a file path plus long args as one trigger.","solutions":["Shorten the trigger text to under 200 characters (move long content to stdin or a file the worker reads)","Split the payload: send short trigger via send-keys and long content via another channel (sendToWorkerStdin or file handoff)","Add a length check upstream in your own code with a clear user-facing error"],"exampleFix":"// before\nsendToWorkerStdin(worker.stdin, longPrompt); // 500 chars\n\n// after\nif (longPrompt.length >= 200) {\n  await writeToFile('/tmp/prompt.txt', longPrompt);\n  sendToWorkerStdin(worker.stdin, 'read /tmp/prompt.txt and proceed');\n} else {\n  sendToWorkerStdin(worker.stdin, longPrompt);\n}","handlingStrategy":"validation","validationCode":"const TRIGGER_MAX = 200;\nfunction isValidTriggerLen(text: string): boolean { return text.length < TRIGGER_MAX; }","typeGuard":"function isShortTrigger(text: string): boolean { return typeof text === 'string' && text.length < 200 && text.trim().length > 0; }","tryCatchPattern":null,"preventionTips":["Validate trigger length at config load time","Route long content through files or stdin, not trigger text"],"tags":["validation","input-length","tmux","send-keys"],"backgroundTag":"input-validation-failed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}