67220a14ea
Prevent phase2/phase3/all reruns from burning DashScope tokens unless GOOSE_V149_ALLOW_REAL_LLM=1 is explicitly set with human approval. Co-authored-by: Cursor <cursoragent@cursor.com>
73 lines
2.7 KiB
JavaScript
73 lines
2.7 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Supplement missing v1.49 migration evidence (Page Data, Memory verbal, no-think, WeChat, affinity, cost).
|
|
*/
|
|
import { spawnSync } from 'node:child_process';
|
|
import { checkPassed, classifyCheckResult } from './goose-v149-check-result.mjs';
|
|
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
import { loadMemindEnvFiles } from './memind-runtime-profile.mjs';
|
|
import { prepareGooseV149CheckEnv } from './goose-v149-canary.mjs';
|
|
import { enforceRealLlmGate } from './goose-v149-real-llm-gate.mjs';
|
|
|
|
const root = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
enforceRealLlmGate('run-goosed-v149-missing-evidence.mjs');
|
|
const checkEnv = prepareGooseV149CheckEnv({ ...process.env }, root);
|
|
if (!String(checkEnv.GOOSE_V149_MEMORY_VERBAL_FORCE_DEEP ?? '').trim()) {
|
|
checkEnv.GOOSE_V149_MEMORY_VERBAL_FORCE_DEEP = '0';
|
|
}
|
|
if (!String(checkEnv.GOOSE_V149_PORTAL_RESUME_TIMEOUT_MS ?? '').trim()) {
|
|
checkEnv.GOOSE_V149_PORTAL_RESUME_TIMEOUT_MS = '300000';
|
|
}
|
|
|
|
const checks = [
|
|
{ name: 'page-data', script: 'check-goosed-v149-page-data-evidence.mjs', required: true },
|
|
{ name: 'memory-verbal', script: 'check-goosed-v149-memory-verbal-recall.mjs', required: true },
|
|
{ name: 'no-think', script: 'check-goosed-v149-no-think-evidence.mjs', required: true },
|
|
{ name: 'wechat', script: 'check-goosed-v149-wechat-evidence.mjs', required: true },
|
|
{ name: 'session-affinity', script: 'check-goosed-v149-session-affinity-evidence.mjs', required: true },
|
|
{
|
|
name: 'cost',
|
|
script: 'check-goosed-v149-cost-smoke.mjs',
|
|
required: true,
|
|
},
|
|
];
|
|
|
|
function run(script) {
|
|
const result = spawnSync(process.execPath, [path.join(root, 'scripts', script)], {
|
|
cwd: root,
|
|
env: checkEnv,
|
|
encoding: 'utf8',
|
|
});
|
|
return {
|
|
ok: checkPassed(result),
|
|
outcome: classifyCheckResult(result),
|
|
stdout: result.stdout?.trim() ?? '',
|
|
stderr: result.stderr?.trim() ?? '',
|
|
};
|
|
}
|
|
|
|
const results = [];
|
|
for (const check of checks) {
|
|
const item = { ...check, ...run(check.script) };
|
|
results.push(item);
|
|
console.log(`[goose-v149-evidence] ${item.outcome} ${check.name}`);
|
|
if (item.stdout) console.log(item.stdout);
|
|
if (!item.ok && item.stderr) console.error(item.stderr);
|
|
}
|
|
|
|
const failedRequired = results.filter((item) => item.required && !item.ok);
|
|
const failedOptional = results.filter((item) => !item.required && !item.ok);
|
|
|
|
if (failedRequired.length) {
|
|
console.error(`GOOSE_V149_MISSING_EVIDENCE_FAIL: ${failedRequired.map((i) => i.name).join(', ')}`);
|
|
process.exit(1);
|
|
}
|
|
|
|
if (failedOptional.length) {
|
|
console.log(`GOOSE_V149_MISSING_EVIDENCE_OK_WITH_SKIPS: ${failedOptional.map((i) => i.name).join(', ')}`);
|
|
} else {
|
|
console.log('GOOSE_V149_MISSING_EVIDENCE_OK');
|
|
}
|