Let the lead reorder tabs on what the pane already shows

This commit is contained in:
Ian Gulliver
2026-10-15 10:45:08 -07:00
parent 535f5579f9
commit f360d14655
3 changed files with 45 additions and 6 deletions
+17
View File
@@ -2,6 +2,7 @@ package agents_test
import (
"fmt"
"slices"
"strings"
"testing"
"time"
@@ -89,6 +90,22 @@ func TestLeadSignalsAndShow(t *testing.T) {
t.Fatalf("focus moved while the pane was focused: %+v", f)
}
_, err = m.MessageLead(e.ctx, e.user, "Call the show tool with task_id "+e.task.Id+", tabs [\"inbox\", \"changes\"] and tab \"inbox\". Then say done.", "", nil)
if err != nil {
t.Fatalf("message lead: %v", err)
}
e.waitFor("show of what is already shown", func(ev api.Event) bool {
return ev.Kind == "agent.tool_result" && ev.Owner != nil && strings.Contains(fmt.Sprint(ev.Payload), "Already shown")
})
e.waitFor("lead idle after already-shown show", leadIdle)
f, err = e.store.GetFocus(e.ctx, login)
if err != nil {
t.Fatalf("get focus: %v", err)
}
if f.Tab != api.TabInbox || !slices.Equal(f.Tabs, []api.TaskTab{api.TabInbox, api.TabChanges}) {
t.Fatalf("tabs not reordered on the shown tab: %+v", f)
}
err = e.store.WithdrawItem(e.ctx, created[len(created)-1].Payload["id"].(string))
if err != nil {
t.Fatalf("withdraw report: %v", err)