Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(doctor): embedding_identity_unqualified reads an optional fix argv (#6113)
garrytan170f9937ad94
diff --git a/src/commands/doctor/checks/embedding-identity.ts b/src/commands/doctor/checks/embedding-identity.tsindex 01d3a70286..4295e6d4e2 100644--- a/src/commands/doctor/checks/embedding-identity.ts+++ b/src/commands/doctor/checks/embedding-identity.ts@@ -45,12 +45,13 @@ async function runEmbeddingIdentity(ctx: DoctorContext): Promise<Check[]> {const { loadConfig } = await import('../../../core/config.ts');const configured = loadConfig()?.embedding_model?.trim() || null;const fix = embeddingIdentityFix(stored, configured);- const target = fix.argv[4]!;+ const argv = fix.argv ?? [];+ const target = argv[4]!;const differs = !fix.inputs && !target.endsWith(`:${stored}`);checks.push({name: 'embedding_identity_unqualified', status: 'warn',message: `The brain's embedding_model row is ${JSON.stringify(stored)} with no provider prefix (a row from an older install), so managed fact extraction stops with embedding_configuration; gbrain config set cannot change it. `- + `Preview the rewrite: ${fix.argv.join(' ')}${differs ? ` (the configured model ${target} is not ${stored}, so applying it switches models)` : ''}. Applying it re-embeds active facts and needs the user's paid authorization.`,+ + `Preview the rewrite: ${argv.join(' ')}${differs ? ` (the configured model ${target} is not ${stored}, so applying it switches models)` : ''}. Applying it re-embeds active facts and needs the user's paid authorization.`,details: { code: NAME, stored_model: stored, configured_model: configured, target_model: fix.inputs ? null : target, target_differs: differs },fix,});diff --git a/test/doctor-embedding-identity-unqualified.test.ts b/test/doctor-embedding-identity-unqualified.test.tsindex 72651c2956..0d29f299d3 100644--- a/test/doctor-embedding-identity-unqualified.test.ts+++ b/test/doctor-embedding-identity-unqualified.test.ts@@ -62,7 +62,7 @@ describe('doctor embedding_identity_unqualified (#6113)', () => {test('a configured model with another name is filled in and called out as a model switch', async () => {const check = await run('text-embedding-3-small', { embedding_model: 'voyage:voyage-4-lite' });- expect(check.fix?.argv[4]).toBe('voyage:voyage-4-lite');+ expect(check.fix?.argv?.[4]).toBe('voyage:voyage-4-lite');expect(check.details?.target_differs).toBe(true);expect(check.message).toContain('switches models');});