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): approvals badge counts only rows with an approve/deny action (0.40.3, #3920)

rba810a05fbda
diff --git a/plugins/ruflo-console/.claude-plugin/plugin.json b/plugins/ruflo-console/.claude-plugin/plugin.json
index 4986653a4f..6b27e865fe 100644
--- a/plugins/ruflo-console/.claude-plugin/plugin.json
+++ b/plugins/ruflo-console/.claude-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "ruflo-console",
"description": "ruflo's cockpit inside Claude Code and the one /ruflo command for every ruflo mod (function hooks, early access). Views: overview with health alerts, swarm topology graph, claims flow with TTL rings, federation map, plugin health matrix, learning curve and pipeline, MetaHarness radar and audit trend, memory, cost gauge, agent timeline, approvals queue, event stream, a main menu, an x.ruv.io federation board, an AI terminal (codex, claude or both in remembered sessions, streamed), Skills (npx skills), a Hive-Mind view, a MetaHarness lab, agent drill-down; a command palette for confirm-gated actions through the ruflo CLI; a band above the prompt. Reads ruflo's files and the CLI's local JSON; anything not measured reads n/a. The one network call it makes by itself is a daily read of the published plugin.json at github.com/ruvnet/ruflo to offer an update (Settings → Updates: ask, auto, or off); it installs only through Claude Code's own claude plugin update, and never a new major version without asking.",
- "version": "0.40.2",
+ "version": "0.40.3",
"author": {
"name": "ruvnet",
"url": "https://github.com/ruvnet"
diff --git a/plugins/ruflo-console/CHANGELOG.md b/plugins/ruflo-console/CHANGELOG.md
index cc8902dba3..8cd877ad80 100644
--- a/plugins/ruflo-console/CHANGELOG.md
+++ b/plugins/ruflo-console/CHANGELOG.md
@@ -2,6 +2,9 @@
Newest first. One `## <version> — <date>` heading per version, then `feat:`, `fix:`, `breaking:` and `chore:` bullets (ADR-478). Built from git history; older versions: `git log -- plugins/ruflo-console`.
+## 0.40.3 — 2026-10-08
+- fix: the approvals badge (band "n to approve", menu badge, change notices, and the Approvals header) counts only rows a person can act on; a refused mod or a permission deny has no approve or deny action, stays listed on the page as a notice, and no longer holds the badge up with nothing to press (#3920)
+
## 0.40.2 — 2026-10-08
- fix: a Yes runs only the card it was pressed on: every confirm card has an id and the Yes, Always allow and Always accept buttons carry it, so a card that took the first one's place (the person's own ask) is never answered by a Yes meant for the old one; the stale Yes runs nothing and says so (ADR-450 T17)
- fix: an ask of Claude's that was screened first and landed after its tool call returned is checked against the level and Stop as they are when it lands; a level lowered meanwhile wins
diff --git a/plugins/ruflo-console/hooks/data/alerts.ts b/plugins/ruflo-console/hooks/data/alerts.ts
index 6d37afa859..45b1615d69 100644
--- a/plugins/ruflo-console/hooks/data/alerts.ts
+++ b/plugins/ruflo-console/hooks/data/alerts.ts
@@ -119,3 +119,8 @@ export function approvalsOf(state: State): Approval[] {
return out
}
+
+/** The approvals a person can act on: rows with at least one action. The rest (a refused mod, a permission deny) are notices that stay on the page but are not "waiting" (#3920). */
+export function waitingApprovalsOf(state: State): Approval[] {
+ return approvalsOf(state).filter(item => item.actions.length > 0)
+}
diff --git a/plugins/ruflo-console/hooks/menu-style.ts b/plugins/ruflo-console/hooks/menu-style.ts
index 63e7ba30a3..bb5603b3ef 100644
--- a/plugins/ruflo-console/hooks/menu-style.ts
+++ b/plugins/ruflo-console/hooks/menu-style.ts
@@ -7,7 +7,7 @@
* entry with nothing to say gets none, never a zero.
*/
import { activeMission, progressOf } from './mission-control'
-import { alertsOf, approvalsOf } from './data/alerts'
+import { alertsOf, waitingApprovalsOf } from './data/alerts'
import { secMemo } from './secure'
import type { State, ViewId } from './state'
import { hasUnseen } from './whatsnew'
@@ -24,7 +24,7 @@ export type Badge = { text: string; tone: 'attention' | 'plain' }
export function badgesOf(state: State, nowMs: number): Partial<Record<ViewId, Badge>> {
const out: Partial<Record<ViewId, Badge>> = {}
const snap = state.snapshot
- const approvals = approvalsOf(state).length
+ const approvals = waitingApprovalsOf(state).length
const alerts = alertsOf(state, nowMs, state.loadedAtMs).filter(alert => alert.level !== 'info').length
const mission = activeMission(state)
const busy = snap?.agents.filter(agent => /busy|active|working/i.test(agent.status)).length ?? 0
diff --git a/plugins/ruflo-console/hooks/notices.ts b/plugins/ruflo-console/hooks/notices.ts
index 9e5ae9d28c..2ba25085bf 100644
--- a/plugins/ruflo-console/hooks/notices.ts
+++ b/plugins/ruflo-console/hooks/notices.ts
@@ -4,7 +4,7 @@
* shown on the band's notice row for a short while, and linked to the view it is about. They come only from changes the console observed
* between two reads: nothing is synthesised, and the first read announces nothing. Pure, apart from the helpers that edit `state`.
*/
-import { alertsOf, approvalsOf } from './data/alerts'
+import { alertsOf, waitingApprovalsOf } from './data/alerts'
import { agentLabels } from './data/parse'
import { activeMission, failedOf, progressOf } from './mission-control'
import type { State, ViewId } from './state'
@@ -38,7 +38,7 @@ export function factsOf(state: State, nowMs: number = Date.now()): Facts {
const status = state.snapshot?.anatole?.status ?? null
return {
- approvals: approvalsOf(state).length,
+ approvals: waitingApprovalsOf(state).length,
alerts: alertsOf(state, nowMs, state.loadedAtMs).filter(alert => alert.level !== 'info').length,
mission: mission === null || progress === null ? null : { id: mission.id, done: progress.done, total: progress.total, failed: failedOf(mission, tasks) },
anatole: status === null ? null : { blocked: status.blocked, critical: status.open.critical, degraded: status.degraded === false ? null : String(status.degraded).slice(0, 60) },
diff --git a/plugins/ruflo-console/hooks/version.ts b/plugins/ruflo-console/hooks/version.ts
index 1f65fec634..698092864c 100644
--- a/plugins/ruflo-console/hooks/version.ts
+++ b/plugins/ruflo-console/hooks/version.ts
@@ -2,4 +2,4 @@
* The console's version, shown on the header so a person can tell which build is running. Kept equal to the plugin's manifest
* (`.claude-plugin/plugin.json`); tests/version.spec.ts fails if the two drift.
*/
-export const CONSOLE_VERSION = '0.40.2'
+export const CONSOLE_VERSION = '0.40.3'
diff --git a/plugins/ruflo-console/hooks/views/bar.ts b/plugins/ruflo-console/hooks/views/bar.ts
index 1ee0b1de18..5a9095ade9 100644
--- a/plugins/ruflo-console/hooks/views/bar.ts
+++ b/plugins/ruflo-console/hooks/views/bar.ts
@@ -8,7 +8,7 @@
import { activeMission, derive, progressOf } from '../mission-control'
import type { RenderElement } from 'claude-code'
-import { alertsOf, approvalsOf } from '../data/alerts'
+import { alertsOf, waitingApprovalsOf } from '../data/alerts'
import { agentLabels } from '../data/parse'
import { secMemo } from '../secure'
import type { State, ViewId } from '../state'
@@ -106,7 +106,7 @@ export function barParts(state: State, nowMs: number = Date.now()): BarPart[] {
const parts: BarPart[] = []
// What needs a person: approvals waiting and warn/bad alerts. Info alerts (a claim held for days) stay in the pane.
- const approvals = approvalsOf(state).length
+ const approvals = waitingApprovalsOf(state).length
const alerts = alertsOf(state, nowMs, state.loadedAtMs).filter(alert => alert.level !== 'info').length
if (approvals > 0) parts.push({ text: `${approvals} to approve (q)`, tone: 'attention', go: 'approvals' })
diff --git a/plugins/ruflo-console/hooks/views/manage.ts b/plugins/ruflo-console/hooks/views/manage.ts
index 208e2438a3..7f933a5995 100644
--- a/plugins/ruflo-console/hooks/views/manage.ts
+++ b/plugins/ruflo-console/hooks/views/manage.ts
@@ -4,7 +4,7 @@
*/
import type { RenderElement } from 'claude-code'
-import { approvalsOf } from '../data/alerts'
+import { approvalsOf, waitingApprovalsOf } from '../data/alerts'
import type { Lane } from '../gfx/maps'
import { button, col, paragraph, row, rule, text, THEME, type Ctx } from './common'
@@ -16,10 +16,13 @@ export function statsOf(lane: Lane, fromMs: number, nowMs: number): { observedMs
return { observedMs: Math.max(0, nowMs - first), busyMs: spans.filter(span => span.busy).reduce((sum, span) => sum + Math.max(0, span.toMs - Math.max(span.fromMs, fromMs)), 0), calls: lane.ticks.filter(at => at >= fromMs).length }
}
+/** The header count: what a person can act on, with the notices (refused mods, permission denies) named apart (#3920). */
+const headline = (all: number, waiting: number): string => (waiting === all ? `${all} waiting · j/k pick` : `${waiting} to approve · ${all - waiting} notice${all - waiting === 1 ? '' : 's'} · j/k pick`)
+
export function approvalsView(ctx: Ctx): RenderElement {
const items = approvalsOf(ctx.state)
const picked = items.length === 0 ? -1 : ((ctx.state.select.item % items.length) + items.length) % items.length
- const rows: RenderElement[] = [rule(ctx, 'Approvals', items.length === 0 ? 'nothing waiting' : `${items.length} waiting · j/k pick`)]
+ const rows: RenderElement[] = [rule(ctx, 'Approvals', items.length === 0 ? 'nothing waiting' : headline(items.length, waitingApprovalsOf(ctx.state).length))]
if (items.length === 0) {
rows.push(...paragraph(ctx, 'No hive-mind proposals, stealable claims, refused mods, permission denies or budget alerts waiting.', { dimColor: true }))
diff --git a/plugins/ruflo-console/scripts/smoke.sh b/plugins/ruflo-console/scripts/smoke.sh
index 1dcd9a2a49..d4da04c507 100755
--- a/plugins/ruflo-console/scripts/smoke.sh
+++ b/plugins/ruflo-console/scripts/smoke.sh
@@ -11,9 +11,9 @@ step() { printf "→ %s ... " "$1"; }
ok() { printf "PASS\n"; PASS=$((PASS+1)); }
bad() { printf "FAIL: %s\n" "$1"; FAIL=$((FAIL+1)); }
-step "1. plugin.json declares ruflo-console 0.40.2"
+step "1. plugin.json declares ruflo-console 0.40.3"
grep -q '"name": "ruflo-console"' "$ROOT/.claude-plugin/plugin.json" \
- && grep -q '"version": "0.40.2"' "$ROOT/.claude-plugin/plugin.json" && ok || bad "name/version"
+ && grep -q '"version": "0.40.3"' "$ROOT/.claude-plugin/plugin.json" && ok || bad "name/version"
step "2. hooks.json names exactly one module and no classic hook commands"
grep -q '"modules": \["./register.ts"\]' "$HOOKS/hooks.json" && ! grep -q '"command"' "$HOOKS/hooks.json" \
diff --git a/plugins/ruflo-console/tests/approvals-badge-3920.spec.ts b/plugins/ruflo-console/tests/approvals-badge-3920.spec.ts
new file mode 100644
index 0000000000..b4a85a27dc
--- /dev/null
+++ b/plugins/ruflo-console/tests/approvals-badge-3920.spec.ts
@@ -0,0 +1,46 @@
+/**
+ * #3920: the approvals badge counted notice rows (a refused mod, a permission deny) that have no approve or deny action,
+ * so "1 to approve" stayed up with nothing to press.
+ * npx vitest run plugins/ruflo-console/tests/approvals-badge-3920.spec.ts
+ */
+import { describe, expect, it } from 'vitest'
+
+import { approvalsOf, waitingApprovalsOf } from '../hooks/data/alerts'
+import { badgesOf } from '../hooks/menu-style'
+import { factsOf } from '../hooks/notices'
+import { newState } from '../hooks/state'
+import { barParts } from '../hooks/views/bar'
+
+describe('approvals badge counts only what a person can act on (#3920)', () => {
+ const noticesOnly = () => {
+ const state = newState({})
+
+ state.denied.push({ tool: 'Bash', reason: 'rm -rf is denied', atMs: 1 })
+ state.mods.push({ name: 'x', provenance: 'abc', isLoaded: false, reason: 'unsigned', atMs: 1 })
+
+ return state
+ }
+
+ it('lists the notice rows on the page but counts none of them as waiting', () => {
+ const state = noticesOnly()
+
+ expect(approvalsOf(state).map(item => item.kind)).toEqual(['mod-trust', 'policy-deny'])
+ expect(waitingApprovalsOf(state)).toEqual([])
+ })
+
+ it('shows no "to approve" on the band, no menu badge and no notice fact for notices alone', () => {
+ const state = noticesOnly()
+
+ expect(barParts(state, 0).some(part => /to approve/.test(part.text))).toBe(false)
+ expect(badgesOf(state, 0).approvals).toBeUndefined()
+ expect(factsOf(state, 0).approvals).toBe(0)
+ })
+
+ it('still counts a row that has an action', () => {
+ const state = noticesOnly()
+
+ state.ruflo.snapshot = { budget: { level: 'CRITICAL', usd: 9, limit: 10 } } as never
+ expect(waitingApprovalsOf(state).map(item => item.kind)).toEqual(['budget'])
+ expect(barParts(state, 0).find(part => /to approve/.test(part.text))?.text).toBe('1 to approve (q)')
+ })
+})
diff --git a/v3/docs/adr/ADR-430-console-main-menu-accents-chips-and-badges.md b/v3/docs/adr/ADR-430-console-main-menu-accents-chips-and-badges.md
index 46df7b0681..b41c14db8f 100644
--- a/v3/docs/adr/ADR-430-console-main-menu-accents-chips-and-badges.md
+++ b/v3/docs/adr/ADR-430-console-main-menu-accents-chips-and-badges.md
@@ -74,3 +74,7 @@ Every chip is now drawn **inverse**: the accent is the text's colour and `invers
What changes in the tests: the contrast check no longer measures dark ink on an accent (there is none); it holds each accent to a contrast of 4.5 as text on a dark terminal, the degraded case. And `tests/design.spec.ts` states the rule itself: rendering the menu, the nav card, the mission strip and the cost tags in the BBS look, no `Text` has a `backgroundColor` (checked by putting a fixed-ink chip back in the menu and watching it fail, naming the chip).
On a light terminal an inverse chip is the terminal's light background over the accent, which has weak contrast; the console's pages are designed for a dark terminal and this has not been looked at on a light one.
+
+## Update 2026-10-08: the approvals badge counts only actionable rows (0.40.3)
+
+The approvals badge on the menu, the band ("n to approve") and the change notices counted every row of the Approvals page, including a refused mod and a permission deny, which carry no approve or deny action. A single deny kept "1 to approve" up with nothing to press (#3920). The badge now counts `waitingApprovalsOf(state)`: rows with at least one action. The notice rows stay on the page, and its header names them apart (`1 to approve · 2 notices`). Regression test: `tests/approvals-badge-3920.spec.ts`.