Repository navigation
Conversation
… cold starts - Add a (game_id, action_type, created_at) index on turn_actions so per-game history, Punch, taunt, and stats reads stop scanning every game's actions. - Run game-action in us-east-1, the forceable region closest to the us-east-2 database, and allow the x-region CORS header it needs. - Report worker boot time, commit, and completion in Server-Timing and the slow game-action log, and log cold starts even when they are fast. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 04db1bccf4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const timer = new ActionTimer(pendingBootMs); | ||
| pendingBootMs = null; |
There was a problem hiding this comment.
Preserve cold-start timing across CORS preflight requests
When a fresh worker first receives a browser's CORS preflight, this clears pendingBootMs before the OPTIONS branch returns without calling timer.toHeaders() or timer.logIfSlow(). The boot measurement is therefore discarded, and subsequent POST requests handled by that worker are reported as warm. This loses the new cold-start diagnostics for precisely that browser request sequence. Preserve the pending measurement until a POST consumes it, or explicitly record it on the preflight response.
Useful? React with 👍 / 👎.
When a player action takes as long as the server-slowness banner delay, submit a SlowGameAction warning with each attempt's duration, status, serving region, and Server-Timing breakdown, plus the connection type. Expose the timing headers to web clients so browser reports match native. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Why
Players keep seeing "Server is taking longer than usual…". This PR fixes the cheap causes and adds the telemetry needed to diagnose the rest.
Changes
turn_actions (game_id, action_type, created_at). Five per-game reads (turn history, Punch history, taunt checks, final-game stats) previously scanned every game's actions.schema.sqlmatches the migration.game-actionnow runs inus-east-1. The database is inus-east-2, which can't be forced, andus-east-1is the closest region that can. Local backends are unaffected. The function's CORS allow-list now includesx-region.Server-Timingand theslow game-actionlog now includecommit,complete, and workerboottime. First requests after the function was idle are also logged, ascold game-action, when they are fast. Responses now expose the timing headers so web clients can read them.SlowGameActionwarning (one stack per action type) containing:networkwhen the function never answered)Deploy status
The migration and both
game-actiondeploys are already live on the hosted project, so this is safe to merge.Validation
npm run typecheck,npm run typecheck:edge,npm run lintnpm run test(221 pass, including newslowActionReporttests),npm run test:edge(44 pass)x-region, and responses exposeserver-timingandx-sb-edge-region.🤖 Generated with Claude Code