Let task agents suggest discarding their task, with reasoning

This commit is contained in:
Ian Gulliver
2026-10-19 17:14:13 -07:00
parent 0be09b3279
commit 0dcbfc57f5
7 changed files with 79 additions and 16 deletions
+6 -3
View File
@@ -53,7 +53,7 @@ enum RowKind {
case review(note: Note, md: [MDBlock])
case finding(index: Int)
case findingResponse(snapshot: Int, index: Int, response: String, reason: String)
case ready(when: Date, md: [MDBlock])
case ready(when: Date, md: [MDBlock], discard: Bool)
case handoff
case snapshot(Snapshot)
case question
@@ -575,7 +575,7 @@ final class TranscriptBuilder {
if ev.kind == "task.merge_after_review" && sink == nil {
lastMergeAfterReview = row.id
}
if ev.kind == "task.ready" && sink == nil {
if (ev.kind == "task.ready" || ev.kind == "task.discard_suggested") && sink == nil {
lastReady = row.id
}
if ev.kind == "inbox.created" && sink == nil {
@@ -796,7 +796,10 @@ final class TranscriptBuilder {
return note([.text("\(ev.actor) set the task summary")])
case "task.ready":
return Row(.ready(when: when, md: parseMarkdown(jsString(p["overview"]))), taskId: taskId)
return Row(.ready(when: when, md: parseMarkdown(jsString(p["overview"])), discard: false), taskId: taskId)
case "task.discard_suggested":
return Row(.ready(when: when, md: parseMarkdown(jsString(p["reason"])), discard: true), taskId: taskId)
case "task.discard_started":
return note([.text("\(ev.actor) asked to discard the task; the agent writes the task summary first")])