File no report for a turn that asks a blocking question

This commit is contained in:
Ian Gulliver
2026-10-15 10:41:18 -07:00
parent b6df27f085
commit 535f5579f9
5 changed files with 26 additions and 7 deletions
+18 -4
View File
@@ -394,18 +394,26 @@ const colorPrompt = `I need a file color.txt containing exactly one color name.
`When you get my answer, write the file.`
func (e *env) openQuestions(sessionID string) []api.InboxItem {
return e.openItems(sessionID, api.Question)
}
func (e *env) openReports(sessionID string) []api.InboxItem {
return e.openItems(sessionID, api.Report)
}
func (e *env) openItems(sessionID string, kind api.InboxItemKind) []api.InboxItem {
e.t.Helper()
items, err := e.store.ListInbox(e.ctx, store.InboxFilter{SessionID: sessionID, State: api.Open})
if err != nil {
e.t.Fatalf("list inbox: %v", err)
}
questions := []api.InboxItem{}
matched := []api.InboxItem{}
for _, item := range items {
if item.Kind == api.Question {
questions = append(questions, item)
if item.Kind == kind {
matched = append(matched, item)
}
}
return questions
return matched
}
func (e *env) respond(m *agents.Manager, item api.InboxItem, typ api.InboxResponseType, option, text string, state api.InboxState) {
@@ -470,6 +478,9 @@ func TestAskHumanRoundTrip(t *testing.T) {
if _, err := os.Stat(filepath.Join(e.task.WorktreePath, "color.txt")); err == nil {
t.Fatalf("agent wrote color.txt before getting an answer")
}
if reports := e.openReports(sess.Id); len(reports) != 0 {
t.Fatalf("turn that asked a blocking question filed a report: %+v", reports)
}
waiting, err := e.store.AwaitingHuman(e.ctx, sess.Id)
if err != nil || waiting != 1 {
@@ -496,6 +507,9 @@ func TestAskHumanRoundTrip(t *testing.T) {
if strings.TrimSpace(string(out)) != "blue" {
t.Fatalf("color.txt contains %q, want blue", out)
}
if reports := e.openReports(sess.Id); len(reports) != 1 {
t.Fatalf("want one report from the answered turn, got %+v", reports)
}
pending, err := e.store.Undelivered(e.ctx, sess.Id)
if err != nil || len(pending) != 0 {