fix(cli): align stream error handling after output-mode merge

Follow up on #1740/#1741 by typing terminal SSE errors in the SDK,
classifying them as server.error in the CLI/MCP, marking Projector done
on error frames, attaching session_id to MCP stream failures, and
migrating the e2e chat step to the bounded JSON envelope.
This commit is contained in:
wizardchen
2026-07-03 00:27:48 +08:00
committed by lyingbug
parent 9437e1ac3c
commit 1109e85a57
19 changed files with 260 additions and 35 deletions
+7
View File
@@ -5,6 +5,7 @@ import (
"fmt"
"testing"
sdk "github.com/Tencent/WeKnora/client"
"github.com/stretchr/testify/assert"
)
@@ -35,6 +36,12 @@ func TestClassifyHTTPError(t *testing.T) {
}
}
func TestClassifySDKError_SSEStreamTerminal(t *testing.T) {
err := sdk.NewSSEStreamError("boom")
assert.Equal(t, CodeServerError, ClassifySDKError(err))
assert.Equal(t, CodeNetworkError, ClassifyHTTPError(err))
}
func TestClassifyHTTPError_500NotFoundRescue(t *testing.T) {
// Server's 1003 = ErrNotFound is the only typed "not found" code we
// rescue. 1007 = ErrInternalServer is the catch-all bucket — its