feat(codex): support explicit local model catalog configuration (#2266)

* fix(codex): reuse local model catalogs by default

* fix(codex): verify catalog provenance and native schema before reuse

* fix(codex): keep refresh credentials out of discovery homes

* refactor(codex): reduce catalog support to explicit configuration

* fix(codex): invalidate selected catalogs and resolve shim names
This commit is contained in:
Jee
2026-11-04 15:08:54 +08:00
committed by GitHub
parent db7ace3dc3
commit e2b2af695b
11 changed files with 280 additions and 5 deletions
@@ -106,6 +106,22 @@ describe('CodexAppServerClient process cwd', () => {
await client.disconnect();
});
it('passes the explicit catalog to a single app-server without preparation processes', async () => {
const file = process.platform === 'win32' ? 'C:\\Models with spaces\\catalog.json' : '/Models with spaces/catalog.json';
vi.stubEnv('HAPI_CODEX_MODEL_CATALOG_JSON', file);
const client = new CodexAppServerClient();
try {
spawnMock.mockReturnValue(fakeChild());
await client.connect();
expect(spawnMock).toHaveBeenCalledTimes(1);
expect(spawnMock).toHaveBeenCalledWith('codex', ['app-server', '-c', `model_catalog_json=${JSON.stringify(file)}`],
expect.objectContaining({ shell: false }));
} finally {
await client.disconnect();
vi.unstubAllEnvs();
}
});
it('steerTurn resolves dispatch on stdin accept and completes with the turn response', async () => {
const child = fakeChild();
child.stdin.write = vi.fn((_data: unknown, cb?: (error?: Error | null) => void) => {