Fix address hallucination and duplicate status messages
- answerFor returning '' (intentionally blank) was treated as falsy, falling through to AI which fabricated "123 Main Street". Now empty string skips the field without triggering AI or reporting unknown. - status.mjs was printing to stdout AND sending via Telegram, causing OpenClaw to relay a duplicate plain-text copy. Now only prints to stdout when Telegram isn't configured. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -607,9 +607,10 @@ Answer:`;
|
||||
let formatHint = field.placeholder ? `(format: ${field.placeholder})` : '';
|
||||
if (field.type === 'number') formatHint = '(must be a number, no text or units)';
|
||||
let answer = this.answerFor(lbl);
|
||||
// answerFor returns null (no match) vs '' (intentionally blank — skip AI, leave empty)
|
||||
// For number fields, always try AI if no answer — LinkedIn validates them even if not marked required
|
||||
const needsAnswer = field.required || field.type === 'number';
|
||||
if (!answer && needsAnswer) {
|
||||
if (answer === null && needsAnswer) {
|
||||
answer = await this.aiAnswerFor(formatHint ? `${lbl} ${formatHint}` : lbl);
|
||||
if (answer) this.saveAnswer(lbl, answer);
|
||||
}
|
||||
@@ -618,6 +619,10 @@ Answer:`;
|
||||
const num = String(answer).replace(/[^\d.]/g, '');
|
||||
if (num) answer = num;
|
||||
}
|
||||
if (answer === '') {
|
||||
// Intentionally blank (e.g. street address) — skip without reporting unknown
|
||||
continue;
|
||||
}
|
||||
if (answer && answer !== this.profile.cover_letter) {
|
||||
const el = await byTag(field.tag);
|
||||
if (!el) continue;
|
||||
|
||||
@@ -267,9 +267,11 @@ if (jsonMode) {
|
||||
} else {
|
||||
const report = formatReport(status);
|
||||
const settings = loadConfig(resolve(__dir, 'config/settings.json'));
|
||||
// Always send via Telegram directly if configured (so markdown renders)
|
||||
// Send via Telegram directly if configured (so markdown renders)
|
||||
if (settings.notifications?.bot_token && settings.notifications?.telegram_user_id) {
|
||||
await sendTelegram(settings, report);
|
||||
// Don't also print to stdout — OpenClaw would relay it as a duplicate plain-text message
|
||||
} else {
|
||||
console.log(report);
|
||||
}
|
||||
console.log(report);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user