{"record":{"id":"06dd0a925d876ac0","repo":"jackwener/OpenCLI","slug":"waiting-for-boss-wt2-t-cookies","errorCode":null,"errorMessage":"Waiting for Boss wt2 / t cookies","messagePattern":"Waiting for Boss wt2 / t cookies","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"warning","filePath":"clis/boss/auth.js","lineNumber":46,"sourceCode":"      }\n      return { ok: true, user_type: userType };\n    })()\n  `);\n  if (probe?.kind === 'auth') throw new AuthRequiredError('zhipin.com', probe.detail);\n  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Boss probe: ${JSON.stringify(probe)}`);\n  return { user_type: probe.user_type };\n}\n\nregisterSiteAuthCommands({\n  site: 'boss',\n  domain: 'zhipin.com',\n  loginUrl: 'https://login.zhipin.com/',\n  columns: ['user_type'],\n  quickCheck: hasBossSessionCookie,\n  verify: verifyBossIdentity,\n  poll: async (page) => {\n    if (!await hasBossSessionCookie(page)) {\n      throw new AuthRequiredError('zhipin.com', 'Waiting for Boss wt2 / t cookies');\n    }\n    return verifyBossIdentity(page);\n  },\n});\n\nexport const __test__ = {\n  BOSS_GEEK_JOBS_URL,\n  verifyBossIdentity,\n};\n","sourceCodeStart":28,"sourceCodeEnd":56,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/boss/auth.js#L28-L56","documentation":"The boss auth poll callback throws AuthRequiredError with 'Waiting for Boss wt2 / t cookies' when, during the polling window after the user is sent to the login page, the browser still has no 'wt2' or 't' cookie. This is the poll-loop signal that login has not completed yet. The poller typically keeps retrying until the cookie appears or the timeout expires.","triggerScenarios":"During the interactive login flow (registerSiteAuthCommands poll): the user has not finished login (no SMS/QR verification), login is on a different browser profile/window, or the login page failed to set cookies because of a network/verification failure while polling continues.","commonSituations":"User slow to complete QR-code or SMS verification before poll timeout; automation browser window closed accidentally; login blocked by captcha; cookies set on a different domain variant (e.g. .zhipin.com subdomain mismatch) so getCookies({url:'https://www.zhipin.com'}) doesn't see them.","solutions":["Complete the login in the opened browser window (scan QR code / enter SMS code) before the poll timeout expires","Re-run the login command if the window closed or timed out; you get a fresh polling window","Confirm the browser window used for login is the CLI-managed automation profile, not your personal browser","If cookies are set but not seen, check cookie domain scope for wt2/t in DevTools and ensure no cookie-blocking extensions are active"],"exampleFix":"// before: closed login window, poll times out\n// after: keep the automation window open and finish verification\nawait opencli login boss; // then scan the QR code in the opened window\n// poll succeeds once wt2/t cookie lands","handlingStrategy":"retry","validationCode":"// Before waiting on the poll, confirm the login page is actually open\nconst url = page.url();\nif (!url.includes('login.zhipin.com') && !url.includes('zhipin.com')) {\n  console.warn('not on zhipin login; user cannot complete login');\n}","typeGuard":"function cookiesArrived(cookies) {\n  return Array.isArray(cookies) &&\n    cookies.some(c => c.name === 'wt2' || c.name === 't');\n}","tryCatchPattern":"try {\n  await waitForBossLogin(page, { timeoutMs: 120000 });\n} catch (err) {\n  if (err instanceof AuthRequiredError && err.message.includes('Waiting for Boss')) {\n    // login not completed within window — prompt and retry once\n    await promptUser('Finish the QR/SMS login in the automation browser, then press Enter');\n    return waitForBossLogin(page, { timeoutMs: 120000 });\n  }\n  throw err;\n}","preventionTips":["Keep the automation browser visible and do not close it during login polling","Complete QR/SMS verification promptly; use a generous poll timeout for manual login","Ensure cookie-blocking extensions or privacy settings are off for zhipin.com","Confirm the CLI-managed profile is the one being logged into, not a personal browser"],"tags":["authentication","cookies","login-flow","polling"],"backgroundTag":"missing-session-cookie","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}