@@ -26,8 +26,6 @@ import (
26 "github.com/charmbracelet/crush/internal/shell"
26 "github.com/charmbracelet/crush/internal/shell"
29−const streamChunkTimeout = 2 * time.Minute
31type AgentEventType string
29type AgentEventType string
@@ -554,10 +552,6 @@ func (a *agent) streamAndHandleEvents(ctx context.Context, sessionID string, msg
554 // Add the session and message ID into the context if needed by tools.
552 // Add the session and message ID into the context if needed by tools.
555 ctx = context.WithValue(ctx, tools.MessageIDContextKey, assistantMsg.ID)
553 ctx = context.WithValue(ctx, tools.MessageIDContextKey, assistantMsg.ID)
557− // Process each event in the stream.
558− timer := time.NewTimer(streamChunkTimeout)
@@ -565,9 +559,6 @@ loop:
566 break loop
560 break loop
568− // Reset the timeout timer since we received a chunk
569− timer.Reset(streamChunkTimeout)
571 if processErr := a.processEvent(ctx, sessionID, &assistantMsg, event); processErr != nil {
562 if processErr := a.processEvent(ctx, sessionID, &assistantMsg, event); processErr != nil {
572 if errors.Is(processErr, context.Canceled) {
563 if errors.Is(processErr, context.Canceled) {
573 a.finishMessage(context.Background(), &assistantMsg, message.FinishReasonCanceled, "Request cancelled", "")
564 a.finishMessage(context.Background(), &assistantMsg, message.FinishReasonCanceled, "Request cancelled", "")
@@ -576,9 +567,6 @@ loop:
577 return assistantMsg, nil, processErr
568 return assistantMsg, nil, processErr
580− a.finishMessage(ctx, &assistantMsg, message.FinishReasonError, "Stream timeout", "No chunk received within timeout")
581− return assistantMsg, nil, ErrStreamTimeout
582 case <-ctx.Done():
570 case <-ctx.Done():
583 a.finishMessage(context.Background(), &assistantMsg, message.FinishReasonCanceled, "Request cancelled", "")
571 a.finishMessage(context.Background(), &assistantMsg, message.FinishReasonCanceled, "Request cancelled", "")
584 return assistantMsg, nil, ctx.Err()
572 return assistantMsg, nil, ctx.Err()