fix: cli input stream handling and error management, improve e2e and unit tests

This commit is contained in:
mingholy.lmh 2026-01-23 13:56:38 +08:00
parent 6eb16c0bcf
commit f578ff07a2
13 changed files with 741 additions and 150 deletions

View file

@ -596,7 +596,14 @@ class Session {
throw streamError;
}
// Stream ended - wait for all pending work before shutdown
// Stdin closed - mark input as closed in dispatcher
// This will reject all current pending outgoing requests AND any future requests
// that might be registered by async message handlers still running
if (this.dispatcher) {
this.dispatcher.markInputClosed();
}
// Wait for all pending work before shutdown
await this.waitForAllPendingWork();
await this.shutdown();
} catch (error) {