Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions mcp/mcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1971,7 +1971,7 @@ func TestKeepAliveFailure_Logged(t *testing.T) {
var buf bytes.Buffer
clientOpts := &ClientOptions{
KeepAlive: 50 * time.Millisecond,
Logger: slog.New(slog.NewTextHandler(&buf, &slog.HandlerOptions{Level: slog.LevelError})),
Logger: slog.New(slog.NewTextHandler(&buf, &slog.HandlerOptions{Level: slog.LevelWarn})),
}
c := NewClient(testImpl, clientOpts)
// Pin to 2025-11-25: KeepAlive uses the ping RPC, which is removed
Expand All @@ -1992,8 +1992,8 @@ func TestKeepAliveFailure_Logged(t *testing.T) {
synctest.Wait()

got := buf.String() // slog serializes Write calls internally
if !strings.Contains(got, "keepalive ping failed") {
t.Errorf("expected keepalive failure to be logged, got log output:\n%s", got)
if !strings.Contains(got, `level=WARN msg="keepalive ping failed; closing session"`) {
t.Errorf("expected keepalive failure to be logged at Warn, got log output:\n%s", got)
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion mcp/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ func startKeepalive(session keepaliveSession, interval time.Duration, failureThr
}
// Threshold reached; log before closing the session so the
// failure is observable to operators. See #218.
logger.Error("keepalive ping failed; closing session",
logger.Warn("keepalive ping failed; closing session",
"error", err,
"consecutiveFailures", consecutiveFailures,
"failureThreshold", failureThreshold)
Expand Down