Merge remote-tracking branch 'sandbox/191/work' into feature/ctrlc-cancel
This commit is contained in:
@@ -84,6 +84,15 @@ std::expected<std::string, std::string> Harness::chat(const Message& user_messag
|
||||
|
||||
if (ctrlc_request)
|
||||
{
|
||||
// Cancellation (Ctrl+C): return empty string to indicate the chat was
|
||||
// interrupted. The user message has already been pushed to history, so
|
||||
// the conversation state will be saved to the chat file. This allows
|
||||
// the user to resume the conversation from this point.
|
||||
//
|
||||
// Note: We return an empty string (success) rather than std::unexpected
|
||||
// because cancellation is not an error condition - it's a deliberate
|
||||
// user action to stop processing. Using std::unexpected would prevent
|
||||
// the harness state from being saved, losing the user's input.
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -93,6 +102,8 @@ std::expected<std::string, std::string> Harness::chat(const Message& user_messag
|
||||
while (!done)
|
||||
{
|
||||
if (ctrlc_request)
|
||||
// Cancellation during API call: same semantics as above - return
|
||||
// empty string to preserve conversation state in the chat file.
|
||||
return "";
|
||||
|
||||
retries--;
|
||||
|
||||
Reference in New Issue
Block a user