feat: enhance session ID handling and error propagation

This commit is contained in:
mingholy.lmh 2026-02-13 21:37:51 +08:00
parent 51760fe3a6
commit 82dc79629c
6 changed files with 168 additions and 9 deletions

View file

@ -932,6 +932,14 @@ export async function loadCliConfig(
}
} else if (argv['session-id']) {
// Use provided session ID without session resumption
// Check if session ID is already in use
const sessionService = new SessionService(cwd);
const exists = await sessionService.sessionExists(argv['session-id']);
if (exists) {
const message = `Error: Session Id ${argv['session-id']} is already in use.`;
writeStderrLine(message);
process.exit(1);
}
sessionId = argv['session-id'];
}