From f54ace0edbc593d82b86921e02c7b7a22768b572 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 1 Nov 2026 14:30:53 +0000 Subject: [PATCH] fix(security): stop naming closed ruvnet/ruflo#3473 in the live defend crash message Ruflo 3.48.0 fixed the upstream text-mode crash after a defend detection. Verify already reads the `-o json` verdict rather than text mode, so a future crash seen there would be a different bug; the live failure message no longer blames the closed issue for it. The historical note stays in code comments and the docstring. Set ruvnet/ruflo#3473 to dispatched in the upstream dependency constraints registry with a dated history entry. --- .../agentic-dependency-constraints.json | 5 +++-- src/lib/live-checks.mjs | 12 ++++++++---- tests/kit/live-checks.test.mjs | 16 ++++++++++------ 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/lib/hook-audit/agentic-dependency-constraints.json b/src/lib/hook-audit/agentic-dependency-constraints.json index bb7c2fd9..bd369bc4 100644 --- a/src/lib/hook-audit/agentic-dependency-constraints.json +++ b/src/lib/hook-audit/agentic-dependency-constraints.json @@ -1670,13 +1670,14 @@ "mapping": "mapped", "kitImpact": { "refs": ["plan Branch 3 item 4: defend reporting tells a detection from the post-detection crash"], "files": ["src/lib/live-checks.mjs"] }, "adjustment": "verify reads `-o json`; text-mode crash is reported as a crash. Once a released Ruflo prints every detected threat and exits with its own verdict in text mode, nothing further is needed in ak.", - "status": "fixed-unreleased", + "status": "dispatched", "constraintIds": [], "history": [ { "date": "2026-09-26", "event": "filed" }, { "date": "2026-09-26", "event": "registered" }, { "date": "2026-09-27", "event": "watching", "note": "re-checked: still reproduces on 3.46.1 (text mode: 2 threat(s) detected, then [ERROR] Cannot read properties of undefined (reading 'color'), exit 1); ak x verify security now reads the -o json verdict" }, - { "date": "2026-09-27", "event": "closed", "note": "completed by PR 3477; not in 3.47.1" } + { "date": "2026-09-27", "event": "closed", "note": "completed by PR 3477; not in 3.47.1" }, + { "date": "2026-11-01", "event": "dispatched", "note": "released in Ruflo 3.48.0; opened a draft PR on upstream/ruvnet-ruflo-3473 that stops naming the closed issue in the live `-o json` crash message, since a crash seen on 3.48.0+ would be a different bug" } ] }, { diff --git a/src/lib/live-checks.mjs b/src/lib/live-checks.mjs index 3ff481ba..cfb9cb2c 100644 --- a/src/lib/live-checks.mjs +++ b/src/lib/live-checks.mjs @@ -211,7 +211,8 @@ export async function verifyMemory({ /** * The verdict `ruflo security defend -o json` prints after its banner: the last * complete top-level JSON object with a boolean `safe`, else null (no verdict, - * e.g. the text-mode crash after a detection, ruvnet/ruflo#3473). + * e.g. the text-mode crash after a detection seen through Ruflo 3.46.1, fixed + * upstream in 3.48.0 as ruvnet/ruflo#3473). * @param {string} stdout * @returns {{ safe: boolean, threats: number } | null} */ @@ -251,8 +252,9 @@ export async function verifySecurity({ runner = runCmd, cwd = process.cwd() } = else if (rufloBuiltinDefence()) { warn("aidefence missing: defend uses Ruflo's built-in engine; adaptive learning and the aidefence_* MCP tools are unavailable. Fix: ak sync"); } else { fail('aidefence missing — defend is silently non-functional (ruvnet/ruflo#2670). Fix: ak sync'); return false; } - // `-o json` because text-mode defend crashes after printing its detection - // count (ruvnet/ruflo#3473, still in 3.46.1); the JSON verdict does not. + // `-o json` regardless of host version: through 3.46.1, text-mode defend + // crashed after printing its detection count (ruvnet/ruflo#3473, fixed + // upstream in 3.48.0); the JSON verdict never did. const defend = (input) => runner('ruflo', ['security', 'defend', '-i', input, '-o', 'json']); const inj = await defend(DEFEND_INJECTION); const cln = await defend(DEFEND_CLEAN); @@ -260,8 +262,10 @@ export async function verifySecurity({ runner = runCmd, cwd = process.cwd() } = const clnVerdict = parseDefendVerdict(cln.stdout); if (!injVerdict || !clnVerdict) { const crashed = [inj, cln].some((r) => /\[ERROR\]/.test(`${r.stdout ?? ''}${r.stderr ?? ''}`)); + // The historical fix is ruvnet/ruflo#3473 (closed, released in 3.48.0); a + // crash seen here on a current host is a different bug, so it is not named. fail(crashed - ? 'defend crashed before reporting a verdict (ruvnet/ruflo#3473)' + ? 'defend crashed before reporting a verdict' : `defend returned no verdict (injection exit=${inj.code}, clean exit=${cln.code})`); good = false; } else if (!injVerdict.safe && injVerdict.threats > 0 && clnVerdict.safe) { diff --git a/tests/kit/live-checks.test.mjs b/tests/kit/live-checks.test.mjs index 372fdd4f..3045dfc2 100644 --- a/tests/kit/live-checks.test.mjs +++ b/tests/kit/live-checks.test.mjs @@ -280,10 +280,12 @@ test('the security check calls out the aidefence gap by name and stops early', a } finally { rmrf(secDir); } }); -// Ruflo 3.32.2+ ships a built-in defend engine (ruvnet/ruflo#2670), and in -// 3.46.1 text-mode defend still crashes after it detects a threat -// (ruvnet/ruflo#3473). The check reads the `-o json` verdict, so a detection is -// reported from the verdict and a crash as a crash, never a pass. +// Ruflo 3.32.2+ ships a built-in defend engine (ruvnet/ruflo#2670). Through +// 3.46.1, text-mode defend crashed after detecting a threat; fixed upstream +// in 3.48.0 (ruvnet/ruflo#3473). The check reads the `-o json` verdict +// regardless of host version, so a detection is reported from the verdict and +// a crash as a crash, never a pass; the runtime message no longer names the +// closed issue, since a future crash under `-o json` would be a different bug. const DEFEND_FIXTURES = new URL('../fixtures/ruflo-defend/', import.meta.url); const fixture = (name) => fs.readFileSync(new URL(name, DEFEND_FIXTURES), 'utf8'); @@ -346,7 +348,7 @@ test('verifySecurity reports a detection from the JSON verdict when only the bui } finally { cleanup(); } }); -test('verifySecurity reports the post-detection crash (ruvnet/ruflo#3473) as a crash and fails', async () => { +test('verifySecurity reports a post-detection crash as a crash and fails, without naming the closed ruvnet/ruflo#3473', async () => { seedHome(); const cleanup = securityTree({ aidefence: true, builtin: true }); try { @@ -356,7 +358,9 @@ test('verifySecurity reports the post-detection crash (ruvnet/ruflo#3473) as a c }); const { result, out } = await captureLog(() => live.verifySecurity({ runner })); assert.equal(result, false); - assert.match(out, /defend crashed before reporting a verdict \(ruvnet\/ruflo#3473\)/); + assert.match(out, /defend crashed before reporting a verdict/); + assert.doesNotMatch(out, /ruvnet\/ruflo#3473/, + 'the issue is fixed upstream (3.48.0); a future crash under -o json would be a different bug'); assert.doesNotMatch(out, /defend: flags injection/); } finally { cleanup(); } });