Fix inbox questions vanishing

This commit is contained in:
Ian Gulliver
2026-10-15 22:36:08 -07:00
parent a2ab3a74fc
commit f7a0ffcd4c
2 changed files with 1 additions and 28 deletions
-27
View File
@@ -32,33 +32,6 @@ func DeliverableResponse(t api.InboxResponseType) bool {
func (s *Store) CreateInboxItem(ctx context.Context, item api.InboxItem) error {
return s.write(ctx, func(tx *sql.Tx, emit emitFunc) error {
superseded := []string{}
rows, err := tx.QueryContext(ctx, `SELECT id FROM inbox_items WHERE thread_id = ? AND state = ?`, item.ThreadId, string(api.Open))
if err != nil {
return err
}
for rows.Next() {
id := ""
err = rows.Scan(&id)
if err != nil {
rows.Close()
return err
}
superseded = append(superseded, id)
}
rows.Close()
for _, id := range superseded {
_, err = tx.ExecContext(ctx, `UPDATE inbox_items SET state = ? WHERE id = ?`, string(api.Superseded), id)
if err != nil {
return err
}
err = emitItem(ctx, tx, emit, "inbox.updated", id, agentActor)
if err != nil {
return err
}
}
payload, err := json.Marshal(item.Payload)
if err != nil {
return err