From c1c36d1c2dd3a99a3edf6b5392f9e864bdb7b934 Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 19 Feb 2026 04:14:40 +0100 Subject: [PATCH] undo whitespace change, add comments --- internal/pkg/report/reporter.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/pkg/report/reporter.go b/internal/pkg/report/reporter.go index b1ef369..ba999cf 100644 --- a/internal/pkg/report/reporter.go +++ b/internal/pkg/report/reporter.go @@ -25,8 +25,7 @@ type Reporter struct { ctx context.Context cancel context.CancelFunc - closed bool - + closed bool client client.Client clientM sync.Mutex @@ -300,7 +299,8 @@ func (r *Reporter) ReportLog(noMore bool) error { return nil } -// ReportState reports the current task state unless the reporter is closed. +// ReportState skips when closed so RunDaemon cannot send a completed state +// before Close sends the final logs. func (r *Reporter) ReportState() error { r.stateMu.RLock() closed := r.closed @@ -311,6 +311,7 @@ func (r *Reporter) ReportState() error { return r.reportState() } +// reportState sends unconditionally. Used by Close after final logs are uploaded. func (r *Reporter) reportState() error { r.clientM.Lock() defer r.clientM.Unlock()