From 60483318602a27202ec57d0a3b45b925000cb088 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 11 Oct 2026 05:19:25 +0000 Subject: [PATCH 1/2] fix(ruflo-swarm): add host-specific no-op manifest for native Codex hook discovery MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ruflo-swarm's hooks/hooks.json declares a Claude Code function-hook module (modules: ["./register.ts"]) for the live swarm pane. Codex's native plugin hook-manifest loader accepts only description and hooks at the top level and hard-fails with `unknown field "modules"`, dropping the plugin's hook registration entirely (#3688). Add plugins/ruflo-swarm/.codex-plugin/plugin.json, the native override Codex already prefers over .claude-plugin/plugin.json (same convention used by ruflo-adr/ruflo-ddd/ruflo-sparc), pointing at a new hooks/codex-hooks.json with an explicit no-op (`hooks: {}`). ruflo-swarm's function hooks are a pure UI pane with no guard/security logic to port, so an explicit no-op — not invented command hooks — is the correct fix, matching the issue's own proposed resolution. The Claude Code manifest and register.ts module are untouched. Co-Authored-By: RuFlo Claude-Session: https://claude.ai/code/session_01QFyyphjiSXRE1TS2rRnEwU --- plugins/ruflo-swarm/.codex-plugin/plugin.json | 12 ++++ plugins/ruflo-swarm/hooks/codex-hooks.json | 4 ++ .../codex-swarm-hook-manifest.test.mjs | 62 +++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 plugins/ruflo-swarm/.codex-plugin/plugin.json create mode 100644 plugins/ruflo-swarm/hooks/codex-hooks.json create mode 100644 tests/plugins/codex-swarm-hook-manifest.test.mjs diff --git a/plugins/ruflo-swarm/.codex-plugin/plugin.json b/plugins/ruflo-swarm/.codex-plugin/plugin.json new file mode 100644 index 0000000000..87711943d2 --- /dev/null +++ b/plugins/ruflo-swarm/.codex-plugin/plugin.json @@ -0,0 +1,12 @@ +{ + "name": "ruflo-swarm", + "description": "Agent teams, swarm coordination, Monitor streams, and worktree isolation — wraps 4 swarm_* + 8 agent_* MCP tools (12 total) plus 6 topologies (hierarchical / mesh / hierarchical-mesh / ring / star / adaptive). The live swarm pane needs Claude Code's function-hook engine and is not available on this host; those MCP tools, commands, skills and agents behave as on any other host.", + "version": "0.3.6", + "author": { + "name": "ruvnet", + "url": "https://github.com/ruvnet" + }, + "homepage": "https://github.com/ruvnet/ruflo", + "license": "MIT", + "hooks": "./hooks/codex-hooks.json" +} diff --git a/plugins/ruflo-swarm/hooks/codex-hooks.json b/plugins/ruflo-swarm/hooks/codex-hooks.json new file mode 100644 index 0000000000..7c3d73bec0 --- /dev/null +++ b/plugins/ruflo-swarm/hooks/codex-hooks.json @@ -0,0 +1,4 @@ +{ + "description": "The live swarm pane depends on Claude Code's function-hook engine and is unsupported on this host; this plugin's commands, skills and agents are unaffected. See plugins/ruflo-swarm/hooks/hooks.json for the Claude Code manifest.", + "hooks": {} +} diff --git a/tests/plugins/codex-swarm-hook-manifest.test.mjs b/tests/plugins/codex-swarm-hook-manifest.test.mjs new file mode 100644 index 0000000000..3cfdf36c02 --- /dev/null +++ b/tests/plugins/codex-swarm-hook-manifest.test.mjs @@ -0,0 +1,62 @@ +import { test } from 'node:test'; +import assert from 'node:assert/strict'; +import fs from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +// Regression test for ruvnet/ruflo#3688: Codex's native app-server rejects +// ruflo-swarm's hooks.json with `unknown field 'modules', expected +// 'description' or 'hooks'` because that manifest declares a Claude Code +// function-hook module Codex cannot load. The fix ships a Codex-specific +// no-op manifest via the native `.codex-plugin/plugin.json` override (the +// same convention already used by ruflo-adr/ruflo-ddd/ruflo-sparc), so the +// Claude Code module keeps loading unchanged while Codex sees a manifest it +// can parse. + +const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..'); +const PLUGIN = 'ruflo-swarm'; + +test('ruflo-swarm: Codex gets a host-specific no-op manifest instead of the Claude function-hook one', () => { + const codexManifestPath = path.join(root, `plugins/${PLUGIN}/.codex-plugin/plugin.json`); + assert.ok( + fs.existsSync(codexManifestPath), + `${codexManifestPath} must exist so Codex's native plugin loader prefers it over .claude-plugin/plugin.json (see #3688)`, + ); + + const codexManifest = JSON.parse(fs.readFileSync(codexManifestPath, 'utf8')); + const claudeManifest = JSON.parse( + fs.readFileSync(path.join(root, `plugins/${PLUGIN}/.claude-plugin/plugin.json`), 'utf8'), + ); + assert.equal(codexManifest.name, claudeManifest.name); + assert.equal(codexManifest.version, claudeManifest.version); + assert.equal(codexManifest.hooks, './hooks/codex-hooks.json'); + + const codexHooksPath = path.join(root, `plugins/${PLUGIN}/hooks/codex-hooks.json`); + assert.ok(fs.existsSync(codexHooksPath), `${codexHooksPath} must exist`); + const codexHooks = JSON.parse(fs.readFileSync(codexHooksPath, 'utf8')); + + // Codex's native plugin hook-manifest loader accepts only `description` + // and `hooks` at the top level (#2855 / #3688) — anything else is a hard + // parse failure that drops the whole plugin. + const allowed = new Set(['description', 'hooks']); + const unknown = Object.keys(codexHooks).filter((key) => !allowed.has(key)); + assert.deepEqual( + unknown, + [], + `codex-hooks.json must only use ${[...allowed].join('/')} at the top level, found: ${unknown.join(', ')}`, + ); + assert.equal(typeof codexHooks.description, 'string'); + assert.deepEqual( + codexHooks.hooks, + {}, + 'ruflo-swarm has no Codex-portable guard logic (pure UI pane) — Codex gets an explicit no-op, not invented command hooks', + ); + + // The Claude Code function-hook manifest and its module must remain + // intact — this fix must not touch the Claude Code behaviour. + const claudeHooks = JSON.parse( + fs.readFileSync(path.join(root, `plugins/${PLUGIN}/hooks/hooks.json`), 'utf8'), + ); + assert.deepEqual(claudeHooks.modules, ['./register.ts']); + assert.ok(fs.existsSync(path.join(root, `plugins/${PLUGIN}/hooks/register.ts`))); +}); From 57c71dbbd1be2e34bbc2eecba96c730540e9a68e Mon Sep 17 00:00:00 2001 From: r Date: Sun, 11 Oct 2026 09:30:22 -0400 Subject: [PATCH 2/2] test: exclude the node:test codex-swarm manifest test from root vitest Co-Authored-By: RuFlo --- scripts/ci-test-excluded.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ci-test-excluded.txt b/scripts/ci-test-excluded.txt index 6396139a45..3aa550596a 100644 --- a/scripts/ci-test-excluded.txt +++ b/scripts/ci-test-excluded.txt @@ -77,6 +77,7 @@ plugins/ruflo-x-gateway/tests/mod.test.ts plugins/ruflo-x-gateway/tests/textsof.test.ts scripts/check-adr-links.test.mjs tests/plugins/codex-mod-hooks.test.mjs +tests/plugins/codex-swarm-hook-manifest.test.mjs scripts/__tests__/guard-label.test.mjs scripts/__tests__/mod-capability-matrix.test.mjs tests/check-guard-tool-names.test.mjs