Retain native task identity across partial progress notifications
This commit is contained in:
@@ -58,7 +58,9 @@ func (h *host) trackTasksLocked(line []byte) {
|
|||||||
delete(h.taskOrigins, fallback)
|
delete(h.taskOrigins, fallback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
h.tasks[id] = event.TaskID
|
if _, exists := h.tasks[id]; !exists || event.TaskID != "" {
|
||||||
|
h.tasks[id] = event.TaskID
|
||||||
|
}
|
||||||
origin := h.taskOrigins[id]
|
origin := h.taskOrigins[id]
|
||||||
if event.ToolUseID != "" {
|
if event.ToolUseID != "" {
|
||||||
origin.ToolUseID = event.ToolUseID
|
origin.ToolUseID = event.ToolUseID
|
||||||
|
|||||||
@@ -31,6 +31,19 @@ func TestNativeTaskSnapshotOutlivesForegroundAndSpool(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNativeTaskProgressWithoutIDRetainsCompletionAssociation(t *testing.T) {
|
||||||
|
h := &host{}
|
||||||
|
h.trackTasksLocked([]byte(`{"type":"system","subtype":"task_started","tool_use_id":"tool","task_id":"native"}`))
|
||||||
|
h.trackTasksLocked([]byte(`{"type":"system","subtype":"task_progress","tool_use_id":"tool"}`))
|
||||||
|
if h.tasks["tool"] != "native" {
|
||||||
|
t.Fatal("progress erased native identity")
|
||||||
|
}
|
||||||
|
h.trackTasksLocked([]byte(`{"type":"system","subtype":"task_notification","task_id":"native","status":"completed"}`))
|
||||||
|
if len(h.tasks) != 0 {
|
||||||
|
t.Fatal("native completion did not clear running membership")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestNativeTaskAliasesAndTextCompletion(t *testing.T) {
|
func TestNativeTaskAliasesAndTextCompletion(t *testing.T) {
|
||||||
h := &host{}
|
h := &host{}
|
||||||
h.trackTasksLocked([]byte(`{"type":"system","subtype":"task_progress","task_id":"native-agent"}`))
|
h.trackTasksLocked([]byte(`{"type":"system","subtype":"task_progress","task_id":"native-agent"}`))
|
||||||
|
|||||||
Reference in New Issue
Block a user