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
32 lines
852 B
Go
32 lines
852 B
Go
package store
|
|
|
|
import (
|
|
core "agent-system-core"
|
|
"encoding/json"
|
|
)
|
|
|
|
// WorkDispatches is an internal startup-recovery scan. Individual reads and
|
|
// commits still use the normal owner and effective-account fences.
|
|
func (s *Store) WorkDispatches() (map[string][]core.ActivityCard, error) {
|
|
rows, err := s.db.Query(`SELECT owner,payload FROM activity_cards`)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
result := map[string][]core.ActivityCard{}
|
|
for rows.Next() {
|
|
var owner, raw string
|
|
if err := rows.Scan(&owner, &raw); err != nil {
|
|
return nil, err
|
|
}
|
|
var card core.ActivityCard
|
|
if json.Unmarshal([]byte(raw), &card) != nil {
|
|
continue
|
|
}
|
|
if card.Work != nil && card.Work.Decision != nil && card.Work.Decision.State == "dispatching" {
|
|
result[owner] = append(result[owner], card)
|
|
}
|
|
}
|
|
return result, rows.Err()
|
|
}
|