Retry failed sends with their send_id until the server confirms them

This commit is contained in:
Ian Gulliver
2026-10-20 15:47:29 -07:00
parent 8fec4b9040
commit d096d604c9
9 changed files with 111 additions and 14 deletions
+10
View File
@@ -1356,6 +1356,16 @@ func (s *Store) SessionStarted(ctx context.Context, sessionID string) (bool, err
return started, err
}
func (s *Store) UnusedSession(ctx context.Context, taskID, member string) (string, bool, error) {
id := ""
err := s.db.QueryRowContext(ctx, `SELECT id FROM agent_sessions WHERE task_id = ? AND member = ? AND role = ? AND state = ? AND started = 0 AND pending = 0 LIMIT 1`,
taskID, member, string(api.Implementer), string(api.AgentSessionStateIdle)).Scan(&id)
if errors.Is(err, sql.ErrNoRows) {
return "", false, nil
}
return id, err == nil, err
}
func (s *Store) SessionPending(ctx context.Context, sessionID string) (bool, error) {
pending := false
err := s.db.QueryRowContext(ctx, `SELECT pending FROM agent_sessions WHERE id = ?`, sessionID).Scan(&pending)