Share snapshot classification across review and readiness queries

This commit is contained in:
Ian Gulliver
2026-10-21 11:55:19 -07:00
parent 1b5f42a01a
commit 66affd7622
3 changed files with 9 additions and 15 deletions
+2 -2
View File
@@ -772,9 +772,9 @@ func (s *Store) ReadyPromptDue(ctx context.Context, id string) (bool, error) {
err := s.db.QueryRowContext(ctx, `SELECT EXISTS (
SELECT 1 FROM events e, tasks t
WHERE t.id = ? AND e.task_id = t.id AND e.seq > t.ready_prompt_seq
AND ((e.kind = 'snapshot.created' AND json_extract(e.payload, '$.trigger') NOT IN (?, ?, ?))
AND ((e.kind = 'snapshot.created' AND json_extract(e.payload, '$.trigger') NOT IN `+cutPointTriggers+`)
OR (e.kind = 'user.message' AND e.actor != ? AND e.actor NOT LIKE '% (lead)' AND json_extract(e.payload, '$.bounce') IS NOT 1))
)`, id, string(api.SnapshotTriggerAnswer), string(api.SnapshotTriggerFork), string(api.SnapshotTriggerAskHuman), agentActor).Scan(&due)
)`, id, agentActor).Scan(&due)
return due, err
}