{"record":{"id":"72de99ebc624522b","repo":"stablyai/orca","slug":"built-watchdog-does-not-implement-the-requested","errorCode":null,"errorMessage":"Built watchdog does not implement the requested ${options.boundary} boundary; rebuild the matching revision","messagePattern":"Built watchdog does not implement the requested (.+?) boundary; rebuild the matching revision","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/hang-watchdog-memory-benchmark.mjs","lineNumber":375,"sourceCode":"  throw new Error('Electron trial exhausted launcher attempts')\n}\n\nfunction runBenchmark() {\n  if (process.platform !== 'darwin') {\n    throw new Error('The production watchdog is macOS-only; run this benchmark on macOS')\n  }\n  if (!existsSync(entryPath)) {\n    throw new Error(`Missing ${entryPath}; run pnpm exec electron-vite build first`)\n  }\n  const options = parseArgs(process.argv.slice(2))\n  const builtEntry = readFileSync(entryPath, 'utf8')\n  const hasChildContract = builtEntry.includes('ORCA_HANG_WATCHDOG_PARENT_PID')\n  const hasWorkerContract = builtEntry.includes('workerData') && builtEntry.includes('parentPort')\n  if (\n    (options.boundary === 'child' && !hasChildContract) ||\n    (options.boundary === 'worker' && !hasWorkerContract)\n  ) {\n    throw new Error(\n      `Built watchdog does not implement the requested ${options.boundary} boundary; rebuild the matching revision`\n    )\n  }\n  const executable = electronPath()\n  const results = Array.from({ length: options.trials }, () =>\n    runTrial(executable, options.boundary)\n  )\n  const rssBytes = results.map((result) => result.rssBytes)\n  const summedProcessRssDeltaBytes = results.map((result) => result.summedProcessRssDeltaBytes)\n  const physicalFootprintDeltaBytes = results.map((result) => result.physicalFootprintDeltaBytes)\n  const startupMs = results.map((result) => result.startupMs)\n  const cpuMs = results.map((result) => result.cpuMs)\n  const eventLoopDelayP95Ms = results.map((result) => result.eventLoopDelayP95Ms)\n  const eventLoopDelayP99Ms = results.map((result) => result.eventLoopDelayP99Ms)\n  const eventLoopDelayMaxMs = results.map((result) => result.eventLoopDelayMaxMs)\n  const report = {\n    benchmark: 'hang-watchdog-memory',\n    boundary: options.boundary,","sourceCodeStart":357,"sourceCodeEnd":393,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/hang-watchdog-memory-benchmark.mjs#L357-L393","documentation":"Thrown by runBenchmark() when the built watchdog entry exists but does not contain the contract markers for the requested boundary. For boundary 'child' it checks the entry source includes 'ORCA_HANG_WATCHDOG_PARENT_PID'; for 'worker' it checks both 'workerData' and 'parentPort'. A mismatch means the built artifact implements a different boundary than requested — typically a stale build from a different revision.","triggerScenarios":"The entry at out/ was built from a revision that only implemented the child boundary, but --boundary worker is requested (or vice versa); the boundary feature was added/removed between the build and the run; or the contract marker string was renamed in source without rebuilding.","commonSituations":"Forgetting to rebuild after switching branches/git revs, CI caching a stale out/ directory, or testing a revision where the boundary was not yet implemented.","solutions":["Rebuild the entry from the revision under test: `pnpm exec electron-vite build`.","Ensure the checked-out source implements the requested boundary (the markers exist in src) before building.","Clear a stale out/ cache: remove out/ and rebuild.","Verify with: `grep -c ORCA_HANG_WATCHDOG_PARENT_PID out/main/main-thread-hang-watchdog-entry.js`."],"exampleFix":"# before: out/ built from a child-only revision\nnode ... --boundary worker  # throws\n# after\ngit checkout <worker-revision> && pnpm exec electron-vite build && node ... --boundary worker","handlingStrategy":"validation","validationCode":"const built = readFileSync(entryPath, 'utf8')\nconst hasChild = built.includes('ORCA_HANG_WATCHDOG_PARENT_PID')\nconst hasWorker = built.includes('workerData') && built.includes('parentPort')\nif (boundary === 'child' && !hasChild) throw new Error('rebuild: entry lacks child contract')\nif (boundary === 'worker' && !hasWorker) throw new Error('rebuild: entry lacks worker contract')","typeGuard":"const boundaryImplementsContract = (src: string, boundary: 'child' | 'worker'): boolean =>\n  boundary === 'child'\n    ? src.includes('ORCA_HANG_WATCHDOG_PARENT_PID')\n    : src.includes('workerData') && src.includes('parentPort')","tryCatchPattern":null,"preventionTips":["Rebuild out/ after every branch/revision switch.","Clear stale out/ caches in CI rather than reusing them across revs."],"tags":["benchmark","build-artifact","boundary","stale-build","watchdog"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}