Why: Background notice runs blocked chat, truncated results, and duplicated deliverable execution. Evidence: Focused run manager, card, server, recovery and race regressions pass locally; final combination checks are tracked in Dev. Impact: Persist full results and optional choices, fence dispatch by run identity, retain public child process, and repair legacy projections without a schema change. No paid model trial was run. Refs: feature/workbench-flow-completion
42 lines
1.2 KiB
Go
42 lines
1.2 KiB
Go
package cardsvc
|
|
|
|
import (
|
|
"agent-system-backend/internal/store"
|
|
core "agent-system-core"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestHistoricalResolvedChoiceDisplaysPersistedAnswer(t *testing.T) {
|
|
st, svc, _ := openTest(t)
|
|
hitl := core.HITLCard{ID: "old-choice", ConversationID: "cnv_1"}
|
|
if err := st.SaveHITLCard(store.OwnerDefault, &hitl); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := st.ResolveHITLCard(store.OwnerDefault, hitl.ID, core.HITLResolvedPayload{CardID: hitl.ID, Answer: "生成摘要", Kind: "choice"}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
card, err := svc.Create(store.OwnerDefault, core.ActivityCard{Kind: core.CardKindConfirm, Status: core.CardResolved, Body: []core.UINode{{Type: core.UIMarkdown, Markdown: "_可在输入框自由输入回应。_"}}}, "hitl:"+hitl.ID)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
got, err := svc.Get(store.OwnerDefault, card.ID)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
found := false
|
|
for _, node := range got.Body {
|
|
if strings.Contains(node.Markdown, "输入框") {
|
|
t.Fatal("stale input hint retained")
|
|
}
|
|
for _, pair := range node.KV {
|
|
if pair[1] == "生成摘要" {
|
|
found = true
|
|
}
|
|
}
|
|
}
|
|
if !found {
|
|
t.Fatal("stored choice answer missing")
|
|
}
|
|
}
|