fix(hosts): rewrite every "Agent tool" phrasing for agent-runtime hosts

The Agent-tool rewrite for hermes, gbrain, openclaw and factory keyed only
on "use the Agent tool", but templates mostly say "via the Agent tool",
"with the Agent tool", "multiple Agent tool calls" or "Use the Agent tool",
so the Claude tool name leaked into those hosts' skills and sections. Add
ordered rules after the existing key (possessive, "the Agent tool", then
bare "Agent tool") mapping to sessions_spawn (gbrain/openclaw),
delegate_task (hermes) and delegation (factory). No goldens change.

Adopts #1935 (rewritten on current main, without the new goldens).

Co-authored-by: katlun-lgtm <264247399+katlun-lgtm@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
committed 2026-10-08 06:33:51 +00:00
1 parent f6cb9d7fe0
commit 23922b72e6
4 files changed
+36

No files matched your search

+27
View File
@@ -26,6 +26,7 @@ import {
} from '../hosts/index';
import { HOST_PATHS } from '../scripts/resolvers/types';
import { RESOLVERS } from '../scripts/resolvers';
import { runGeneration } from '../scripts/gen-skill-docs';
const ROOT = path.resolve(import.meta.dir, '..');
const RESOLVER_NAMES = new Set(Object.keys(RESOLVERS));
@@ -790,3 +791,29 @@ describe('host renders name the host\'s own tools and identities (#2626, #2015,
}
});
});
describe('agent-runtime hosts never leak the Claude "Agent tool" name', () => {
const OUT = fs.mkdtempSync(path.join(os.tmpdir(), 'gstack-agent-tool-'));
afterAll(() => fs.rmSync(OUT, { recursive: true, force: true }));
test.each([
['hermes', 'delegate_task'],
['gbrain', 'sessions_spawn'],
['openclaw', 'sessions_spawn'],
['factory', 'delegation'],
])('%s renders map every Agent tool phrasing to %s', async (host, token) => {
const result = await runGeneration({ host: host as 'hermes', outputRoot: path.join(OUT, host), contentLinkRoot: null });
expect(result.exitCode).toBe(0);
const rendered = result.artifacts.filter(a => a.kind === 'skill' || a.kind === 'section');
expect(rendered.length).toBeGreaterThan(20);
const leaks: string[] = [];
let mentions = 0;
for (const artifact of rendered) {
const content = fs.readFileSync(path.join(OUT, host, artifact.relativePath), 'utf8');
if (/\bAgent tool\b/.test(content)) leaks.push(artifact.relativePath);
if (content.includes(`via ${token}`)) mentions++;
}
expect(leaks).toEqual([]);
expect(mentions).toBeGreaterThan(0);
}, 120_000);
});