fix(#279): document Agent mapping and deferred tool discovery (#285)

This commit is contained in:
Tom Boucher
2026-05-26 12:08:53 -04:00
committed by GitHub
parent 90ea3a3297
commit c66705d6ba
3 changed files with 36 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
'use strict';
// allow-test-rule: source-text-is-the-product [adapter header contract in bin/install.js]
const { test, describe } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const INSTALL_JS = path.join(__dirname, '..', 'bin', 'install.js');
const src = fs.readFileSync(INSTALL_JS, 'utf8');
describe('bug #279: Codex adapter documents Agent() and deferred tool discovery', () => {
test('adapter mapping section includes explicit Agent(...) -> spawn_agent mapping', () => {
assert.ok(
/Task\(subagent_type="X", prompt="Y"\).*spawn_agent\(agent_type="X", message="Y"\)/.test(src) &&
/Agent\(subagent_type="X", prompt="Y"\).*spawn_agent\(agent_type="X", message="Y"\)/.test(src),
'Codex adapter must explicitly map both Task(...) and Agent(...) to spawn_agent',
);
});
test('adapter includes deferred tool_search discovery guidance before inline fallback', () => {
assert.ok(
src.includes('deferred') && src.includes('tool_search') && src.includes('spawn_agent'),
'Codex adapter must instruct deferred tool discovery via tool_search before deciding to run inline',
);
});
});