feat(codex-dashboard): add manual long-context controls

This commit is contained in:
Tam Nhu Tran committed 2026-04-01 14:57:56 -04:00
1 parent b3ec9ff78d
commit 3246c40319
9 files changed
+359 -1

No files matched your search

@@ -30,6 +30,8 @@ function buildDiagnostics(activeProfile: string | null): CodexDashboardDiagnosti
config: {
model: 'gpt-5.4',
modelReasoningEffort: null,
modelContextWindow: null,
modelAutoCompactTokenLimit: null,
modelProvider: 'openai',
activeProfile,
approvalPolicy: null,
@@ -11,6 +11,8 @@ describe('CodexTopLevelControlsCard', () => {
values={{
model: null,
modelReasoningEffort: null,
modelContextWindow: null,
modelAutoCompactTokenLimit: null,
modelProvider: null,
approvalPolicy: null,
sandboxMode: null,
@@ -34,4 +36,69 @@ describe('CodexTopLevelControlsCard', () => {
expect(onSave).toHaveBeenCalledTimes(1);
expect(onSave).toHaveBeenCalledWith({ model: 'gpt-5.4-mini' });
});
it('submits manual long-context overrides without auto-filling defaults', async () => {
const onSave = vi.fn();
render(
<CodexTopLevelControlsCard
values={{
model: 'gpt-5.4',
modelReasoningEffort: null,
modelContextWindow: null,
modelAutoCompactTokenLimit: null,
modelProvider: null,
approvalPolicy: null,
sandboxMode: null,
webSearch: null,
toolOutputTokenLimit: null,
personality: null,
}}
providerNames={[]}
onSave={onSave}
/>
);
await userEvent.type(screen.getByLabelText('Model context window'), '800000');
await userEvent.type(screen.getByLabelText('Auto-compact token limit'), '700000');
await userEvent.click(screen.getByRole('button', { name: 'Save top-level settings' }));
expect(onSave).toHaveBeenCalledWith({
modelContextWindow: 800000,
modelAutoCompactTokenLimit: 700000,
});
});
it('fills draft starter values without saving automatically', async () => {
const onSave = vi.fn();
render(
<CodexTopLevelControlsCard
values={{
model: 'gpt-5.4',
modelReasoningEffort: null,
modelContextWindow: null,
modelAutoCompactTokenLimit: null,
modelProvider: null,
approvalPolicy: null,
sandboxMode: null,
webSearch: null,
toolOutputTokenLimit: null,
personality: null,
}}
providerNames={[]}
onSave={onSave}
/>
);
expect(screen.getByText('Manual opt-in only')).toBeInTheDocument();
expect(screen.getByText('1.05M / 1M')).toBeInTheDocument();
await userEvent.click(screen.getByRole('button', { name: 'Fill cautious pair' }));
expect(onSave).not.toHaveBeenCalled();
expect(screen.getByLabelText('Model context window')).toHaveValue(800000);
expect(screen.getByLabelText('Auto-compact token limit')).toHaveValue(700000);
expect(screen.getByRole('button', { name: 'Save top-level settings' })).toBeEnabled();
});
});