{"record":{"id":"e083a6c256aab9d9","repo":"Hmbown/CodeWhale","slug":"the-text-received-by-the-practice-window-did-not-match-check","errorCode":null,"errorMessage":"The text received by the practice window did not match. Check the app log and retry.","messagePattern":"The text received by the practice window did not match\\. Check the app log and retry\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/tui/plugins/computer-use/app/background-check.mjs","lineNumber":74,"sourceCode":"          await delay(100, undefined, { signal: controller.signal });\n        }\n      }\n    }\n    const entry = state.elements.find(element => element.role === \"AXTextField\" && element.label === \"Practice text\");\n    const apply = state.elements.find(element => element.role === \"AXButton\" && element.label === \"Apply\");\n    if (!entry || !apply) throw new Error(\"The practice controls could not be read. Check Accessibility permission and retry.\");\n    // Backend targets are resolved AX records, using the exact state index.\n    const focus = await call(\"resolve_element\", { app_ref: { pid: child.pid }, windowIndex: entry.windowIndex, path: entry.path });\n    if (!focus.found) throw new Error(\"The practice text field changed. Run the check again.\");\n    await call(\"left_click\", { target: { ...focus.element, type: \"element\", app_ref: { pid: child.pid } } });\n    const phrase = \"Background check complete 🐋\";\n    await call(\"type\", { text: phrase });\n    if (demoDirectory) await call(\"screenshot\", { app_ref: { pid: child.pid }, path: path.join(demoDirectory, \"02-entered.png\") });\n    const button = await call(\"resolve_element\", { app_ref: { pid: child.pid }, windowIndex: apply.windowIndex, path: apply.path });\n    if (!button.found) throw new Error(\"The practice Apply button changed. Run the check again.\");\n    await call(\"left_click\", { target: { ...button.element, type: \"element\", app_ref: { pid: child.pid } } });\n    await until(() => applied);\n    if (applied.value !== phrase) throw new Error(\"The text received by the practice window did not match. Check the app log and retry.\");\n    const capture = await call(\"screenshot\", { app_ref: { pid: child.pid }, path: path.join(scratch, \"practice.png\") });\n    if (demoDirectory) fs.copyFileSync(capture.file, path.join(demoDirectory, \"03-verified.png\"));\n    if (capture.app_ref?.pid !== child.pid || !capture.pixels?.w || !capture.pixels?.h) throw new Error(\"The practice window screenshot could not be verified. Check Screen Recording permission.\");\n    const count = latest.samples;\n    await until(() => latest.samples > count);\n    const isolated = latest.samples > 0 && latest.pointerChanges === 0 && latest.foregroundChanges === 0;\n    return { ok: isolated, edited: true, screenshot: true, samples: latest.samples, pointerChanges: latest.pointerChanges, foregroundChanges: latest.foregroundChanges,\n      message: isolated ? \"Text entered, Apply verified and the practice window captured. Your foreground app and pointer stayed unchanged.\"\n        : \"Edit and screenshot verified. Your app or pointer moved during the check, so background isolation is inconclusive.\" };\n  } finally {\n    clearTimeout(timer);\n    try { await closeSession(sessionId); }\n    finally {\n      if (child.exitCode === null && child.signalCode === null) child.kill(\"SIGTERM\");\n      fs.rmSync(scratch, { recursive: true, force: true });\n    }\n  }\n}","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/plugins/computer-use/app/background-check.mjs#L56-L92","documentation":"After clicking Apply, the check waits for the 'applied' event and compares the value the practice window reports it received against the exact typed phrase 'Background check complete 🐋'. A mismatch means the text arrived altered (truncated, mis-encoded, or a different field received it). The check treats this as a typing/input-path failure and points you at the app log.","triggerScenarios":"In runBackgroundCheck, the 'applied' event fires but applied.value !== 'Background check complete 🐋' — e.g. partial keystroke delivery, Unicode/emoji handling issues, or the click landed before focus settled.","commonSituations":"Keyboard-synthesis drops under load, the text field not focused when typing started, non-ASCII/emoji handling bugs in the input path, or an overlong paste being truncated.","solutions":["Check the practice app's log to see exactly what text it received and where it diverged.","Re-run the check; transient focus or keystroke drops often pass on a second run.","If the emoji is consistently mangled, test whether plain-ASCII input works and report a Unicode typing bug in the computer-use backend."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await runBackgroundCheck({ bundle });\n} catch (e) {\n  if (String(e.message).includes(\"did not match\")) {\n    console.error(\"Typed text arrived altered — capture the practice app log and retry.\");\n  }\n  throw e;\n}","preventionTips":["Check the practice app log to see exactly what text was received.","Retry once — transient keystroke drops are the most common cause.","If non-ASCII/emoji consistently breaks, test plain ASCII and report a Unicode input bug."],"tags":["input","verification","unicode","computer-use"],"backgroundTag":"unexpected-response-shape","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"}