{"record":{"id":"33238b13bdc06da2","repo":"Hmbown/CodeWhale","slug":"update-the-computer-use-app-to-run-the-background-check","errorCode":null,"errorMessage":"Update the Computer Use app to run the background check.","messagePattern":"Update the Computer Use app to run the background check\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/tui/plugins/computer-use/app/background-check.mjs","lineNumber":13,"sourceCode":"import fs from \"node:fs\";\nimport path from \"node:path\";\nimport os from \"node:os\";\nimport crypto from \"node:crypto\";\nimport { spawn } from \"node:child_process\";\nimport { setTimeout as delay } from \"node:timers/promises\";\nimport { handle, closeSession } from \"../src/app-handler.mjs\";\n\n/** Uses the same daemon backend and cancellation path as connected hosts. */\nexport async function runBackgroundCheck({ bundle, demoDirectory } = {}) {\n  if (process.platform !== \"darwin\" || !bundle) throw new Error(\"The background check requires the installed macOS app.\");\n  const executable = path.join(bundle, \"Contents\", \"Resources\", \"Practice.app\", \"Contents\", \"MacOS\", \"practice\");\n  if (!fs.existsSync(executable)) throw new Error(\"Update the Computer Use app to run the background check.\");\n  const sessionId = `setup-${crypto.randomUUID()}`;\n  const controller = new AbortController();\n  const timer = setTimeout(() => controller.abort(), 15_000);\n  const child = spawn(executable, [], { stdio: [\"ignore\", \"pipe\", \"pipe\"] });\n  const scratch = fs.mkdtempSync(path.join(os.tmpdir(), \"cu-setup-capture-\"));\n  let ready = false, applied = null, latest = null, buffer = \"\", spawnError = null;\n  child.on(\"error\", error => { spawnError = error; });\n  child.stderr.on(\"data\", () => {});\n  child.stdout.setEncoding(\"utf8\");\n  child.stdout.on(\"data\", chunk => {\n    buffer += chunk;\n    if (buffer.length > 16_384) { controller.abort(); return; }\n    let newline;\n    while ((newline = buffer.indexOf(\"\\n\")) >= 0) {\n      const line = buffer.slice(0, newline); buffer = buffer.slice(newline + 1);\n      try { const result = JSON.parse(line); latest = result; if (result.event === \"ready\") ready = true; if (result.event === \"applied\") applied = result; } catch { /* Cocoa diagnostics are not receipts. */ }\n    }\n  });","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/plugins/computer-use/app/background-check.mjs#L1-L31","documentation":"After confirming a bundle path was given, runBackgroundCheck looks for the practice binary at <bundle>/Contents/Resources/Practice.app/Contents/MacOS/practice. If that file does not exist, the bundle is present but outdated or incomplete, so the check cannot launch the practice app. The message tells you to update the Computer Use app.","triggerScenarios":"Calling runBackgroundCheck({ bundle }) on macOS where fs.existsSync(<bundle>/Contents/Resources/Practice.app/Contents/MacOS/practice) is false — an old app version bundled before Practice.app was added, or a wrong/custom bundle path.","commonSituations":"Users running an older installed version of the Computer Use app that predates the background-check feature, or pointing bundle at a different .app (e.g. a stub or wrong install).","solutions":["Update the Computer Use macOS app to the latest version so the bundled Practice.app exists.","Verify the path exists before calling: fs.existsSync(path.join(bundle, 'Contents', 'Resources', 'Practice.app', 'Contents', 'MacOS', 'practice')).","Confirm the bundle path points at the real Computer Use app, not another .app or a symlink to a stale copy."],"exampleFix":"// before\nawait runBackgroundCheck({ bundle: \"/Applications/Computer Use.app\" }); // old install\n\n// after\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nconst exe = path.join(bundle, \"Contents\", \"Resources\", \"Practice.app\", \"Contents\", \"MacOS\", \"practice\");\nif (!fs.existsSync(exe)) {\n  console.error(\"Practice app missing — update Computer Use first.\");\n} else {\n  await runBackgroundCheck({ bundle });\n}","handlingStrategy":"validation","validationCode":"import fs from \"node:fs\";\nimport path from \"node:path\";\nconst exe = path.join(bundle, \"Contents\", \"Resources\", \"Practice.app\", \"Contents\", \"MacOS\", \"practice\");\nif (!fs.existsSync(exe)) throw new Error(\"Practice app missing — update the Computer Use app first.\");","typeGuard":null,"tryCatchPattern":"try {\n  await runBackgroundCheck({ bundle });\n} catch (e) {\n  if (String(e.message).includes(\"Update the Computer Use app\")) {\n    console.error(\"Install the latest Computer Use app, then retry.\");\n  }\n  throw e;\n}","preventionTips":["Keep the Computer Use app updated; the Practice.app binary only exists in recent versions.","Proactively probe for the practice executable before running any background-check flow.","Pin/verify the app version in setup scripts so stale installs are caught early."],"tags":["file-not-found","macos","app-bundle","version"],"backgroundTag":"file-not-found","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}