From 00bcfaca53fcdf8f4d0631711d10955fa6acf16f Mon Sep 17 00:00:00 2001 From: Matthew Jackson Date: Fri, 6 Mar 2026 11:06:38 -0800 Subject: [PATCH] feat: include select options in unknown field reports and Telegram messages When a required select has no answer, the unknown field now includes the available options. Telegram notification shows them so the user knows exactly what to reply with. Co-Authored-By: Claude Opus 4.6 --- job_applier.mjs | 6 ++++-- lib/form_filler.mjs | 10 ++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/job_applier.mjs b/job_applier.mjs index 6f69ff2..72445d2 100644 --- a/job_applier.mjs +++ b/job_applier.mjs @@ -195,7 +195,8 @@ async function handleResult(job, result, results, settings, profile, apiKey) { case 'needs_answer': { const questionText = pending_question?.label || pending_question || 'Unknown question'; - console.log(` 💬 Unknown question — asking Claude: "${questionText}"`); + const questionOptions = pending_question?.options || []; + console.log(` 💬 Unknown question — asking Claude: "${questionText}"${questionOptions.length ? ` (options: ${questionOptions.join(', ')})` : ''}`); const aiAnswer = await generateAnswer(questionText, profile, apiKey, { title, company }); @@ -209,13 +210,14 @@ async function handleResult(job, result, results, settings, profile, apiKey) { `❓ *New question* — ${company} / ${title}`, ``, `*Question:* ${questionText}`, + questionOptions.length ? `*Options:* ${questionOptions.join(' | ')}` : '', ``, aiAnswer ? `*AI answer:*\n${aiAnswer}` : `_AI could not generate an answer._`, ``, `Reply with your answer to store it, or reply *ACCEPT* to use the AI answer.`, - ].join('\n'); + ].filter(Boolean).join('\n'); await sendTelegram(settings, msg); results.needs_answer++; diff --git a/lib/form_filler.mjs b/lib/form_filler.mjs index 538a854..39c1f75 100644 --- a/lib/form_filler.mjs +++ b/lib/form_filler.mjs @@ -306,8 +306,14 @@ export class FormFiller { } } } else if (await this.isRequired(sel)) { - // Non-EEO required select with no answer — report as unknown - unknown.push(lbl); + // Non-EEO required select with no answer — report as unknown with options + const opts = await sel.$$('option'); + const options = []; + for (const opt of opts) { + const text = (await opt.textContent().catch(() => '') || '').trim(); + if (text && !/^select/i.test(text)) options.push(text); + } + unknown.push({ label: lbl, type: 'select', options }); } } }