fix(store): post open chat task states once after the posted-status migration

This commit is contained in:
sam committed 2026-10-25 02:46:43 +11:00
1 parent d2cbe25814
commit 49277babe4
4 files changed
+23 -8

No files matched your search

@@ -750,17 +750,19 @@ func (q *Queries) LockTaskStatus(ctx context.Context, id int64) (string, error)
}
const markOutcomePosted = `-- name: MarkOutcomePosted :exec
UPDATE tasks SET outcome_posted_status = $2 WHERE id = $1
UPDATE tasks SET outcome_posted_status = COALESCE(NULLIF($1::text, ''), status) WHERE id = $2
`
type MarkOutcomePostedParams struct {
ID int64
OutcomePostedStatus string
Posted string
ID int64
}
// Records the status whose state reached the task's conversation.
// Records the status whose state reached the task's conversation. A caller
// that names none (an older archied) marks the current status, so a mixed
// deploy cannot leave a posted state looking unposted forever.
func (q *Queries) MarkOutcomePosted(ctx context.Context, arg MarkOutcomePostedParams) error {
_, err := q.db.Exec(ctx, markOutcomePosted, arg.ID, arg.OutcomePostedStatus)
_, err := q.db.Exec(ctx, markOutcomePosted, arg.Posted, arg.ID)
return err
}