Skip to content

fix(cloudflare): make flag log capture per-request under concurrent requests - #508

Open
vahidlazio wants to merge 5 commits into
mainfrom
vahidt/flag-log-concurrency
Open

fix(cloudflare): make flag log capture per-request under concurrent requests#508
vahidlazio wants to merge 5 commits into
mainfrom
vahidt/flag-log-concurrency

Conversation

@vahidlazio

Copy link
Copy Markdown
Collaborator

Summary

  • Key the in-flight flag log by resolve id instead of a single shared slot — requests in the same isolate run concurrently and interleave at await points, so per-request keying keeps each request's log isolated for its whole lifetime (including across the sticky-assignment suspend/resume)
  • flags:apply claims its entries via a key diff around the synchronous apply_flags call (the token's resolve id isn't known to the handler upfront)
  • Finished logs are handed to the post-response queue send through a drained outbox Vec, and send/serialize errors are logged
  • The queue consumer skips unparseable messages instead of panicking the whole batch
  • Sticky-assignment writes go through the same outbox pattern

Test plan

  • Built and deployed to a test account
  • 2K resolve burst at ~160 rps: all flag applies accounted for end to end
  • Low-traffic resolves unaffected

🤖 Generated with Claude Code

vahidlazio and others added 5 commits August 6, 2026 15:28
…uests

Requests in the same isolate run concurrently and interleave at await
points. Key the in-flight flag log by resolve id so each request's log
stays isolated for its whole lifetime (including across the
sticky-assignment suspend/resume), hand finished logs to the
post-response queue send through a drained outbox, and skip
unparseable queue messages instead of panicking the batch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…w to outbox

The host never called confidence_resolver::seed_rng, so every isolate
generated the identical resolve-id sequence and ids collided across
isolates — downstream consumers key on resolve id and misbehave on
collisions. Seed once per isolate from host entropy at both worker
entry points.

At map capacity, flush pending entries to the outbox (still delivered,
at worst without telemetry) instead of discarding them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants