From 4bc541ca85c688c881d487971395c18767214ee0 Mon Sep 17 00:00:00 2001 From: prosolis <5590409+prosolis@users.noreply.github.com> Date: Tue, 28 Apr 2026 17:50:24 -0700 Subject: [PATCH] =?UTF-8?q?Coop:=20shorten=20first-day=20window=20?= =?UTF-8?q?=E2=80=94=20require=2012h=20since=20lock,=20not=20date=20change?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previous guard skipped resolution if lock_date == today_date, pushing first-day windows to 24-32h regardless of when in the UTC day the lock fired. With per-minute lock checks, the original same-tick race no longer exists, so the date guard was just adding latency. New guard: at least 12h since lock. Late-night locks still get >12h funding/voting windows; early-morning locks get 24h+ as before. No effect on the existing run #1. Co-Authored-By: Claude Opus 4.7 (1M context) --- internal/plugin/coop_dungeon_scheduler.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/internal/plugin/coop_dungeon_scheduler.go b/internal/plugin/coop_dungeon_scheduler.go index 835855a..d4dbb2f 100644 --- a/internal/plugin/coop_dungeon_scheduler.go +++ b/internal/plugin/coop_dungeon_scheduler.go @@ -148,11 +148,15 @@ func (p *AdventurePlugin) coopProcessActiveRuns() { slog.Error("coop: load active runs", "err", err) return } - today := time.Now().UTC().Format("2006-01-02") + now := time.Now().UTC() for _, run := range runs { - // Skip runs locked on this same tick — they need a full day for - // funding decisions and voting before the first floor resolves. - if run.LockedAt != nil && run.LockedAt.UTC().Format("2006-01-02") == today { + // Need at least a 12h funding window between lock and the first + // floor resolution. Without this, a run locked at 07:00 UTC would + // resolve an hour later at 08:00 UTC. With per-minute lock checks + // (locks now fire any time), the previous "same UTC date" guard + // was too conservative — it pushed first-day windows out to 24-32h + // even when 13-23h would have been plenty. + if run.LockedAt != nil && now.Sub(run.LockedAt.UTC()) < 12*time.Hour { continue } if err := p.coopResolveFloor(run); err != nil {