MCPcopy Create free account
hub / github.com/diillson/chatcli / MarkCurrentAs

Method MarkCurrentAs

cli/agent/task_tracker.go:120–153  ·  view source on GitHub ↗
(status TaskStatus, errorMsg string)

Source from the content-addressed store, hash-verified

118}
119
120func (t *TaskTracker) MarkCurrentAs(status TaskStatus, errorMsg string) {
121 t.mu.Lock()
122 defer t.mu.Unlock()
123
124 if t.plan == nil || len(t.plan.Tasks) == 0 {
125 return
126 }
127
128 if t.plan.CurrentTask >= len(t.plan.Tasks) {
129 return
130 }
131
132 task := t.plan.Tasks[t.plan.CurrentTask]
133 task.Status = status
134 task.Attempts++
135
136 switch status {
137 case TaskInProgress:
138 if task.StartedAt.IsZero() {
139 task.StartedAt = time.Now()
140 }
141 case TaskCompleted:
142 task.CompletedAt = time.Now()
143 t.plan.CurrentTask++
144 case TaskFailed:
145 task.Error = errorMsg
146 t.plan.FailureCount++
147 if t.plan.FailureCount >= 3 {
148 t.plan.NeedsReplan = true
149 }
150 }
151
152 t.plan.UpdatedAt = time.Now()
153}
154
155func (t *TaskTracker) GetCurrentTask() *Task {
156 t.mu.Lock()

Callers 6

IntegrateTaskTrackingFunction · 0.80
MarkTaskFailedFunction · 0.80
MarkTaskCompletedFunction · 0.80
MarkTaskInProgressFunction · 0.80

Calls 3

LockMethod · 0.80
UnlockMethod · 0.80
IsZeroMethod · 0.80

Tested by 2