fix: audit bugs + better error logging for searcher debugging

Bugs fixed:
- form_filler.mjs: add missing await on el.evaluate() in getLabel()
- analyze_ats.mjs: check job.apply_type instead of non-existent job.easy_apply
- status.mjs: fix typo "that run" → "in that run"
- README: add missing lock.mjs to project structure

Logging improvements:
- job_searcher.mjs: log browser creation, login steps, stack traces on error
- linkedin.mjs/wellfound.mjs: catch and log navigation failures per keyword
- browser.mjs: descriptive errors for Kernel and CDP connection failures

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-05 17:28:23 -08:00
parent ec68e621b8
commit ed908c91af
8 changed files with 35 additions and 7 deletions

View File

@@ -38,9 +38,19 @@ export async function createBrowser(settings, profileKey) {
if (profileName) opts.profile = { name: profileName };
if (kernelConfig.proxy_id) opts.proxy = { id: kernelConfig.proxy_id };
const kb = await kernel.browsers.create(opts);
let kb;
try {
kb = await kernel.browsers.create(opts);
} catch (e) {
throw new Error(`Kernel browser creation failed: ${e.message}`);
}
const pw = await getChromium(playwrightPath);
const browser = await pw.connectOverCDP(kb.cdp_ws_url);
let browser;
try {
browser = await pw.connectOverCDP(kb.cdp_ws_url);
} catch (e) {
throw new Error(`CDP connection failed (browser ${kb.id}): ${e.message}`);
}
const ctx = browser.contexts()[0] || await browser.newContext();
const page = ctx.pages()[0] || await ctx.newPage();

View File

@@ -107,7 +107,7 @@ export class FormFiller {
}
async getLabel(el) {
return el.evaluate(node => {
return await el.evaluate(node => {
const id = node.id;
const forLabel = id ? document.querySelector(`label[for="${id}"]`)?.textContent?.trim() : '';
const ariaLabel = node.getAttribute('aria-label') || '';

View File

@@ -40,7 +40,12 @@ export async function searchLinkedIn(page, search, { onPage } = {}) {
}
const url = `${LINKEDIN_BASE}/jobs/search/?${params.toString()}`;
await page.goto(url, { waitUntil: 'domcontentloaded', timeout: NAVIGATION_TIMEOUT });
try {
await page.goto(url, { waitUntil: 'domcontentloaded', timeout: NAVIGATION_TIMEOUT });
} catch (e) {
console.error(` ⚠️ Navigation failed for "${keyword}": ${e.message}`);
continue;
}
await page.waitForTimeout(PAGE_LOAD_WAIT);
let pageNum = 0;

View File

@@ -23,7 +23,12 @@ export async function searchWellfound(page, search, { onPage } = {}) {
for (const keyword of search.keywords) {
const url = `${WELLFOUND_BASE}/jobs?q=${encodeURIComponent(keyword)}&remote=true`;
await page.goto(url, { waitUntil: 'domcontentloaded', timeout: SEARCH_NAVIGATION_TIMEOUT });
try {
await page.goto(url, { waitUntil: 'domcontentloaded', timeout: SEARCH_NAVIGATION_TIMEOUT });
} catch (e) {
console.error(` ⚠️ Navigation failed for "${keyword}": ${e.message}`);
continue;
}
await page.waitForTimeout(SEARCH_LOAD_WAIT);
// Scroll to bottom repeatedly to trigger infinite scroll