{"record":{"id":"b3d741a1d690418b","repo":"stablyai/orca","slug":"timed-out-while-selecting-the-ibus-hangul-engine","errorCode":null,"errorMessage":"Timed out while selecting the IBus Hangul engine","messagePattern":"Timed out while selecting the IBus Hangul engine","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/run-terminal-ibus-hangul-e2e.mjs","lineNumber":112,"sourceCode":"    if (result.status !== 0) {\n      throw new Error(`Failed to configure IBus Hangul ${key}: ${result.stderr.trim()}`)\n    }\n  }\n}\n\nasync function waitForHangulEngine(ibusProcess) {\n  const deadline = Date.now() + 15_000\n  while (Date.now() < deadline) {\n    if (ibusProcess.exitCode !== null) {\n      throw new Error(`ibus-daemon exited early with code ${ibusProcess.exitCode}`)\n    }\n    const result = spawnSync('ibus', ['engine', 'hangul'], { stdio: 'pipe' })\n    if (result.status === 0) {\n      return\n    }\n    await delay(100)\n  }\n  throw new Error('Timed out while selecting the IBus Hangul engine')\n}\n\nasync function runInsideSession(evidenceDir) {\n  const ibusLogPath = path.join(evidenceDir, 'ibus-daemon.log')\n  const ibusLogFd = openSync(ibusLogPath, 'w')\n  const windowManagerLogPath = path.join(evidenceDir, 'xfwm4.log')\n  const windowManagerLogFd = openSync(windowManagerLogPath, 'w')\n  const evidence = {\n    display: process.env.DISPLAY ?? null,\n    ibusDaemonPid: null,\n    ibusGroupBeforeCleanup: [],\n    ibusGroupAfterCleanup: [],\n    playwrightPid: null,\n    windowManagerPid: null,\n    windowManagerGroupAfterCleanup: []\n  }\n  let ibusProcess\n  let windowManagerProcess","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/run-terminal-ibus-hangul-e2e.mjs#L94-L130","documentation":"waitForHangulEngine() polls `ibus engine hangul` every 100ms until it succeeds, with a hard 15s deadline. If the daemon stays alive but never accepts the hangul engine selection, the deadline expires and the harness gives up. This indicates the engine is registered but not becoming active — a softer failure than a crash.","triggerScenarios":"ibus-daemon is alive and responding but `ibus engine hangul` keeps returning non-zero for 15 seconds — e.g. the hangul engine is slow to initialize, the schema was set but the engine binary is missing, or DBus routing inside xvfb is delayed.","commonSituations":"Slow/loaded CI machine where engine activation exceeds 15s; ibus-hangul schema present but binary absent; a competing input source holding the active engine slot; DBus latency under xvfb-run.","solutions":["Increase the deadline in waitForHangulEngine() only if you have confirmed the engine does eventually activate (log timestamps).","Run `ibus list-engine` and confirm hangul appears; run `ibus engine hangul` by hand to see the actual error.","Pre-warm the daemon: start ibus-daemon earlier in the session and call `ibus engine hangul` once before the harness runs.","Reduce DBus/xvfb contention — close other IBus consumers on the session."],"exampleFix":"// before\nconst deadline = Date.now() + 15_000\n// after (only after confirming slow-but-successful activation)\nconst deadline = Date.now() + 45_000","handlingStrategy":"retry","validationCode":"// preflight: engine selectable at all\nconst { spawnSync } = require('node:child_process')\nconst r = spawnSync('ibus', ['list-engine'], { encoding: 'utf8' })\nif (!/hangul/i.test(r.stdout || '')) {\n  console.error('hangul engine not registered'); process.exit(1)\n}","typeGuard":null,"tryCatchPattern":"let lastErr\nfor (let attempt = 0; attempt < 3; attempt++) {\n  try { await waitForHangulEngine(ibusProcess); break }\n  catch (err) {\n    lastErr = err\n    if (/Timed out/.test(String(err))) { await delay(2000); continue }\n    throw err\n  }\n}\nif (lastErr) throw lastErr","preventionTips":["Pre-warm the engine with a single `ibus engine hangul` before the timed loop.","Tune the 15s deadline to the CI machine's typical activation latency.","Log each poll attempt's status output to diagnose slow activation."],"tags":["ibus","ime","timeout","polling","linux","e2e"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}