Attach a refs/notes/byre note to each squash merge and push it

This commit is contained in:
Ian Gulliver
2026-10-15 19:44:53 -07:00
parent c5e3a680d8
commit 6741177f53
8 changed files with 275 additions and 11 deletions
+34
View File
@@ -866,6 +866,40 @@ func (s *Store) TaskEventsTail(ctx context.Context, taskID string, limit int) ([
return scanEvents(rows)
}
type Handoff struct {
SessionID string
At time.Time
Text string
}
func (s *Store) TaskHandoffs(ctx context.Context, taskID string) ([]Handoff, error) {
rows, err := s.db.QueryContext(ctx, `
SELECT agent_session_id, created_at, coalesce(json_extract(payload, '$.result'), '') FROM events
WHERE task_id = ? AND kind = 'turn.ended' AND json_extract(payload, '$.handoff') = 1
ORDER BY seq
`, taskID)
if err != nil {
return nil, err
}
defer rows.Close()
handoffs := []Handoff{}
for rows.Next() {
h := Handoff{}
at := ""
err = rows.Scan(&h.SessionID, &at, &h.Text)
if err != nil {
return nil, err
}
h.At, err = parseTime(at)
if err != nil {
return nil, err
}
handoffs = append(handoffs, h)
}
return handoffs, rows.Err()
}
func (s *Store) LeadEvents(ctx context.Context, owner string, after int64, limit int) ([]api.Event, error) {
rows, err := s.db.QueryContext(ctx, `
SELECT `+eventColumns+`