]> git.giacomolli.uk - onechat/commitdiff
Return known failures without redundant checks
authorAnderson A. Giacomolli <redacted>
Wed, 11 Nov 2026 15:35:21 +0000 (12:35 -0300)
committerAnderson A. Giacomolli <redacted>
Wed, 11 Nov 2026 15:35:21 +0000 (12:35 -0300)
Telegram update failures and worker state-save failures return their
wrapped errors directly inside existing failure branches. A compaction
without a line also returns its known failure directly. Unreachable nil
returns and repeated conditions are removed without changing error
causes or successful paths.

Issue: 3cdc678

compactor.go
subagent_run.go
telegram.go

index 2b062882b18ae0e07dd363f3a8203d2302d28d64..64ff1fd60635611daded0d43aff2cd55e6d5754a 100644 (file)
@@ -110,11 +110,7 @@ func (c *Compactor) Summarize(ctx context.Context, task Task) (string, error) {
        }
 
        if len(lines) == 0 {
-               if err != nil {
-                       return "", fmt.Errorf("summarize node: %w", err)
-               }
-
-               return "", nil
+               return "", fmt.Errorf("summarize node: %w", err)
        }
 
        return compactorShortest(lines), nil
index 54fa4304fe9312b55506ea58aa28b9a8fa867acb..ca45976758b2dfdf08addcb2df73711363c079ff 100644 (file)
@@ -215,11 +215,7 @@ func (r *SubagentRuns) start(ctx context.Context, run *SubagentRun) error {
                r.mutex.Unlock()
                run.cancel()
 
-               if err != nil {
-                       return fmt.Errorf("save running workers: %w", err)
-               }
-
-               return nil
+               return fmt.Errorf("save running workers: %w", err)
        }
 
        r.workers.Add(1)
index 85b0f44d1ed368cfcb340f0aa7f0edcd9fa3e9fc..3d676d6961955c2d86c0b63d20c9046d7fcc0d89 100644 (file)
@@ -313,11 +313,7 @@ poll:
                                        continue poll
                                }
 
-                               if err != nil {
-                                       return fmt.Errorf("handle Telegram update: %w", err)
-                               }
-
-                               return nil
+                               return fmt.Errorf("handle Telegram update: %w", err)
                        }
 
                        imageOutage.End()