Skip to content

Enforce a daily docs-chat budget and restrict deployed CORS origins - #106

Open
arthurianresolve wants to merge 6 commits into
krypticmouse:mainfrom
arthurianresolve:fix-docs-chat-quota
Open

arthurianresolve wants to merge 6 commits into
krypticmouse:mainfrom
arthurianresolve:fix-docs-chat-quota

Conversation

@arthurianresolve

@arthurianresolve arthurianresolve commented Nov 9, 2026 •

Copy link
Copy Markdown

Summary of fix

The docs-chat Worker on upstream main forwards accepted requests to Mixedbread without a caller-level or aggregate quota. This PR adds both controls.

  • Enforce default daily limits of 10 provider calls per network and 200 across all networks. Reserve quota before the initial call and any fallback retry.
  • Group IPv4 clients by public address and IPv6 clients by /64. Users who share an address or prefix share an allowance. Traffic from multiple networks can still reach the aggregate cap.
  • Preserve the current day’s aggregate usage when upgrading an existing quota deployment. Both limits reset at midnight UTC.
  • Return 429 with Retry-After when either quota is exhausted, and 503 when the client network cannot be determined or quota cannot be reserved.
  • Reject disallowed browser origins before processing, including opaque Origin: null.

Fixes #97
Fixes #115

The per-network follow-up is in 692e02b. The shared support commit f5815bc normalizes .dsrs fixture line endings on Windows.

Validation

  • Seven Worker tests passed with a mocked provider. They cover per-network isolation, fallback accounting, daily reset, preservation of existing aggregate usage, and missing client addresses.
  • JavaScript syntax checks and git diff --check passed. The PR runs the Worker tests in CI.
  • A Wrangler dry run of the same Worker changes in fork PR Building a Fusion and Split Ops #28 verified the bundle and Durable Object bindings. No live Worker was deployed or tested.

AI Disclosure

  • OpenAI Codex assisted with implementation, tests, and PR drafting.
  • all fixes and drafts have been human-architected, human-directed and human-reviewed before publication of PR requests.

@mintlify

mintlify Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit a464d22.

Approve preview

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant