@@ -26,8 +26,6 @@ import (
"github.com/charmbracelet/crush/internal/shell"
)
-const streamChunkTimeout = 2 * time.Minute
-
type AgentEventType string
const (
@@ -554,10 +552,6 @@ func (a *agent) streamAndHandleEvents(ctx context.Context, sessionID string, msg
// Add the session and message ID into the context if needed by tools.
ctx = context.WithValue(ctx, tools.MessageIDContextKey, assistantMsg.ID)
- // Process each event in the stream.
- timer := time.NewTimer(streamChunkTimeout)
- defer timer.Stop()
-
loop:
for {
select {
@@ -565,9 +559,6 @@ loop:
if !ok {
break loop
}
- // Reset the timeout timer since we received a chunk
- timer.Reset(streamChunkTimeout)
-
if processErr := a.processEvent(ctx, sessionID, &assistantMsg, event); processErr != nil {
if errors.Is(processErr, context.Canceled) {
a.finishMessage(context.Background(), &assistantMsg, message.FinishReasonCanceled, "Request cancelled", "")
@@ -576,9 +567,6 @@ loop:
}
return assistantMsg, nil, processErr
}
- case <-timer.C:
- a.finishMessage(ctx, &assistantMsg, message.FinishReasonError, "Stream timeout", "No chunk received within timeout")
- return assistantMsg, nil, ErrStreamTimeout
case <-ctx.Done():
a.finishMessage(context.Background(), &assistantMsg, message.FinishReasonCanceled, "Request cancelled", "")
return assistantMsg, nil, ctx.Err()
@@ -7,7 +7,6 @@ import (
var (
ErrRequestCancelled = errors.New("request canceled by user")
- ErrStreamTimeout = errors.New("stream chunk timeout")
ErrSessionBusy = errors.New("session is currently processing another request")
)