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(ruflo-console): palette and Approvals votes are cast as a registered hive worker

ruv096fb9968610
diff --git a/plugins/ruflo-console/hooks/palette.ts b/plugins/ruflo-console/hooks/palette.ts
index 58c5b16609..46d93b5601 100644
--- a/plugins/ruflo-console/hooks/palette.ts
+++ b/plugins/ruflo-console/hooks/palette.ts
@@ -83,9 +83,15 @@ export function paletteEntries(state: State, nowMs: number): PaletteEntry[] {
add('swarm-init', 'swarm', 'start a swarm: init hierarchical, max 8, specialized', { kind: 'spec', spec: swarmInit(), why: '' })
add('swarm-stop', 'swarm', 'stop the swarm', { kind: 'spec', spec: swarmStop(), why: '' })
- for (const proposal of state.snapshot?.hive?.pending.slice(-3) ?? []) {
- add(`vote-yes-${proposal.id}`, 'hive', `vote yes on ${proposal.type} (${proposal.id})`, { kind: 'spec', spec: vote(proposal.id, true), why: 'that proposal id cannot be passed to ruflo' })
- add(`vote-no-${proposal.id}`, 'hive', `vote no on ${proposal.type} (${proposal.id})`, { kind: 'spec', spec: vote(proposal.id, false), why: 'that proposal id cannot be passed to ruflo' })
+ // A vote counts only from a registered worker (the CLI exits 0 on a refused one), so the palette votes as the next
+ // worker that has not voted, as the Hive-Mind view does; with no worker left it says so instead of a silent no-op.
+ const hiveNow = state.snapshot?.hive ?? null
+
+ for (const proposal of hiveNow?.pending.slice(-3) ?? []) {
+ const why = 'no registered worker is left to vote as (hive-mind spawn adds workers), or the proposal id cannot be passed'
+
+ add(`vote-yes-${proposal.id}`, 'hive', `vote yes on ${proposal.type} (${proposal.id})`, { kind: 'spec', spec: hiveNow === null ? vote(proposal.id, true) : hiveVote(hiveNow, proposal, true), why })
+ add(`vote-no-${proposal.id}`, 'hive', `vote no on ${proposal.type} (${proposal.id})`, { kind: 'spec', spec: hiveNow === null ? vote(proposal.id, false) : hiveVote(hiveNow, proposal, false), why })
}
const hive = state.snapshot?.hive ?? null
diff --git a/plugins/ruflo-console/tests/actions.test.ts b/plugins/ruflo-console/tests/actions.test.ts
index f7a5fec53c..7cfcd67edd 100644
--- a/plugins/ruflo-console/tests/actions.test.ts
+++ b/plugins/ruflo-console/tests/actions.test.ts
@@ -4,6 +4,7 @@ import { RUFLO_FILES } from './fixtures/ruflo-run'
import { command, SESSION, worldOf } from './fixtures/world'
/** Every palette action that changes something: the selection it needs, and the head of the argv it must run. */
+// Hive votes are covered in palette.test.ts and hive.spec.ts: they need a world with registered workers.
const CASES: { id: string; setup?: string[]; text?: string; head: string[] }[] = [
{ id: 'task-claim', head: ['mcp', 'exec', '-t', 'claims_claim'] },
{ id: 'claim-release', head: ['mcp', 'exec', '-t', 'claims_release'] },
@@ -14,7 +15,6 @@ const CASES: { id: string; setup?: string[]; text?: string; head: string[] }[] =
{ id: 'spawn-tester', head: ['agent', 'spawn', '--type', 'tester'] },
{ id: 'swarm-init', head: ['swarm', 'init', '--topology', 'hierarchical', '--max-agents', '8', '--strategy', 'specialized'] },
{ id: 'swarm-stop', head: ['swarm', 'stop'] },
- { id: 'vote-no-proposal-1790903321981-23aov7', head: ['hive-mind', 'consensus', '--action', 'vote', '--proposal-id', 'proposal-1790903321981-23aov7', '--vote', 'no'] },
{ id: 'mh-audit', head: ['metaharness', 'oia-audit'] },
{ id: 'worker-optimize', head: ['hooks', 'worker', 'dispatch', '--trigger', 'optimize'] },
{ id: 'store', text: 'remember the login fix', head: ['memory', 'store', '--key'] },
diff --git a/plugins/ruflo-console/tests/palette.test.ts b/plugins/ruflo-console/tests/palette.test.ts
index eb2f83e281..7f38d753e2 100644
--- a/plugins/ruflo-console/tests/palette.test.ts
+++ b/plugins/ruflo-console/tests/palette.test.ts
@@ -1,5 +1,6 @@
import { describe, expect, mock, test } from 'claude-code/testing'
+import { HIVE_FILES, WORKERS } from './fixtures/hive'
import { RUFLO_FILES } from './fixtures/ruflo-run'
import { command, elementsOf, keyOf, paneAt, PLUGIN, SESSION, textOf, worldOf } from './fixtures/world'
@@ -67,8 +68,8 @@ describe('palette and /ruflo', () => {
expect((await $.command.run(command('run nope'))).text).toMatch(/^No palette entry "nope"/)
})
- test('approvals: a hive proposal is voted on in place, as console-operator, after a confirm', { options: { boot: false } }, async ($, on) => {
- const world = worldOf(on, RUFLO_FILES)
+ test('approvals: a hive vote is cast as a registered worker after a confirm, since only such a vote counts', { options: { boot: false } }, async ($, on) => {
+ const world = worldOf(on, { ...RUFLO_FILES, ...HIVE_FILES })
mock.clock(on)
await $.session.start(SESSION)
await $.command.run(command('approvals'))
@@ -78,10 +79,22 @@ describe('palette and /ruflo', () => {
await pane.press({ key: 'approve-0' })
await pane.press({ key: 'confirm' })
- expect(runsOf(world.runs, 'consensus')[0]?.slice(4)).toEqual(['hive-mind', 'consensus', '--action', 'vote', '--proposal-id', 'proposal-1790903321981-23aov7', '--vote', 'yes', '--voter-id', 'console-operator'])
+ const argv = runsOf(world.runs, 'consensus')[0]?.slice(4) ?? []
+
+ expect(argv.slice(0, 4)).toEqual(['hive-mind', 'consensus', '--action', 'vote'])
+ expect(WORKERS).toContain(argv[argv.indexOf('--voter-id') + 1])
await pane.unmount()
})
+ test('approvals: with no registered worker to vote as, nothing runs and it says why (the CLI would drop the vote silently)', { options: { boot: false } }, async ($, on) => {
+ const world = worldOf(on, RUFLO_FILES)
+ mock.clock(on)
+ await $.session.start(SESSION)
+
+ expect((await $.command.run(command('run vote-yes-proposal-1790903321981-23aov7'))).text).not.toMatch(/^Asked: /)
+ expect(runsOf(world.runs, 'consensus')).toHaveLength(0)
+ })
+
test('/ruflo help, an unknown word, and the hints when ruflo-mods or ruflo-swarm are not loaded', { options: { boot: false } }, async ($, on) => {
worldOf(on, RUFLO_FILES)
mock.clock(on)