From 240cbf75c7c3cbf23fc95d6b4e0bf807dcd91360 Mon Sep 17 00:00:00 2001 From: Agando Date: Tue, 27 Oct 2026 15:33:33 +0100 Subject: fix(newos4): agent registration is absolute-path and honest about what it stored MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three of the four agent-cluster items, each with a test that is red on HEAD. - MAINT-008 (module-agent-registry.js + module-orchestrator.js): registerAgent took args[0] as the agent id and only args[1] as the capability list, while both orchestrator callers passed the command word first — so the boot log read "Agent 'register' registered with 1 capabilities" and four capabilities were stored as one. The command word is now stripped, args[1..] are joined and split on commas (both "a,b" and "a b c" work), and the callers pass [id, ...caps]. - MAINT-007 (registry + aiassist): mkdir/rm used relative paths, so a registration made from /docs created /docs/agents/ and an unregister from any other cwd removed nothing — the leaked directories the report suspected. Every path in the registry (and the four /_sessions writes in module-aiassist.js) is absolute now. - MAINT-009 (listAgents): a directory alone counted as a registered agent, so a hand-made /agents/foo appeared as "foo — unknown (0 capabilities)". Only a readable status.json with an id counts now; the rest are reported as unregistered directories. Verification: test-agent-registry.js (11 asserts). RED on HEAD: 9 of 11 fail, including the exact `✅ Agent 'register' registered with 1 capabilities` line and `hand-made — unknown (0 capabilities)`. Suite 15/15 files green; maintain --fix "node tests 15/15 pass". Live on v4.6.109: boot prints "✅ Agent 'orchestrator-0' registered with 4 capabilities"; `agent-list` warns "1 directory(ies) in /agents have no status.json (not registered): hand-made"; register from / with a comma list stores 3; unregister from /docs removes the directory and leaves no /docs/agents. MAINT-006 stays open with a narrower note: the hard stop was only reachable when every call in a batch was blocked, so a mixed batch (one repeated + one novel call) never ended. The same ceiling now applies on the mixed path, but that branch lives inside agenticLoop and is not covered by a unit test — it needs a live agent run that repeats a call. --- modules/core/module-orchestrator.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'modules/core/module-orchestrator.js') diff --git a/modules/core/module-orchestrator.js b/modules/core/module-orchestrator.js index 5e03b0b..9f23ceb 100644 --- a/modules/core/module-orchestrator.js +++ b/modules/core/module-orchestrator.js @@ -179,7 +179,9 @@ class OrchestratorModule { // Register orchestrator in the agent registry const registry = this.terminal.moduleManager.modules['AgentRegistryModule']; if (registry) { - registry.registerAgent(['register', 'orchestrator-0', 'delegate', 'spawn', 'monitor', 'purge']); + // MAINT-008: the agent id comes first; passing the command word as args[0] registered an + // agent literally named "register" with one capability. + registry.registerAgent(['orchestrator-0', 'delegate', 'spawn', 'monitor', 'purge']); } // Reconcile + pre-spawn the default team. VirtualFileSystem.loadFromStorage() is ASYNC, // so reconciliation MUST wait for it — running it synchronously saw an empty root and @@ -385,7 +387,7 @@ class OrchestratorModule { // Register in agent registry const registry = this.terminal.moduleManager.modules['AgentRegistryModule']; if (registry) { - registry.registerAgent(['register', id, ...agent.capabilities]); + registry.registerAgent([id, ...agent.capabilities]); // A2A Scratchpad registration if (typeof registry.a2aRegister === 'function') { registry.a2aRegister(id, agent.capabilities); -- cgit v1.2.3