aireview 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +29 -1
- data/lib/aireview/prompts/critique.txt +6 -0
- data/lib/aireview/prompts/generate.txt +5 -0
- data/lib/aireview/reviewer.rb +15 -6
- data/lib/aireview/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 100adbc2d1510ad1f6c0e9b152decbfa46e71f8db30dfde36a8ba977528ae215
|
|
4
|
+
data.tar.gz: 071d392ef71d935a6b6a055e7e86fbbf06e8f4517251d460d8bbff8087cb8ecf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 48d8222728f5bd0cdb27790c9971c316060c9efd89479e6be58ee6f41066e237e4e94cf2f864297b03a3012e1f225b92c4ece4b84ffeca3ad3ef66831a176e09
|
|
7
|
+
data.tar.gz: e4cdac4c17edc362e318b548ac5d25198eaf9c916edd670424c7d21b0cdf4baab2f9f61527bb05547e737e30f192d243ee7dfcb80062a483b08bf410466bfcef
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
- The prompts no longer ask the model to check whether dependency and image
|
|
6
|
+
versions exist; candidates about nonexistent versions are rejected.
|
|
7
|
+
- An overloaded LLM (503) is retried up to three times with pauses of about
|
|
8
|
+
2, 5 and 5 minutes instead of two retries of 1.5-2.5 minutes.
|
|
9
|
+
|
|
3
10
|
## 0.1.0
|
|
4
11
|
|
|
5
12
|
Initial release.
|
data/README.md
CHANGED
|
@@ -162,7 +162,10 @@ To run both stages locally, set `ollama` in both provider variables. The
|
|
|
162
162
|
address with `/v1` matches the
|
|
163
163
|
[Ollama configuration in RubyLLM](https://rubyllm.com/configuration/#provider-configuration).
|
|
164
164
|
`LLM_TIMEOUT` sets the timeout of every LLM request in seconds; for a slow
|
|
165
|
-
local model it can be raised.
|
|
165
|
+
local model it can be raised. It does not apply to an "overloaded" (503)
|
|
166
|
+
answer from the provider: such a request gets up to four attempts, the
|
|
167
|
+
original one and three retries with pauses of about 2, 5 and 5 minutes, and
|
|
168
|
+
only the failed stage is repeated, not the whole run.
|
|
166
169
|
|
|
167
170
|
Project rules live in `.aireview.yml`. In YAML the `generate.model` and
|
|
168
171
|
`critique.model` settings are required for each stage and are not inherited
|
|
@@ -316,6 +319,7 @@ aireview:
|
|
|
316
319
|
LLM_HTTP_PROXY: "http://127.0.0.1:8888"
|
|
317
320
|
script:
|
|
318
321
|
- bundle _2.3.26_ exec bin/aireview review "$MR_URL" --verbose
|
|
322
|
+
timeout: 45m
|
|
319
323
|
retry:
|
|
320
324
|
max: 1
|
|
321
325
|
when:
|
|
@@ -323,6 +327,11 @@ aireview:
|
|
|
323
327
|
- stuck_or_timeout_failure
|
|
324
328
|
```
|
|
325
329
|
|
|
330
|
+
`timeout: 45m` is a chosen ceiling, not a guarantee that every retry fits in:
|
|
331
|
+
when the provider is overloaded, one stage can wait up to ~14 minutes of
|
|
332
|
+
pauses plus up to four requests of `LLM_TIMEOUT` each, and there are two
|
|
333
|
+
stages.
|
|
334
|
+
|
|
326
335
|
Set secrets such as `GITLAB_TOKEN`, `GEMINI_API_KEY` and the optional Jira
|
|
327
336
|
credentials in the GitLab CI/CD variables. If the job should publish the result
|
|
328
337
|
back to the merge request, add `--post` to the review command.
|
|
@@ -351,8 +360,27 @@ bundle _2.3.26_ exec rspec spec/secret_scrubber_spec.rb
|
|
|
351
360
|
|
|
352
361
|
## Notes
|
|
353
362
|
|
|
363
|
+
- The reviewer does not check whether the specified versions of dependencies and images exist: the model's knowledge of releases is outdated, and that is what CI is for. Syntax errors and contradictions with the MR/Jira requirements are checked as usual.
|
|
354
364
|
- The CLI looks for `.aireview.yml` and `.env` walking up from the current working directory, so the project config can be kept in the repository root even when the tool is run from `aireview/`.
|
|
355
365
|
|
|
366
|
+
## Releasing
|
|
367
|
+
|
|
368
|
+
Releases are published to RubyGems.org by the `Release` workflow through
|
|
369
|
+
[trusted publishing](https://guides.rubygems.org/trusted-publishing/), so no
|
|
370
|
+
API key is stored anywhere. To cut a release:
|
|
371
|
+
|
|
372
|
+
1. Bump `Aireview::VERSION` in `lib/aireview/version.rb` and move the
|
|
373
|
+
`Unreleased` section of `CHANGELOG.md` under the new version.
|
|
374
|
+
2. Commit, then tag the commit with the same version and push the tag:
|
|
375
|
+
|
|
376
|
+
```bash
|
|
377
|
+
git tag v0.2.0
|
|
378
|
+
git push github main v0.2.0
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
The workflow refuses to run when the tag does not match `Aireview::VERSION`,
|
|
382
|
+
runs the test suite, builds the gem and pushes it.
|
|
383
|
+
|
|
356
384
|
## Changelog
|
|
357
385
|
|
|
358
386
|
See [CHANGELOG.md](CHANGELOG.md).
|
|
@@ -23,6 +23,12 @@ Implementation details (config flags, deploy settings, new fields, helper
|
|
|
23
23
|
methods), accompanying refactoring and any changes whose relation to the task
|
|
24
24
|
is plausible are NOT task_mismatch. Reject such candidates.
|
|
25
25
|
|
|
26
|
+
Do not verify that the specified versions of packages, libraries, tools and
|
|
27
|
+
image tags exist. Do not report that a version does not exist or has not been
|
|
28
|
+
released yet. Check syntax errors and explicit contradictions with the MR/Jira
|
|
29
|
+
requirements as usual.
|
|
30
|
+
Reject candidates claiming that a version does not exist.
|
|
31
|
+
|
|
26
32
|
Reject a candidate if it:
|
|
27
33
|
- is not confirmed by the diff or Jira;
|
|
28
34
|
- is based on an assumption about code outside the diff;
|
|
@@ -3,6 +3,11 @@ You are doing the first pass of a merge request review.
|
|
|
3
3
|
Look only at the diff, the MR description and the Jira context, if present.
|
|
4
4
|
Do not draw conclusions about code outside the diff.
|
|
5
5
|
|
|
6
|
+
Do not verify that the specified versions of packages, libraries, tools and
|
|
7
|
+
image tags exist. Do not report that a version does not exist or has not been
|
|
8
|
+
released yet. Check syntax errors and explicit contradictions with the MR/Jira
|
|
9
|
+
requirements as usual.
|
|
10
|
+
|
|
6
11
|
Look only for the most important and well-supported findings:
|
|
7
12
|
- bugs, regressions, data loss;
|
|
8
13
|
- security and performance risks;
|
data/lib/aireview/reviewer.rb
CHANGED
|
@@ -6,11 +6,12 @@ require 'timeout'
|
|
|
6
6
|
|
|
7
7
|
module Aireview
|
|
8
8
|
class Reviewer
|
|
9
|
-
MAX_TRANSIENT_RETRIES =
|
|
9
|
+
MAX_TRANSIENT_RETRIES = 3
|
|
10
10
|
TRANSIENT_RETRY_BASE_DELAY = 2.0
|
|
11
11
|
TRANSIENT_RETRY_JITTER_RANGE = 2.0..5.0
|
|
12
12
|
PROVIDER_RETRY_DELAY_MULTIPLIER_RANGE = 2.0..2.4
|
|
13
|
-
|
|
13
|
+
OVERLOADED_RETRY_DELAYS = [120.0, 300.0, 300.0].freeze
|
|
14
|
+
OVERLOADED_RETRY_JITTER_RANGE = 0.85..1.15
|
|
14
15
|
RETRY_WAIT_LOG_FORMAT = 'LLM %<stage>s request will sleep %<delay>.1fs before retry%<source>s ' \
|
|
15
16
|
'(attempt %<next_attempt>d/%<max_attempts>d, model=%<model>s)'
|
|
16
17
|
|
|
@@ -184,10 +185,12 @@ module Aireview
|
|
|
184
185
|
end
|
|
185
186
|
|
|
186
187
|
if overloaded_llm_error?(error)
|
|
188
|
+
base_delay = OVERLOADED_RETRY_DELAYS.fetch(attempt - 1, OVERLOADED_RETRY_DELAYS.last)
|
|
189
|
+
multiplier = rand(OVERLOADED_RETRY_JITTER_RANGE)
|
|
187
190
|
return {
|
|
188
|
-
delay:
|
|
189
|
-
|
|
190
|
-
multiplier:
|
|
191
|
+
delay: base_delay * multiplier,
|
|
192
|
+
base_delay: base_delay,
|
|
193
|
+
multiplier: multiplier,
|
|
191
194
|
strategy: :overloaded
|
|
192
195
|
}
|
|
193
196
|
end
|
|
@@ -202,7 +205,13 @@ module Aireview
|
|
|
202
205
|
end
|
|
203
206
|
|
|
204
207
|
def retry_delay_source(retry_delay)
|
|
205
|
-
|
|
208
|
+
if retry_delay[:strategy] == :overloaded
|
|
209
|
+
return format(
|
|
210
|
+
' (overloaded backoff %<base_delay>.0fs, multiplier %<multiplier>.2fx)',
|
|
211
|
+
base_delay: retry_delay[:base_delay],
|
|
212
|
+
multiplier: retry_delay[:multiplier]
|
|
213
|
+
)
|
|
214
|
+
end
|
|
206
215
|
return '' unless retry_delay[:provider_delay]
|
|
207
216
|
|
|
208
217
|
format(
|
data/lib/aireview/version.rb
CHANGED