chore(daemon): add debug logging for task lifecycle troubleshooting

Add structured logging at key points in the task completion flow:
- Daemon: log result details before sending to server, log claim cycles
- Handler: log incoming CompleteTask requests
- TaskService: log each step of CompleteTask (DB update, issue status
  sync, comment creation, payload parsing)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
yushen 2026-03-24 17:38:06 +08:00
parent 994242d2db
commit a9bf22955d
2 changed files with 24 additions and 0 deletions

View file

@ -3,6 +3,7 @@ package handler
import (
"encoding/json"
"fmt"
"log"
"net/http"
"strings"
@ -206,13 +207,17 @@ func (h *Handler) CompleteTask(w http.ResponseWriter, r *http.Request) {
return
}
log.Printf("[Handler.CompleteTask] task=%s output_len=%d", taskID, len(req.Output))
result, _ := json.Marshal(req)
task, err := h.TaskService.CompleteTask(r.Context(), parseUUID(taskID), result)
if err != nil {
log.Printf("[Handler.CompleteTask] task=%s error: %v", taskID, err)
writeError(w, http.StatusBadRequest, err.Error())
return
}
log.Printf("[Handler.CompleteTask] task=%s completed, issue status synced", taskID)
writeJSON(w, http.StatusOK, taskToResponse(*task))
}