]> git.giacomolli.uk - onechat/commitdiff
Reflow comments over the reflow width
authorAnderson A. Giacomolli <redacted>
Tue, 10 Nov 2026 20:47:30 +0000 (17:47 -0300)
committerAnderson A. Giacomolli <redacted>
Tue, 10 Nov 2026 20:47:30 +0000 (17:47 -0300)
bin/reflow wraps each changed paragraph again, so that no comment line
passes 80 columns with tabs as 8 columns, as the docs skill asks. Ten
lines were over, from edits that skipped the reflow. Only comments
change.

memory.go
model.go
subagent_run.go
subagent_run_test.go
telegram_markdown.go
telegram_test.go
whatsapp_find.go
whatsapp_send.go

index 602b86cddf5b813027c554a23f65621298f46fc3..1b734c07acea51268dcbe02de56641399d30039b 100644 (file)
--- a/memory.go
+++ b/memory.go
@@ -485,9 +485,9 @@ func (m *Memory) dispatch() {
 }
 
 // addMessage builds the leaf of message when it needs no model call, or else
 }
 
 // addMessage builds the leaf of message when it needs no model call, or else
-// adds the leaf to the queue. Then it appends the leaf to the views. A crash can
-// stop an append after the leaf build and before the view save, so a leaf that
-// is built already stays as it is, and restoreQueue settles its parent.
+// adds the leaf to the queue. Then it appends the leaf to the views. A crash
+// can stop an append after the leaf build and before the view save, so a leaf
+// that is built already stays as it is, and restoreQueue settles its parent.
 func (m *Memory) addMessage(message Message) error {
        built, err := m.tree.Built(0, message.ID)
        if err != nil {
 func (m *Memory) addMessage(message Message) error {
        built, err := m.tree.Built(0, message.ID)
        if err != nil {
index 6ddd3008cca12c96577ccc5a9a8b6ca913ebfe7e..cc77f9a434fbdfad519628a08e1fbd8eb1c0ebf6 100644 (file)
--- a/model.go
+++ b/model.go
@@ -41,9 +41,9 @@ const (
 var errModelCallLimit = errors.New("call limit reached")
 
 // modelEndpoint returns the URL and the authorizer of the endpoint in config.
 var errModelCallLimit = errors.New("call limit reached")
 
 // modelEndpoint returns the URL and the authorizer of the endpoint in config.
-// The ChatGPT backend uses the token file in dir. The OpenAI API uses the key in
-// OPENAI_API_KEY, and there is no fallback from one to the other. All clients
-// share the authorizer, so one refresh runs at a time.
+// The ChatGPT backend uses the token file in dir. The OpenAI API uses the key
+// in OPENAI_API_KEY, and there is no fallback from one to the other. All
+// clients share the authorizer, so one refresh runs at a time.
 func modelEndpoint(config Config, dir string) (string, ModelAuthorizer, error) {
        if config.Endpoint == configEndpointAPI {
                key := os.Getenv("OPENAI_API_KEY")
 func modelEndpoint(config Config, dir string) (string, ModelAuthorizer, error) {
        if config.Endpoint == configEndpointAPI {
                key := os.Getenv("OPENAI_API_KEY")
index 891766c4e0baf5895b81617a0ede42eea19e13d6..faa6207919d890d4c0c152a1275b4a99ccf9197e 100644 (file)
@@ -424,8 +424,9 @@ func (r *SubagentRuns) workPath() string {
 }
 
 // run runs the chains of run and reports and logs its end with the length of
 }
 
 // run runs the chains of run and reports and logs its end with the length of
-// the run, unless Close ended it. A chain follows while messages wait after the final answer of the chain before
-// it, and no chain failed. A chain that Stop ends gives the reply "stopped".
+// the run, unless Close ended it. A chain follows while messages wait after the
+// final answer of the chain before it, and no chain failed. A chain that Stop
+// ends gives the reply "stopped".
 func (r *SubagentRuns) run(ctx context.Context, run *SubagentRun) {
        defer r.workers.Done()
        defer run.cancel()
 func (r *SubagentRuns) run(ctx context.Context, run *SubagentRun) {
        defer r.workers.Done()
        defer run.cancel()
@@ -552,8 +553,8 @@ func (r *SubagentRuns) take(run *SubagentRun) []Message {
 
 // SubagentRun is one run of a subagent: the view that its requests get, its
 // effort, the end of its context, the messages of Tell that wait for a request,
 
 // SubagentRun is one run of a subagent: the view that its requests get, its
 // effort, the end of its context, the messages of Tell that wait for a request,
-// whether Stop ended it, and the time it started. The mutex of SubagentRuns protects the messages
-// and the stop.
+// whether Stop ended it, and the time it started. The mutex of SubagentRuns
+// protects the messages and the stop.
 type SubagentRun struct {
        subagent *Subagent
        view     []string
 type SubagentRun struct {
        subagent *Subagent
        view     []string
index c5ad2995931a147424fc4ea3d86e27db31281530..71c96ea60c0e312eb00971b9e07bc0023f9ac3e9 100644 (file)
@@ -29,7 +29,8 @@ func TestSpawnRunsASubagentInTheBackground(t *testing.T) {
                last := subagentTestLastItem(call)
                switch {
                case subagentTestCall(call) && last["type"] == "function_call_output":
                last := subagentTestLastItem(call)
                switch {
                case subagentTestCall(call) && last["type"] == "function_call_output":
-                       // The report comes after the reply of the turn of the spawn.
+                       // The report comes after the reply of the turn of the
+                       // spawn.
                        test.events.WaitFor(t, "reply", 1)
                        modelWriteEvents(w, modelCompletedEvent([]any{modelMessageItem("There are 3 files.")}, 100, 0, 5))
                case subagentTestCall(call):
                        test.events.WaitFor(t, "reply", 1)
                        modelWriteEvents(w, modelCompletedEvent([]any{modelMessageItem("There are 3 files.")}, 100, 0, 5))
                case subagentTestCall(call):
index a978036e2848acaa61db758ff94a0c9f994d6f8b..fc686344556bec329c0c1c7d5bbcb674133fdafd 100644 (file)
@@ -6,8 +6,8 @@ import (
 )
 
 var (
 )
 
 var (
-       // telegramTagEscaper writes the characters that rich Markdown reads as HTML
-       // as HTML entities.
+       // telegramTagEscaper writes the characters that rich Markdown reads as
+       // HTML as HTML entities.
        telegramTagEscaper = strings.NewReplacer("&", "&amp;", "<", "&lt;")
 
        // telegramTagUnescaper reverses telegramTagEscaper.
        telegramTagEscaper = strings.NewReplacer("&", "&amp;", "<", "&lt;")
 
        // telegramTagUnescaper reverses telegramTagEscaper.
index 84f41c80c50894cbcd8da6e0ad2f2be3b2f56315..dee692d43d3f2f871c11142903f0764b3f171d44 100644 (file)
@@ -145,7 +145,8 @@ func TestBotShowsOnlyTheStartAndTheEndOfASubagent(t *testing.T) {
                last := subagentTestLastItem(call)
                switch {
                case subagentTestCall(call):
                last := subagentTestLastItem(call)
                switch {
                case subagentTestCall(call):
-                       // The report comes after the reply of the turn of the spawn.
+                       // The report comes after the reply of the turn of the
+                       // spawn.
                        require.Eventually(t, func() bool {
                                return slices.Contains(telegram.Sent(), "Started.")
                        }, 10*time.Second, time.Millisecond)
                        require.Eventually(t, func() bool {
                                return slices.Contains(telegram.Sent(), "Started.")
                        }, 10*time.Second, time.Millisecond)
@@ -271,8 +272,8 @@ func TestBotTriesAgainAfterFailures(t *testing.T) {
        require.Contains(t, logs.String(), "<6>receive back after=")
        require.Contains(t, logs.String(), "<4>send failed retry=1s: 429")
 
        require.Contains(t, logs.String(), "<6>receive back after=")
        require.Contains(t, logs.String(), "<4>send failed retry=1s: 429")
 
-       // The bot logs the end of the outage after the send returns, so the line
-       // can come after the fake server has the message.
+       // The bot logs the end of the outage after the send returns, so the
+       // line can come after the fake server has the message.
        require.Eventually(t, func() bool {
                return strings.Contains(logs.String(), "<6>send back after=")
        }, 10*time.Second, time.Millisecond)
        require.Eventually(t, func() bool {
                return strings.Contains(logs.String(), "<6>send back after=")
        }, 10*time.Second, time.Millisecond)
index b825a3ecaeea218bf31f5d9c2f4b87c46746edae..9e3cbf8d9c75c6f4c4d8cd07dc87406eedd20cdd 100644 (file)
@@ -112,8 +112,8 @@ func whatsappFold(text string) string {
        return strings.ToLower(strings.TrimSpace(folded))
 }
 
        return strings.ToLower(strings.TrimSpace(folded))
 }
 
-// whatsappFindAnswer returns the answer of whatsappFind for name with matches. Without
-// groups, the answer says that it has no groups.
+// whatsappFindAnswer returns the answer of whatsappFind for name with matches.
+// Without groups, the answer says that it has no groups.
 func whatsappFindAnswer(name string, matches []WhatsAppMatch, groups bool) string {
        slices.SortFunc(matches, func(a, b WhatsAppMatch) int {
                return cmp.Or(strings.Compare(whatsappFold(a.name), whatsappFold(b.name)), strings.Compare(a.id, b.id))
 func whatsappFindAnswer(name string, matches []WhatsAppMatch, groups bool) string {
        slices.SortFunc(matches, func(a, b WhatsAppMatch) int {
                return cmp.Or(strings.Compare(whatsappFold(a.name), whatsappFold(b.name)), strings.Compare(a.id, b.id))
index d3d3cbce1e362dd99dd75e01fafa4d6b4eb3c05d..b3bbe95bac3b789034bd954e1c35623974baeede 100644 (file)
@@ -40,10 +40,10 @@ const (
 // during the send gives an answer that the result is unknown, and not a second
 // send. A disconnected WhatsApp sends nothing and makes no record. link gives
 // the device, the client, and the own IDs, groups the names of the groups, and
 // during the send gives an answer that the result is unknown, and not a second
 // send. A disconnected WhatsApp sends nothing and makes no record. link gives
 // the device, the client, and the own IDs, groups the names of the groups, and
-// state the send records, and logger gets one line for each send. The clock gives the times of the records and the time
-// zone of the answer. Image names are checked before the record is written, and
-// uploads start only after the record is durable. Text-only records keep their
-// text digest.
+// state the send records, and logger gets one line for each send. The clock
+// gives the times of the records and the time zone of the answer. Image names
+// are checked before the record is written, and uploads start only after the
+// record is durable. Text-only records keep their text digest.
 func whatsappSend(ctx context.Context, link WhatsAppLink, groups *WhatsAppGroups, state *WhatsAppState, images *ImageStore, logger *slog.Logger, clock func() time.Time, id, chat, text, image string) (string, error) {
        if !link.linked {
                return whatsappNotLinked, nil
 func whatsappSend(ctx context.Context, link WhatsAppLink, groups *WhatsAppGroups, state *WhatsAppState, images *ImageStore, logger *slog.Logger, clock func() time.Time, id, chat, text, image string) (string, error) {
        if !link.linked {
                return whatsappNotLinked, nil