mirror of
https://github.com/wu736139669/hapi.git
synced 2026-10-18 20:59:49 +00:00
feat(codex): support backend-authorized Luna Reserve fallback (#1780)
* feat(codex): reconcile Luna Reserve fallback and conditional usage * fix(codex): preserve queued settings and reconcile Reserve sessions
This commit is contained in:
@@ -62,6 +62,26 @@ describe('CodexAppServerClient process cwd', () => {
|
||||
spawnMock.mockReset();
|
||||
});
|
||||
|
||||
it('uses null for legacy usage reads and opts in only when Reserve is supported', async () => {
|
||||
const child = fakeChild();
|
||||
child.stdin.write = vi.fn((_data: unknown, callback?: (error?: Error | null) => void) => {
|
||||
callback?.();
|
||||
return true;
|
||||
});
|
||||
spawnMock.mockReturnValue(child);
|
||||
const client = new CodexAppServerClient({ cwd: '/neutral-home' });
|
||||
await client.connect();
|
||||
for (const supported of [false, true]) {
|
||||
const pending = client.readAccountRateLimits(supported);
|
||||
const request = JSON.parse(child.stdin.write.mock.lastCall![0] as string);
|
||||
expect(request.method).toBe('account/rateLimits/read');
|
||||
expect(request.params).toEqual(supported ? { supportsLunaReserve: true } : null);
|
||||
child.stdout.emit('data', Buffer.from(JSON.stringify({ id: request.id, result: { rateLimits: {} } }) + '\n'));
|
||||
await expect(pending).resolves.toEqual({ rateLimits: {} });
|
||||
}
|
||||
await client.disconnect();
|
||||
});
|
||||
|
||||
it('passes an explicit neutral cwd to the app-server process', async () => {
|
||||
spawnMock.mockReturnValue(fakeChild());
|
||||
const client = new CodexAppServerClient({ cwd: '/neutral-home' });
|
||||
|
||||
Reference in New Issue
Block a user