Skip to content

refactor(rate-limit): window failure policy on the canonical limiter; a2a, openai-compat and the integration limiter ride it (#18087) - #21823

Merged
mrveiss merged 22 commits into
mainfrom
issue-18087-rate-limiter-forks
Nov 20, 2026
Merged

mrveiss merged 22 commits into
mainfrom
issue-18087-rate-limiter-forks

Conversation

@mrveiss

@mrveiss mrveiss commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

Thinking Path

This PR was opened for an existing branch that never had one (triage status UNFINISHED). The branch carries 5ahead commit(s) of work not on main, linked to #18087 (refactor(mcp): four copy-paste rate limiters should fold into the canonical RateLimiter). It still needs a conflict sync with main and a review before it can merge. Acceptance criteria have not been verified against this branch.

What Changed

Commits on the branch (not on main):

Diff summary: 29 files changed, 1159 insertions(+), 986 deletions(-)

Verification

Not yet verified. No CI evidence: this is a draft; no CI has run on it yet, and it needs a conflict sync with main and a review first.

Model Used

Branch authored by earlier Claude sessions; PR opened by Claude Sonnet 5.5.

Refs #18087

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Rate limits are applied consistently across supported API endpoints, with shared enforcement across workers when Redis is available.
    • Limits continue to be enforced locally during Redis outages, helping prevent unrestricted request bursts.
    • Added a configurable cap on the number of request keys tracked by local rate-limit fallback.
  • Bug Fixes

    • Integration rate limits now recognise Retry-After values provided as either a delay or an HTTP date; invalid values are ignored.
  • Documentation

    • Documented the rate-limit fallback setting and its default value.

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 8 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 8daf2b5 and bf75ed8.

Files ignored due to path filters: 1

  • .test_durations is excluded by !**/.test_durations*
Files selected for processing: 25

  • autobot-backend/a2a/a2a_security_test.py
  • autobot-backend/api/a2a.py
  • autobot-backend/api/openai_compat.py
  • autobot-backend/api/openai_compat_test.py
  • autobot-backend/api/rum_ingest_bounds.py
  • autobot-backend/integrations/rate_limiter.py
  • autobot-backend/integrations/rate_limiter_test.py
  • autobot-backend/llm_shared/cross_worker_rate_limiter.py
  • autobot-backend/tests/api/test_rum_access_16375.py
  • autobot-backend/tests/test_concurrency_global_locks.py
  • autobot_shared/env_registry.py
  • autobot_shared/env_registry_backend_services.py
  • autobot_shared/env_registry_rate_limit.py
  • autobot_shared/rate_limit.py
  • autobot_shared/rate_limit_test.py
  • autobot_shared/rate_limiter.py
  • autobot_shared/rate_limiter_log_label_18087_test.py
  • autobot_shared/rate_limiter_window.py
  • autobot_shared/rate_limiter_window_18087_test.py
  • docs/developer/ENV_VARS.md
  • repo_tests/_reach_declared_scopes.py
  • repo_tests/_reach_policy_verdicts.py
  • repo_tests/_reach_roots_record.py
  • repo_tests/one_rate_limiter_18087_test.py
  • repo_tests/reach_scope_claim_17844_test.py

No actionable comments were generated in the recent review.

Walkthrough

The change adds shared window-quota handling with configurable Redis-failure policies. API endpoints adopt scoped quotas, and the integration limiter separates provider pauses from local request windows. Tests and repository checks cover the new behaviour and canonical limiter use.

Changes: Shared rate-limiter consolidation

Layer / File(s) Summary
Shared window quota and fallback handling
autobot_shared/rate_limiter.py, autobot_shared/rate_limiter_window.py, autobot_shared/rate_limiter_window_18087_test.py, autobot_shared/rate_limit.py, autobot_shared/rate_limit_test.py, autobot_shared/env_registry*.py, docs/developer/ENV_VARS.md, autobot-backend/tests/test_concurrency_global_locks.py, autobot-backend/llm_shared/cross_worker_rate_limiter.py
The canonical limiter adds Redis-failure policies, local window tracking, and usage reporting. WindowQuota and its tests are added. The local-key-cap environment variable is registered and documented. The legacy IPRateLimiter and its tests are removed.
API limiter migration
autobot-backend/api/a2a.py, autobot-backend/a2a/a2a_security_test.py, autobot-backend/api/openai_compat.py, autobot-backend/api/openai_compat_test.py, autobot-backend/api/rum_ingest_bounds.py, autobot-backend/tests/api/test_rum_access_16375.py
The A2A, OpenAI-compatible, and RUM ingest endpoints use scoped WindowQuota instances. Their tests check quota configuration, local fallback, and RUM rejection logging.
Integration request windows and provider pauses
autobot-backend/integrations/rate_limiter.py, autobot-backend/integrations/rate_limiter_test.py
The integration limiter uses separate local minute and hour counters and tracks provider pauses independently. Retry-After accepts delta-seconds or an HTTP date. Tests cover limits, expiry, and pause handling.
Repository rate-limiter guard
repo_tests/one_rate_limiter_18087_test.py, repo_tests/_reach_declared_scopes.py, repo_tests/_reach_policy_verdicts.py, repo_tests/_reach_roots_record.py, repo_tests/reach_scope_claim_17844_test.py
A repository test scans production Python for selected rate-limiter implementation shapes and checks its allowlist. Reach-scope records and an existing reach test include the scan.
Merge Risk: Moderate · previous review 8daf2

This change consolidates several rate limiters onto one canonical implementation. During a Redis outage, the in-process fallback can grow memory without bound under many distinct clients, and the fallback logs noisily. Smaller defects remain in window eviction, zero-limit handling, provider pause handling, and the repository guard. They should be fixed before merging, since the PR reports no CI results yet.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names a refactor that moves rate limiting onto the canonical limiter with a window failure policy, and says the a2a, OpenAI-compat and integration limiters now use it. The diff matches this.…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names a refactor that moves rate limiting onto the canonical limiter with a window failure policy, and says the a2a, OpenAI-compat and integration limiters now use it. The diff matches this. It adds WindowFailurePolicy and WindowQuota, switches a2a, openai-compat, RUM ingest and the integration limiter to them, and removes IPRateLimiter. The title is specific and tied to the main change. It is long (133 characters) and includes the issue number, but it stays accurate.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 570b1e5 and 8daf2b5.

Files ignored due to path filters: 1

  • .test_durations is excluded by !**/.test_durations*
Files selected for processing: 5

  • autobot_shared/env_registry_rate_limit.py
  • docs/developer/ENV_VARS.md
  • repo_tests/_reach_declared_scopes.py
  • repo_tests/_reach_roots_record.py
  • repo_tests/one_rate_limiter_18087_test.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@github-actions

Copy link
Copy Markdown
Contributor

Auto-sync: merging main into issue-18087-rate-limiter-forks conflicts

The sync aborted the merge and pushed nothing. Conflicts are information, so it never resolves one itself. Below, for each conflicted file, are the commits that touched it on each side since the merge base 38c62a97b8. Merge main in yourself and push; the label clears on the first run that finds this branch 0 behind.

.test_durations

side commit subject issue refs
main 025ef8daa7 fix(agents): product code no longer reads dev agents; real tier-map validation (#21718) #21718
main 09e02774dc docs(process): drop the retired handoff's callers and docs (#21676) #21676
main 0ff56cbad7 test(chat): name the secret-shape params, so no key-shaped node id lands in the durations file (#17313) #17313
main b00016f1d5 chore(ci): refresh per-test split durations (#17313) #17313
main 75e8e92021 ci(workflows): rename the LLC Contract Gate to Company OS and guard user-visible workflow names (#19546) #19546
main 25e0af0e31 chore(hooks): remove the pre-push open-PR cap — owner rule: no cap on open PRs, push finished work (#19397) #19397
main bdd5bf10bd fix(slm-agent): the role-registry path skips the common role; the UI deploy keeps it (#19040) #19040
main 7766177c94 refactor(monitoring): fold install-prometheus-stack.sh into the monitoring role; allow-list guard for static data files (#18556) #18556
main 38109c8640 fix(tests): planted-violation cases are named by checker, so no planted literal reaches .test_durations (#17440) #17440
main 93d2812aa6 chore(ci): refresh per-test split durations from test-durations run 38425248659 (#17886, #17313) #17886, #17313
this branch 2326f95abc refactor(rate-limit): drop .test_durations entries for the deleted rate_limit_test (#18087) #18087

autobot-backend/api/a2a.py

side commit subject issue refs
main 1051a02c22 security(proxy): read X-Forwarded-For from the right, skipping trusted proxies (#17848) #17848
this branch 16c9f10ed0 refactor(rate-limit): fold IPRateLimiter, the four MCP counters and the session limiter into the canonical RateLimiter (#18087, #7271) #18087, #7271

autobot-backend/api/auth.py

side commit subject issue refs
main f9eccbf4f5 fix(auth): verify configured user credentials through the canonical hasher (#21088) #21088
main c3d6b77b5f fix(workflow): resolve the step owner's current role from the user database (#19807) #19807
main c47a660369 security(auth): write the revocation marker after commit, outlive refresh, cover sessions and renames (#20443) #20443
main 67c587376c fix(auth): WebSocket gates and /auth/refresh enforce password-change and session revocation (#18688) #18688
main 50904ac917 fix(auth): redis start/restart use one operator gate; logout-adjacent and file paths enforce password-change revocation (#18688) #18688
main 196ab113d2 refactor(audit): one dotted audit action vocabulary — canonical mapping at the write boundary and on read, writers switched (#18716) #18716
main 8288e440dc refactor(forks): symbol-fork batch 9 tier B — SLM NodeEventType/SlmNodeAuditLog/SlmSecurityPolicy, ComplianceEventType, IdentityAuditAction, UserManagementMode (#17312) #17312
main 0fd7c550fb fix(security): MCP and auth throttling is logged again at each 429; strict limiter-test outcomes (#18087) #18087
main bda64d5f5b refactor(security): the MCP and auth rate limiters use the canonical RateLimiter — one global count per limit, env-backed values (#18087) #18087
main 99e730a0a8 fix(train): train-8b CI reds on the merged tree — SLM generated types, #18441 needless spread, #18462 heartbeat test's document_sources, password- and entity-derived log text (#17618) #18441, #18462, #17618
main b91ba0e011 refactor(audit): one audit write and read path -- retire three stores, adapt audit_logger, route SecurityLayer, one retention table (#17225) #17225
main 0b78abf262 refactor(user-mgmt): one UserService in autobot_shared, each backend binding its User and its own hooks (#15068) #15068
this branch 16c9f10ed0 refactor(rate-limit): fold IPRateLimiter, the four MCP counters and the session limiter into the canonical RateLimiter (#18087, #7271) #18087, #7271

autobot-backend/api/browser_mcp.py

side commit subject issue refs
main 8abd3984fe fix(timeouts): timeout messages state the duration the code waits on (#18056) #18056
main 0fd7c550fb fix(security): MCP and auth throttling is logged again at each 429; strict limiter-test outcomes (#18087) #18087
main bda64d5f5b refactor(security): the MCP and auth rate limiters use the canonical RateLimiter — one global count per limit, env-backed values (#18087) #18087
this branch 16c9f10ed0 refactor(rate-limit): fold IPRateLimiter, the four MCP counters and the session limiter into the canonical RateLimiter (#18087, #7271) #18087, #7271

autobot-backend/api/database_mcp.py

side commit subject issue refs
main 0fd7c550fb fix(security): MCP and auth throttling is logged again at each 429; strict limiter-test outcomes (#18087) #18087
main bda64d5f5b refactor(security): the MCP and auth rate limiters use the canonical RateLimiter — one global count per limit, env-backed values (#18087) #18087
this branch 16c9f10ed0 refactor(rate-limit): fold IPRateLimiter, the four MCP counters and the session limiter into the canonical RateLimiter (#18087, #7271) #18087, #7271

autobot-backend/api/git_mcp.py

side commit subject issue refs
main 0fd7c550fb fix(security): MCP and auth throttling is logged again at each 429; strict limiter-test outcomes (#18087) #18087
main bda64d5f5b refactor(security): the MCP and auth rate limiters use the canonical RateLimiter — one global count per limit, env-backed values (#18087) #18087
this branch 16c9f10ed0 refactor(rate-limit): fold IPRateLimiter, the four MCP counters and the session limiter into the canonical RateLimiter (#18087, #7271) #18087, #7271

autobot-backend/api/http_client_mcp.py

side commit subject issue refs
main 0fd7c550fb fix(security): MCP and auth throttling is logged again at each 429; strict limiter-test outcomes (#18087) #18087
main bda64d5f5b refactor(security): the MCP and auth rate limiters use the canonical RateLimiter — one global count per limit, env-backed values (#18087) #18087
this branch 16c9f10ed0 refactor(rate-limit): fold IPRateLimiter, the four MCP counters and the session limiter into the canonical RateLimiter (#18087, #7271) #18087, #7271

autobot-backend/api/openai_compat.py

side commit subject issue refs
main 2610a51888 fix(billing): refuse chat LLM calls when the user's or tenant's budget is exhausted (#16845) #16845
main 45e1d54a6a fix(llm-auth): scope and reset the LLM principal, explicit scope on disconnect, registry-checked status/revoke, exact callback path, non-burnable state, one principal id (#19241) #19241
main 29c6f90ae4 fix(llm-auth): LLM calls use the signed-in token — the user's own, then the system one, then the API key (#19241) #19241
main f8126e5482 fix(train): train-60 — #18812 extended: LLMService uses the configured routing strategy via get_active_router(), chat_completions split into helpers that resolve the router once, every strategy honours config.enabled through one disabled_route and supports reset_metrics (#18297) #18812, #18297
main 13049f951d fix(api): use fallback routing for auto completions none
main ef32dda6be fix(openai-compat): reject escalation without model id (#18297) #18297
main 719c810e5d fix(openai-compat): honor configured routing strategy (#18297) #18297
main 26158f1272 Merge #18403 @ c935d16 into train-2026-10-12-7b #18403
main 6ddbd65e00 feat(llm): needs_reauth registry skip + typed error, header headroom harvest, pre-dispatch headroom routing (#15022, #15026, #15028) #15022, #15026, #15028
main 1051a02c22 security(proxy): read X-Forwarded-For from the right, skipping trusted proxies (#17848) #17848
this branch 16c9f10ed0 refactor(rate-limit): fold IPRateLimiter, the four MCP counters and the session limiter into the canonical RateLimiter (#18087, #7271) #18087, #7271

autobot-backend/api/openai_compat_test.py

side commit subject issue refs
main 13049f951d fix(api): use fallback routing for auto completions none
main ef32dda6be fix(openai-compat): reject escalation without model id (#18297) #18297
main 719c810e5d fix(openai-compat): honor configured routing strategy (#18297) #18297
this branch 16c9f10ed0 refactor(rate-limit): fold IPRateLimiter, the four MCP counters and the session limiter into the canonical RateLimiter (#18087, #7271) #18087, #7271

autobot-backend/tests/unit/api/test_browser_status_contract.py

side commit subject issue refs
main bda64d5f5b refactor(security): the MCP and auth rate limiters use the canonical RateLimiter — one global count per limit, env-backed values (#18087) #18087
this branch 16c9f10ed0 refactor(rate-limit): fold IPRateLimiter, the four MCP counters and the session limiter into the canonical RateLimiter (#18087, #7271) #18087, #7271

autobot-backend/utils/thread_safety_test.py

side commit subject issue refs
main d757cec419 fix(config): rollback reads before/after under the one config lock (#18478) #18478
main be4516c468 refactor(config): one name for the config manager instance, unified_config_manager and global_config_manager removed (#21533) #21533
main 9bbeb0cb2c fix(security): the MCP-server quota key hashes the whole token; limiter error logs never carry the key; lock assertions follow the canonical limiter (#18087) #18087
this branch 16c9f10ed0 refactor(rate-limit): fold IPRateLimiter, the four MCP counters and the session limiter into the canonical RateLimiter (#18087, #7271) #18087, #7271

autobot_shared/env_registry_backend_services.py

side commit subject issue refs
main 7d9d288085 chore(merge): merge origin/main into issue-20195-attachments-reach-answer (#20195) #20195
main 294edeb163 fix(transcriber): uploads are written where the path guard allows, from one key (#19823) #19823
main cf26562f0c fix(chat): attached files reach the answer as bounded untrusted data (#20195) #20195
main 7384cd7247 fix(config): one home for each value #18094 AC2 found defined twice (#18094) #18094
main 6092ba2c20 fix(chat): strict ownership for turn cancel, cancellable fallback, clamped timeouts, cross-worker cancel, Ctrl+C on cancel (#17273) #17273
main 96d15e89fe fix(chat): cancel the graph turn on client disconnect, bound it in time, add a turn-cancel route (#17273) #17273
this branch 16c9f10ed0 refactor(rate-limit): fold IPRateLimiter, the four MCP counters and the session limiter into the canonical RateLimiter (#18087, #7271) #18087, #7271

autobot_shared/rate_limiter.py

side commit subject issue refs
main 8c1c22cbad fix(slm): login limiter cannot lock out a real user, fails open loudly, bounds audit rows (#20600) #20600
main 823e849b59 fix(security): record, get_retry_after and get_remaining log the exception class only, and their fail-open paths go through the rate-limited warning (#18617) #18617
main 754fed48bf fix(security): the rate-limiter window counts same-tick requests separately, and a silent fail-open now warns (rate-limited, label only) (#18617) #18617
main cd6ad4b95c fix(security): rate-limiter logs carry only the limiter label, never a key-derived value (#18087) #18087
main 9bbeb0cb2c fix(security): the MCP-server quota key hashes the whole token; limiter error logs never carry the key; lock assertions follow the canonical limiter (#18087) #18087
main 0fd7c550fb fix(security): MCP and auth throttling is logged again at each 429; strict limiter-test outcomes (#18087) #18087
this branch 16c9f10ed0 refactor(rate-limit): fold IPRateLimiter, the four MCP counters and the session limiter into the canonical RateLimiter (#18087, #7271) #18087, #7271

docs/developer/ENV_VARS.md

side commit subject issue refs
main 4574f5b764 fix(chat): the owner index is complete only behind a marker, and rebuilds off the event loop (#21664) #21664
main 487ed6ae50 Merge main into issue-20949-retrieval-benchmark (auto-sync) [skip ci] none
main 3443de5ca2 Merge main into issue-20945-kb-graph-buckets (auto-sync) [skip ci] none
main c06ee73ced Merge main into issue-20949-retrieval-benchmark (auto-sync) [skip ci] none
main 5cee21b5a6 fix(llc): every started router worker keeps contesting the lock and routes only while it holds it (#21456) #21456
main 930246e759 fix(llc): the notification router lock has an owner, is renewed, and is released only by it (#21456) #21456
main 7b4116b7c2 Merge main into issue-20945-kb-graph-buckets (auto-sync) [skip ci] none
main a42052506d Merge main into issue-20949-retrieval-benchmark (auto-sync) [skip ci] none
main 9e80a8af94 Merge main into the merge train none
main 4977e1b0d6 Merge main into issue-20945-kb-graph-buckets (auto-sync) [skip ci] none
main dfa4c159ee Merge main into issue-20949-retrieval-benchmark (auto-sync) [skip ci] none
main 22ea706f57 Merge main into issue-20894-log-dir none
main 0003e2108b Merge main into issue-21003-run-state-batch (auto-sync) [skip ci] none
main 0f3ae72e7d Merge main into issue-20945-kb-graph-buckets (auto-sync) [skip ci] none
main bbbed1078c Merge main into issue-20949-retrieval-benchmark (auto-sync) [skip ci] none
main 693 more commit(s) not listed
this branch 16c9f10ed0 refactor(rate-limit): fold IPRateLimiter, the four MCP counters and the session limiter into the canonical RateLimiter (#18087, #7271) #18087, #7271

repo_tests/_reach_policy.py

side commit subject issue refs
main a471e4d87e test(i18n): a shrink-only ratchet on hard-coded English UI text, per file (#12732) #12732
main 091af388da fix(api): register literal routes ahead of the {param} routes that captured them (#18720) #18720
main b10b96593b fix(config): floor the env-family guard's reach and declare its filter widening (#18555) #18555
main 246b86f9ee test(train): record why #18641's backoff-formula-scan allowance is absolute (#15402) #18641, #15402
main 8ba19f55b0 Merge #18626 @ 514e49b into train-2026-10-17-22b #18626
main a44a310265 refactor(llm): one Anthropic-family message formatter shared by the anthropic and vertexai providers (#16815) #16815
main 547f376ebb refactor(resilience): the circuit breaker moves to autobot_shared behind a backend shim; a guard stops new hand-rolled breakers (#18554) #18554
main a388889be4 Merge #18612 @ af1ff7e into train-2026-10-16-20 #18612
main 8864e0c436 fix(slm): node enrollment deploys the real agent through the slm_agent role; the inline stand-in agent and string-embedded playbook are gone (#18606) #18606
main 383ea8c375 refactor(redis): a guard freezes today's direct Redis constructors; the terminal and timeout callers use the canonical client (#18553) #18553
main 8251c2087f Merge #18595 @ a600d2a into train-2026-10-16-17b #18595
main 0be6ce0c6a Merge #18591 @ 5f94ace into train-2026-10-16-17b (hub union: reach policy) #18591
main a600d2afc0 refactor(backend): retire 8 compatibility facades; importers use the canonical modules (#18552) #18552
main aaeb648337 refactor(data): one copy of each static data file (#18556) #18556
main 960fa5086c refactor(browser): one playwright-server.js; drop the unreferenced backup compose (#18549) #18549
main 96 more commit(s) not listed
this branch 22cf95eca4 refactor(rate-limit): guard that no second rate limiter appears outside the canonical module (#18087) #18087

repo_tests/python_file_size_ratchet_baseline.py

side commit subject issue refs
main ad4e03163c dedup(ratchet): one ceiling table per size gate, checked against the base commit; a guard bars a second one (#19544) #19544
main c79ad98806 Merge main @ 6f1dcd3 into the merge train (PR #19638) #19638
main 51f15381cd Merge #19396 @ 1148b33 into train-2026-10-26-85l #19396
main 3730956301 Merge #19415 @ 8b7452d into train-2026-10-26-85l #19415
main c66adca250 Merge #19392 @ 84e1d04 into train-2026-10-26-85l #19392
main 2224f6e036 Merge #19627 @ e503344 into train-2026-10-26-85l #19627
main c498219dc0 Merge main @ 8c511bf (train 85j) into train-2026-10-26-85k none
main 0a9108b96e Merge #19399 @ 1ff25fb into train-2026-10-26-85k #19399
main 104afb6f07 Merge remote-tracking branch 'origin/main' into issue-19144-kb-principal none
main 8b7452dce9 Merge remote-tracking branch 'origin/main' into issue-19320-postgres-one-source none
main f5e0464edc Merge remote-tracking branch 'origin/main' into issue-19319-routers-strict none
main 84e1d04069 Merge remote-tracking branch 'origin/main' into issue-19315-env-mode-one-source none
main 988b0e2a1e Merge remote-tracking branch 'origin/main' into issue-19280-rag-leftovers none
main 09bc2d80ae Merge remote-tracking branch 'origin/main' into HEAD none
main 785a832f02 Merge #19509 @ 8cf459a into train-2026-10-26-85j #19509
main 421 more commit(s) not listed
this branch 16c9f10ed0 refactor(rate-limit): fold IPRateLimiter, the four MCP counters and the session limiter into the canonical RateLimiter (#18087, #7271) #18087, #7271

repo_tests/reach_scope_claim_17844_test.py

side commit subject issue refs
main be5b2b0be2 test(guards): one compare-and-delete script, the shape matched with recorded exceptions and a planted-copy control (#19631) #19631
main fe97219e8c Merge origin/main into issue-21078-test-filenames (#21078) #21078
main 5d6c08c7eb refactor: move the reach scope record to its own module and register the test-name guard (#21078) #21078
main eb0ccc38fc Merge main into issue-20761-api-key-compare (auto-sync) [skip ci] none
main 464269b063 fix(train): reach floor follows the merged tree; scope-claim test stays under the 600-line cap (#17844) #17844
main 8019cce84d Merge branch 'main' into train-2026-11-07-t91 none
main 1fd6964fd3 fix(auth): the constant-time compare guard declares its reach floor, scope and roots (#20761) #20761
main 25b8798246 Merge #20969 @ b9c58d0 into the merge train #20969
main c16ff8bae0 Merge #20893 @ 1658109 into the merge train #20893
main 74816fa315 fix(deploy): record the venv-builder guard's declared scope in both reach records (#20932) #20932
main 982e6998ff merge: origin/main into issue-20889-snapshot-cleanup; route #20478 sites through accessors (#20889) #20478, #20889
main a35719e02d Merge main into issue-20046-ssh-password-proposal (auto-sync) [skip ci] none
main c09459f5d8 fix(snapshots): record the inline-lazy_singleton guard's scope and floor (#20889) #20889
main ab55d41295 Merge main into issue-20046-ssh-password-proposal none
main 2b2f7e52f4 Merge main into issue-20512-unconnected-code-gate (auto-sync) [skip ci] none
main 311 more commit(s) not listed
this branch 512093065c fix(integrations): a GitHub rate-limit reset is measured on the wall clock, not the monotonic one (#18087) #18087
this branch 22cf95eca4 refactor(rate-limit): guard that no second rate limiter appears outside the canonical module (#18087) #18087

repo_tests/symbol_fork_baseline.json

side commit subject issue refs
main 8daf59d5bf fix(kb): AddResult and UploadResult are no longer fork clusters -- drop them from the symbol-fork baseline (#19339, #17312) #19339, #17312
main c9bdfd2922 Merge #19223 @ 94d806d into train-2026-10-22-79 #19223
main 94d806da9b refactor(monitoring): #18964 -- query_range has one definition (#18964) #18964
main 5e868a47e9 Merge #19214 @ 7ea419a into train-2026-10-22-78 #19214
main 7ea419ac1c dedup(tooling): the four tracked_python_files scopes get names that say their scope, report_audit tests (#18954) #18954
main 9f38fd4a30 dedup(tooling): one report_audit for the 7 lint --audit hooks, check_paths renamed per scan, symbol-fork baseline 97 to 95 (#18954) #18954
main d99fa16782 dedup(infra): the deployment scripts' registry accessor is get_deployment_registry -- no longer a fork of the backend's get_service_registry (#18964) #18964
main 7bf407cdb9 refactor(discovery): retire the two unwired discovery modules; service_registry and the SSOT get_service_url are the only path (#18639) #18639
main c6a2ba207c Merge remote-tracking branch 'origin/main' into issue-19040-slm-agent-leftovers none
main fceb688de4 refactor(slm-agent): retire the dead agent copies and ship the canonical slm/init.py (#19040) #19040
main dd9bc99e80 refactor(infra): 8 same-name forks in the infrastructure scripts get one home each, 5 more are recorded as homonyms or tracked under #12771 (#18964) #12771, #18964
main 6bc5454fc4 test(train): train-48 tree — 16 de-forked clusters leave the symbol-fork baseline and triage, the Chroma collection double joins the #18883 baseline, 2 reach floors re-pinned (#18954, #18883, #17844) #18883, #18954, #17844
main 8ccafa1462 chore(forks): widen FORK_ROOTS to workers, infrastructure, scripts, tools, pipeline-scripts; refreeze baseline 8 -> 124 (#18559) #18559
main faf2bb1e00 Merge remote-tracking branch 'origin/main' into train-2026-10-19-36 none
main 6231e0cd14 Merge #18868 @ d79195c into train-2026-10-19-36 #18868
main 83 more commit(s) not listed
this branch 16c9f10ed0 refactor(rate-limit): fold IPRateLimiter, the four MCP counters and the session limiter into the canonical RateLimiter (#18087, #7271) #18087, #7271

scripts/python_file_size_known_large.py

side commit subject issue refs
main 46aafb5308 fix(config): rollback locks every config writer and applies a leaf-level delta (#18478) #18478
main 898db989ca fix(chat): keep the grandfathered files at or under their base size with one schema-upgrade entry (#21404) #21404
main 47541213aa fix(secrets): one shared fixed-refusal table for secrets and Company OS; envelope routes echo no ids (#21559) #21559
main 399377ca75 fix(chat): store the declared upload content type as fallback mime_type (#21403) #21403
main 7c88f18ba4 fix(agents): keep agent_config.py under its ratchet by extracting helpers (#21718) #21718
main e6cc56ba0d fix(agents): declare tier in the agent listing schema (#21718) #21718
main 025ef8daa7 fix(agents): product code no longer reads dev agents; real tier-map validation (#21718) #21718
main 3c62e17d7e fix(chat): import and a failed create index the owner or unmark the user; an unreadable file blocks the marker (#21664) #21664
main 533fb4a87b fix(chat): every session list route uses the owner index rebuilt from disk, and a Redis error is a 503 (#21664) #21664
main d62cd31133 fix(chat): the session listing fails closed for a caller with no ownership records or no username (#21664) #21664
main 559573b9ff fix(chat): /chat-init lists only the caller's own sessions (#21653) #21653
main deedeccc58 Merge main into issue-21650-batch-job-ownership (auto-sync) [skip ci] none
main 0d7482c3fc fix(batch): one owner write, tested on the path that runs (#21650) #21650
main e9d230ea23 fix(batch-jobs): scope batch jobs, templates and schedules to their owner (#21650) #21650
main f63c38b32d fix(rag): hash-only gate split, validated margin, conflict-detector option, strict-JSON report (#20949) #20949
main 1267 more commit(s) not listed
this branch 16c9f10ed0 refactor(rate-limit): fold IPRateLimiter, the four MCP counters and the session limiter into the canonical RateLimiter (#18087, #7271) #18087, #7271

@github-actions github-actions Bot added the sync-conflict Set by the branch sync (#19548) label Nov 18, 2026
…dow policy and per-IP fold onto main label-only limiter (#18087)
@mrveiss mrveiss changed the title fix(integrations): a GitHub rate-limit reset is measured on the wall clock, not the monotonic one (#18087) refactor(rate-limit): window failure policy on the canonical limiter; a2a, openai-compat and the integration limiter ride it (#18087) Nov 18, 2026
@mrveiss

mrveiss commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Merged main. The MCP-server and auth limiter work this branch also did already landed on main (label-only logging, whole-token quota key), so main's versions are kept. The rest is reworked on top of main's limiter: window_failure_policy (OPEN/LOCAL/CLOSED) and get_window_usage on RateLimiter alongside main's log_label and fail-open warning, the new window companion module, the a2a and OpenAI-compat limiters, the integration limiter's windows, and the guard (relative floor, parse cache, MCP check now asserts the canonical RateLimiter). The new window warnings name the limiter only, never the key. The one env var moved to its own registry sibling (the backend-services file was at the size ceiling).

Needs a decision (a deletion in this branch): the branch deletes autobot_shared/rate_limit.py (IPRateLimiter) and its test. I kept both: main added a new consumer after this branch was written (api/rum_ingest_bounds.py, plus tests/api/test_rum_access_16375.py), and the guard lists the module as a pending entry.

Options:

  1. Wire in: migrate rum_ingest_bounds and its test to WindowQuota, then delete the module (the guard entry goes with it).
  2. Keep IPRateLimiter as a deliberate second limiter with a stated reason (then it belongs in the guard's distinct-concept list).
  3. Split: land this PR as is, migrate and delete in a follow-up.

Not verified locally (no test runs): the guard's detector against modules added to main since this branch was cut.

@mrveiss mrveiss added the needs-decision Blocked on an owner decision; options and a recommendation are on the issue label Nov 18, 2026
@mrveiss

mrveiss commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Decision (owner, 2026-11-18): migrate the RUM ingest bounds (api/rum_ingest_bounds.py, tests/api/test_rum_access_16375.py) onto the canonical limiter in this PR, then remove autobot_shared/rate_limit.py (IPRateLimiter) once it has no caller — one limiter. Rework follows here.

@mrveiss mrveiss removed the needs-decision Blocked on an owner decision; options and a recommendation are on the issue label Nov 18, 2026
@mrveiss
mrveiss marked this pull request as ready for review November 19, 2026 00:23
@github-actions

Copy link
Copy Markdown
Contributor

Notice: 29 open PRs — past the runaway threshold (25)

This is not a request to defer this PR. There is no cap on open PRs (#19397) -- nothing blocks opening or pushing a PR.

This notice only means the count is high enough to be worth a glance for a runaway — something opening PRs in a loop, or a merge pipeline that has stalled so nothing is draining.

Currently open:

If the queue is draining normally, ignore this. Otherwise:

  1. Check whether CI is dispatching at all — see the ci-dispatch-watchdog status on these PRs
  2. Approved PRs land through the merge train the coordinator sequences (merge commits, never squash) -- check the open chore(merge-train) PR is moving, not each PR on its own
  3. Look for a loop opening near-identical PRs

Warn-only runaway detector — .github/workflows/pr-queue-gate.yml. It never blocks a merge.

@github-actions

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No new hardcoded values of either class — ssot and other both block.

Known backlog in pipeline-scripts/hardcoded_values_baseline.txt is suppressed and tracked in #14371.

@mrveiss mrveiss added the land-next Landing set: CI capacity goes to these PRs first (owner direction 2026-09-18, #15397) label Nov 19, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Minor · Parse HTTP-date Retry-After on the 429 path too. · github_integration.py:356

autobot-backend/integrations/github_integration.py:356
Minor · Stability & Availability · Quick win

Parse HTTP-date Retry-After on the 429 path too.

apply_response_headers now accepts Retry-After as delta-seconds or an HTTP-date. The 429 branch in _retry_delay still calls float() on the raw header. An HTTP-date value raises ValueError here. _request does not catch that exception, so the call raises instead of returning the structured result or waiting and retrying.

Make the 429 wait use the same parsing contract as apply_response_headers. Keep the 120-second cap and the 60-second default used when the header is absent.

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 58e89d8 and 570b1e5.

Files ignored due to path filters: 1

  • .test_durations is excluded by !**/.test_durations*
Files selected for processing: 24

  • autobot-backend/a2a/a2a_security_test.py
  • autobot-backend/api/a2a.py
  • autobot-backend/api/openai_compat.py
  • autobot-backend/api/openai_compat_test.py
  • autobot-backend/api/rum_ingest_bounds.py
  • autobot-backend/integrations/rate_limiter.py
  • autobot-backend/integrations/rate_limiter_test.py
  • autobot-backend/llm_shared/cross_worker_rate_limiter.py
  • autobot-backend/tests/api/test_rum_access_16375.py
  • autobot-backend/tests/test_concurrency_global_locks.py
  • autobot_shared/env_registry.py
  • autobot_shared/env_registry_backend_services.py
  • autobot_shared/env_registry_rate_limit.py
  • autobot_shared/rate_limit.py
  • autobot_shared/rate_limit_test.py
  • autobot_shared/rate_limiter.py
  • autobot_shared/rate_limiter_window.py
  • autobot_shared/rate_limiter_window_18087_test.py
  • docs/developer/ENV_VARS.md
  • repo_tests/_reach_declared_scopes.py
  • repo_tests/_reach_policy_verdicts.py
  • repo_tests/_reach_roots_record.py
  • repo_tests/one_rate_limiter_18087_test.py
  • repo_tests/reach_scope_claim_17844_test.py
Files with no reviewable changes: 2

  • autobot_shared/rate_limit.py
  • autobot_shared/rate_limit_test.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Comment thread autobot_shared/rate_limiter_window.py Resolved
Comment thread autobot_shared/rate_limiter_window.py Resolved
Comment thread autobot_shared/rate_limiter_window.py Resolved
Comment thread autobot_shared/rate_limiter.py Resolved
@mrveiss mrveiss added the land-next Landing set: CI capacity goes to these PRs first (owner direction 2026-09-18, #15397) label Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

phase:M4.9 One definition per concept sync-conflict Set by the branch sync (#19548)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant