Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

fix(console): merge follow-ups - denied verify counts as failed, journaled-start TOCTOU test, paths convention

ruv0181befe7eb8
diff --git a/plugins/ruflo-console/hooks/ap-live.ts b/plugins/ruflo-console/hooks/ap-live.ts
index 0c7b635893..d98e207303 100644
--- a/plugins/ruflo-console/hooks/ap-live.ts
+++ b/plugins/ruflo-console/hooks/ap-live.ts
@@ -310,12 +310,12 @@ async function effectsOf(state: State, host: Host, loop: LoopState, mission: Mis
let ran = 0
let failed = 0
- // The envelope's verify commands run through the console, not the engine: where the person's settings deny the test class they are not run (the step is then unverified).
- for (const argv of store.preflight.test === 'deny' ? [] : env.verify) {
+ // The envelope's verify commands run through the console, not the engine: where the person's settings deny the test class they are never run, and each counts as a failed check (never as a pass).
+ for (const argv of env.verify) {
ran += 1
// The console runs these itself, so the person's own permission rules are asked first (a refusal is a failed check, never run), and a kill flag ends the list.
- if ((await verifyPermission(checks.get(state), argv)) === 'blocked' || (await killSeen(host.fs, state.cwd)) || store.loop.phase === 'stopped') {
+ if (store.preflight.test === 'deny' || (await verifyPermission(checks.get(state), argv)) === 'blocked' || (await killSeen(host.fs, state.cwd)) || store.loop.phase === 'stopped') {
failed += 1
continue
}
diff --git a/plugins/ruflo-console/tests/ap-review.spec.ts b/plugins/ruflo-console/tests/ap-review.spec.ts
index 04e4d542c3..16229840b5 100644
--- a/plugins/ruflo-console/tests/ap-review.spec.ts
+++ b/plugins/ruflo-console/tests/ap-review.spec.ts
@@ -25,7 +25,7 @@ describe('what the envelope really checks', () => {
const t = classifyTask('t1', 'Fix /work/repo/a.ts and copy it to /etc/cron.d/x', 'see https://evil.example.com/x and https://github.com/someone/else.git')
expect(t.path).toBe('/work/repo/a.ts')
- expect(t.paths).toEqual(['/etc/cron.d/x'])
+ expect(t.paths).toEqual(['/work/repo/a.ts', '/etc/cron.d/x'])
expect(t.hosts).toEqual(['evil.example.com', 'github.com'])
expect(t.repos).toEqual(['someone/else'])
})
@@ -142,7 +142,8 @@ describe('stop is never undone', () => {
await apTick(state, r.host, T0 + 1000)
expect(r.runs.some(a => a[0] === 'true')).toBe(false)
- expect(journal(r).find(e => e.t === 'step.done')).toMatchObject({ id: 's-verifyme0000008', verified: false })
+ expect(journal(r).some(e => e.t === 'step.done' && e.id === 's-verifyme0000008')).toBe(false)
+ expect(journal(r).some(e => e.t === 'step.failed' && e.id === 's-verifyme0000008')).toBe(true)
})
})
diff --git a/plugins/ruflo-console/tests/security-audit-live.spec.ts b/plugins/ruflo-console/tests/security-audit-live.spec.ts
index 1d68c80d6d..dcd8ecebce 100644
--- a/plugins/ruflo-console/tests/security-audit-live.spec.ts
+++ b/plugins/ruflo-console/tests/security-audit-live.spec.ts
@@ -122,6 +122,22 @@ describe('live: kill-switch latency and TOCTOU', () => {
await apTick(state, r.host, T0 + 1000)
expect(r.runs.some(a => a[0] === 'true')).toBe(true)
+ expect(r.prompts).toEqual([])
+ // The review's stop-race re-read catches it before the step is even journaled: nothing is started, nothing handed over.
+ expect(journal(r).some(e => e.t === 'step.started' && e.id !== 's-dangling00001')).toBe(false)
+ })
+
+ it('a kill flag that appears while the step start is being journaled still stops the hand-over (the recheck right before it)', async () => {
+ const r = rig()
+ const state = stateWith([task('r1', 'completed'), task('r2', 'pending'), task('r3', 'pending')])
+
+ started(r, [dangling()])
+ wireAutopilot(state, r.host)
+ storeOf(state).bootMs = T0 - 1
+ ready(state, T0 + 1000)
+ r.onAppend.fn = text => { if (text.includes('"t":"step.started"')) r.files.set(KILL, ''); return text }
+ await apTick(state, r.host, T0 + 1000)
+
expect(r.prompts).toEqual([])
expect(journal(r).some(e => e.t === 'step.failed' && e.why.includes('stopped before the hand-over'))).toBe(true)
})