feat: enhance session UX and codex defaults
This commit is contained in:
@@ -304,6 +304,20 @@ function createFakeCodexHistory(homeDir) {
|
||||
return { threadId, rolloutPath, stateDb, logsDb };
|
||||
}
|
||||
|
||||
function createFakeCodexConfig(homeDir, { model = 'gpt-5.5', reasoningEffort = 'xhigh' } = {}) {
|
||||
const codexDir = path.join(homeDir, '.codex');
|
||||
mkdirp(codexDir);
|
||||
fs.writeFileSync(path.join(codexDir, 'config.toml'), [
|
||||
'model_provider = "test"',
|
||||
`model = "${model}"`,
|
||||
`model_reasoning_effort = "${reasoningEffort}"`,
|
||||
'',
|
||||
'[projects."/tmp/project-b"]',
|
||||
'trust_level = "trusted"',
|
||||
'',
|
||||
].join('\n'));
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'cc-web-regression-'));
|
||||
const configDir = path.join(tempRoot, 'config');
|
||||
@@ -325,6 +339,7 @@ async function main() {
|
||||
}, null, 2));
|
||||
|
||||
createFakeClaudeHistory(homeDir);
|
||||
createFakeCodexConfig(homeDir);
|
||||
const codexFixture = createFakeCodexHistory(homeDir);
|
||||
|
||||
const port = await getFreePort();
|
||||
@@ -392,7 +407,7 @@ async function main() {
|
||||
ws.send(JSON.stringify({ type: 'new_session', agent: 'codex', cwd: codexInitCwd, mode: 'plan' }));
|
||||
const codexSession = await nextMessage(messages, ws, (msg) => msg.type === 'session_info' && msg.agent === 'codex' && msg.cwd === codexInitCwd);
|
||||
assert(codexSession.mode === 'plan', 'Codex new_session should follow requested mode');
|
||||
assert(codexSession.model === 'gpt-5.4', 'Codex new_session should inject default model gpt-5.4');
|
||||
assert(codexSession.model === 'gpt-5.5(xhigh)', 'Codex new_session should read default model from ~/.codex/config.toml');
|
||||
|
||||
ws.send(JSON.stringify({ type: 'list_cwd_suggestions' }));
|
||||
const cwdSuggestions = await nextMessage(messages, ws, (msg) => msg.type === 'cwd_suggestions');
|
||||
|
||||
Reference in New Issue
Block a user