fix session switch race on message send
This commit is contained in:
@@ -633,8 +633,9 @@ async function main() {
|
||||
mkdirp(path.join(pickerRoot, 'beta'));
|
||||
fs.writeFileSync(path.join(pickerRoot, 'note.txt'), 'not a directory');
|
||||
|
||||
ws.send(JSON.stringify({ type: 'new_session', agent: 'codex', mode: 'plan' }));
|
||||
ws.send(JSON.stringify({ type: 'new_session', agent: 'codex', mode: 'plan', requestId: 'reg-new-default' }));
|
||||
const defaultCodexSession = await nextMessage(messages, ws, (msg) => msg.type === 'session_info' && msg.agent === 'codex' && msg.title === 'New Chat');
|
||||
assert(defaultCodexSession.requestId === 'reg-new-default', 'new_session session_info should echo requestId');
|
||||
assert(defaultCodexSession.cwd === homeDir, 'Codex new_session without cwd should default to HOME');
|
||||
|
||||
const missingCwd = path.join(tempRoot, 'missing-space', 'nested-project');
|
||||
@@ -1081,8 +1082,9 @@ async function main() {
|
||||
assert(returnedPendingDetail.status === 200 && returnedPendingDetail.body?.ok, 'Returned pending reply detail should remain queryable from source history');
|
||||
assert(returnedPendingDetail.body.status === 'returned' && returnedPendingDetail.body.returned === true, 'Returned pending reply detail should report returned status');
|
||||
|
||||
ws.send(JSON.stringify({ type: 'load_session', sessionId: busySourceSession.sessionId }));
|
||||
ws.send(JSON.stringify({ type: 'load_session', sessionId: busySourceSession.sessionId, requestId: 'reg-load-busy-source' }));
|
||||
const loadedBusySource = await nextMessage(messages, ws, (msg) => msg.type === 'session_info' && msg.sessionId === busySourceSession.sessionId);
|
||||
assert(loadedBusySource.requestId === 'reg-load-busy-source', 'load_session session_info should echo requestId');
|
||||
assert(loadedBusySource.isRunning === false, 'Busy source should be idle after background run completed');
|
||||
assert(loadedBusySource.waitingOnChildren === false && loadedBusySource.pendingReplyCount === 0, 'Busy source should clear waiting state after queued reply is flushed');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user