fix(server): remove debug logging and add error handling from review
- Remove debug log.Printf calls from handler/daemon.go and service/task.go that used the global log package instead of structured logging - Remove unused truncate() helper from service/task.go - Add error handling for EnqueueTaskForIssue in createAgentInitIssue - Clean up verbose debug logging in daemon/daemon.go handleTask - Add shutdown sequence comment to codex.go lifecycle goroutine Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a9bf22955d
commit
de0a983674
5 changed files with 10 additions and 56 deletions
|
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
|
|
@ -285,7 +286,9 @@ func (h *Handler) createAgentInitIssue(ctx context.Context, agent db.Agent, crea
|
|||
h.broadcast("issue:created", map[string]any{"issue": issueToResponse(issue)})
|
||||
|
||||
// Enqueue the task directly — we know the agent is assigned and status is "todo".
|
||||
h.TaskService.EnqueueTaskForIssue(ctx, issue)
|
||||
if _, err := h.TaskService.EnqueueTaskForIssue(ctx, issue); err != nil {
|
||||
log.Printf("createAgentInitIssue: enqueue task failed for issue %s: %v", issue.Title, err)
|
||||
}
|
||||
}
|
||||
|
||||
type UpdateAgentRequest struct {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package handler
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
|
|
@ -207,17 +206,13 @@ 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))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue