on main help sign in
fix: session summarization dialog hanging indefinitely (#528)

The summarization dialog was getting stuck in "Generating..." state due to two issues: - Agent was formatting nil error values instead of actual response errors - Dialog only handled summarize events but not error events, leaving it in loading state ๐Ÿ’– Generated with Crush Co-authored-by: Crush <crush@charm.land>

commit47a6d0285724a7e078b4134a538cf90ebe765cac authorBenjamin Oldenburg <benjamin.oldenburg@ordis.co.th> dateSat 20 Sep 2025, 01:27 (1 year ago) parent831a95a
2 files changed+12โˆ’5
internal/llm/agent/agent.go+1โˆ’1 internal/tui/components/dialogs/compact/compact.go+11โˆ’4
internal/llm/agent/agent.go+1โˆ’1
@@ -832,7 +832,7 @@ func (a *agent) Summarize(ctx context.Context, sessionID string) error {
832832 if r.Error != nil {
833833 event = AgentEvent{
834834 Type: AgentEventTypeError,
835โˆ’ Error: fmt.Errorf("failed to summarize: %w", err),
835+ Error: fmt.Errorf("failed to summarize: %w", r.Error),
836836 Done: true,
837837 }
838838 a.Publish(pubsub.CreatedEvent, event)
internal/tui/components/dialogs/compact/compact.go+11โˆ’4
@@ -104,17 +104,24 @@ func (c *compactDialogCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
104104 }
105105
106106 case agent.AgentEvent:
107โˆ’ if msg.Type == agent.AgentEventTypeSummarize {
107+ switch msg.Type {
108+ case agent.AgentEventTypeSummarize:
108109 if msg.Error != nil {
109110 c.state = stateError
110111 c.progress = "Error: " + msg.Error.Error()
111112 } else if msg.Done {
112โˆ’ return c, util.CmdHandler(
113โˆ’ dialogs.CloseDialogMsg{},
114โˆ’ )
113+ return c, util.CmdHandler(dialogs.CloseDialogMsg{})
115114 } else {
116115 c.progress = msg.Progress
117116 }
117+ case agent.AgentEventTypeError:
118+ // Handle errors that occur during summarization but are sent as separate error events.
119+ c.state = stateError
120+ if msg.Error != nil {
121+ c.progress = "Error: " + msg.Error.Error()
122+ } else {
123+ c.progress = "An unknown error occurred"
124+ }
118125 }
119126 return c, nil
120127 }