summaryrefslogtreecommitdiffhomepage
path: root/.rules/changelog/2026-04/01/01.md
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-04-01 13:29:15 +0900
committerAdam Malczewski <[email protected]>2026-04-01 13:29:15 +0900
commit9aacecab709bd7315a97675750e1874d858bdeef (patch)
treeee3fd7fe236b5d1a99791f6c4d4f22b7baa12f1e /.rules/changelog/2026-04/01/01.md
parent3e32dec579fbdedec8c7ddb881207b25bb342e60 (diff)
downloaddispatch-adapter-copilot-9aacecab709bd7315a97675750e1874d858bdeef.tar.gz
dispatch-adapter-copilot-9aacecab709bd7315a97675750e1874d858bdeef.zip
add rate limiting
Diffstat (limited to '.rules/changelog/2026-04/01/01.md')
-rw-r--r--.rules/changelog/2026-04/01/01.md26
1 files changed, 26 insertions, 0 deletions
diff --git a/.rules/changelog/2026-04/01/01.md b/.rules/changelog/2026-04/01/01.md
new file mode 100644
index 0000000..5134518
--- /dev/null
+++ b/.rules/changelog/2026-04/01/01.md
@@ -0,0 +1,26 @@
+# Changelog — 2026-04-01 #01
+
+## Changes
+
+### New: Rate Limiter (`lib/dispatch/adapter/rate_limiter.rb`)
+- Implemented `Dispatch::Adapter::RateLimiter` class with cross-process rate limiting via filesystem locks (`flock`).
+- Supports per-request cooldown (`min_request_interval`) and sliding window limiting (`rate_limit`).
+- State stored as JSON in `{token_path_dir}/copilot_rate_limit` with `0600` permissions.
+- Handles missing, empty, or corrupt state files gracefully.
+- Validates constructor arguments with descriptive `ArgumentError` messages.
+
+### Modified: Copilot Adapter (`lib/dispatch/adapter/copilot.rb`)
+- Added `min_request_interval:` (default `3.0`) and `rate_limit:` (default `nil`) constructor parameters.
+- Instantiates a `RateLimiter` in `initialize`.
+- Calls `@rate_limiter.wait!` before HTTP requests in `chat_non_streaming`, `chat_streaming`, and `list_models`.
+- Added `require_relative "rate_limiter"`.
+
+### Version Bump (`lib/dispatch/adapter/version.rb`)
+- Bumped `VERSION` from `"0.1.0"` to `"0.2.0"`.
+
+### Updated Test (`spec/dispatch/adapter/copilot_spec.rb`)
+- Updated VERSION expectation from `"0.1.0"` to `"0.2.0"`.
+
+### RuboCop Config (`.rubocop.yml`)
+- Disabled `Layout/LineLength` cop.
+- Disabled `Style/Documentation` cop.