aireview 2.2.0 → 2.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c37a072f5cb03c8a4e95944a3c6fc5386d1abe6c340c63ebee9715db5d44ec6a
4
- data.tar.gz: b2e2ef104f8e4310dafc0dd5041a899c7ff06af5d2098cff25e0e38f010f9847
3
+ metadata.gz: 683eb62411053c4b3191312e3dd4c0eefc0d365f04e3f50bba6af101d9d424e8
4
+ data.tar.gz: 9c252acb6c8e94bdca1cc1d151e14628052c233d79866777b2a21c1f9d5751a6
5
5
  SHA512:
6
- metadata.gz: '09524e49ed6896e32e6e73d3fcc5f5e27d19eaa255273017acf699e8e6992f44a8a950e34d96f446066e58b31a6ee625188891e913ac3a4c0db27ac2b39e95a8'
7
- data.tar.gz: 4a193a705c06609c07ceb2833211d51d124e1299378368feb50fc08e0fac48a6ff09f553b47406b0bd367e83ebfe7b55fd66d018f4781551725aa27234e95113
6
+ metadata.gz: 9b3cd5ca1d824688bb9063bb3b9c1688ac04b960f182a1fd995f574dfa19354c550d4b006a2332a4906e7fe67f6957a9845fe820ee74d66b066a4abc1f28af1f
7
+ data.tar.gz: 4654c1269c4b302cd1e5f6797097231821ee8318cde27b5d6da52cc29b01121db13373697311997b4b20f08288bedf3c765c982f8d7ad59eea412304640120b2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,51 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.3.0
4
+
5
+ - The report always shows a `Models: generate — …, critique — …` line with the
6
+ models that answered each stage (without `api_base`, and with `skipped (no
7
+ candidates)` or `disabled` when Critique did not run), replacing the separate
8
+ `Fallback model used:` line.
9
+ - Removed multi-key environment variables (`GEMINI_API_KEYS`,
10
+ `OPENAI_API_KEYS`, `ANTHROPIC_API_KEYS`, `OPENROUTER_API_KEYS`): each
11
+ provider takes a single `*_API_KEY`. On daily quota exhaustion or a rate
12
+ limit after one retry, the router moves to the next model in the chain.
13
+ - GitHub pull requests: `aireview review https://github.com/owner/repo/pull/42`
14
+ reviews a pull request on github.com or GitHub Enterprise Server, and
15
+ `--post` keeps one updatable conversation comment, as on GitLab. The token
16
+ is `GITHUB_TOKEN`; `GITHUB_API_URL` overrides the API address,
17
+ `GITHUB_REVIEW_AUTHOR` names the comment author for tokens that cannot
18
+ read `/user` (the Actions `GITHUB_TOKEN`: `github-actions[bot]`). A
19
+ **Re-run** counts as a retry in `review_mode: once`; the "moved while
20
+ reviewing" check compares the merge base, so a push to the base branch
21
+ alone does not stop publishing. Files GitHub did not return (it lists at
22
+ most 3000) are counted under "Not reviewed". The README has a GitHub
23
+ Actions workflow. GitLab behaviour and review keys are unchanged.
24
+ - In a ranked pool (`rank: not_below_generate`) Critique no longer falls
25
+ back to the model that answered in Generate while a model its chain
26
+ prefers is only quarantined: it waits for that model when the wait plus a
27
+ full request (`llm.timeout`) fits into the time budget, and logs
28
+ `waiting … instead of critiquing with …`. Before, an overload during
29
+ Generate could turn the critique into a self-check by the same model. A
30
+ self-check remains when Generate answered with the strongest model, the
31
+ stronger ones are out until the end of the run, or `critique.start` names
32
+ that model; own chains and `rank: any` keep their order.
33
+ - `gem install aireview` works without configuring models: when
34
+ `AIREVIEW_DEFAULTS` is unset and neither `.aireview.yml`, the environment
35
+ nor `--generate-model`/`--critique-model` names a model, the gem's own `config/defaults.yml` is loaded
36
+ as the `bundled defaults` layer (the image defaults: the Gemini pool,
37
+ timeouts, language). Setups with models of their own are unchanged.
38
+
39
+ ## 2.2.1
40
+
41
+ - OpenAI reasoning models (`o1`, `o3`, `gpt-5`…) and search models
42
+ (`gpt-4o-search-preview`…) get no temperature: RubyLLM 2 sends it as given
43
+ (1.x replaced it with 1.0 or dropped it), and these models reject any
44
+ other value with a bad request, which failed the run without trying a
45
+ fallback model. The RubyLLM registry says which models take a
46
+ temperature; a model it does not know is judged by its name, as 1.x did.
47
+ `models check` is fixed the same way.
48
+
3
49
  ## 2.2.0
4
50
 
5
51
  - Jev shadow mode (`llm.jev.shadow`, `LLM_JEV_SHADOW`, key `JEV_API_KEY`):
data/README.md CHANGED
@@ -1,16 +1,17 @@
1
1
  # aireview
2
2
 
3
- `aireview` is a local CLI tool that reviews GitLab merge requests with the help
4
- of LLMs. It uses a two-pass review pipeline: the first pass finds candidate
3
+ `aireview` is a local CLI tool that reviews GitLab merge requests and GitHub
4
+ pull requests with the help of LLMs. It uses a two-pass review pipeline: the first pass finds candidate
5
5
  findings, the second one critiques them and drops the weak or invalid ones.
6
6
 
7
7
  The tool supports self-hosted GitLab and self-hosted Jira only. GitLab.com and
8
- Jira Cloud are not supported.
8
+ Jira Cloud are not supported. Pull requests work on github.com and GitHub
9
+ Enterprise Server.
9
10
 
10
11
  MVP flow:
11
12
 
12
- 1. Takes a GitLab merge request URL.
13
- 2. Fetches the MR metadata and changes from GitLab.
13
+ 1. Takes a GitLab merge request URL or a GitHub pull request URL.
14
+ 2. Fetches the MR metadata and changes from GitLab or GitHub.
14
15
  3. Filters out ignored paths and scrubs secrets from the diffs.
15
16
  4. Optionally enriches the prompt with context from a Jira issue.
16
17
  5. Runs the Generate pass through RubyLLM to get an MR summary and candidate
@@ -22,9 +23,9 @@ MVP flow:
22
23
 
23
24
  ## Requirements
24
25
 
25
- - Ruby 3.1.3 or newer (CI runs the tests on 3.1, 3.3, 3.4 and 4.0)
26
- - Bundler 2.3.26 for the repository checkout; `gem install` needs no specific Bundler
27
- - A GitLab personal access token
26
+ - Ruby 4.0.10 or newer
27
+ - Bundler 4.0+ for the repository checkout; `gem install` needs no specific Bundler
28
+ - A GitLab personal access token, or a GitHub token for pull requests
28
29
  - An API key for a remote LLM provider; a local Ollama needs no key
29
30
  - Optionally, a Jira login and password
30
31
 
@@ -40,19 +41,19 @@ aireview --help
40
41
  From a checkout of the repository:
41
42
 
42
43
  ```bash
43
- bundle _2.3.26_ install
44
- bundle _2.3.26_ exec bin/aireview --help
44
+ bundle install
45
+ bundle exec bin/aireview --help
45
46
  ```
46
47
 
47
- The examples below use `bundle _2.3.26_ exec bin/aireview`; with the gem
48
+ The examples below use `bundle exec bin/aireview`; with the gem
48
49
  installed, replace it with plain `aireview`.
49
50
 
50
51
  ## Configuration
51
52
 
52
53
  Secrets live in environment variables or in a local `.env` file. The models of
53
54
  both stages come from the defaults shipped in the Docker image (see "Defaults
54
- shipped in the image"); outside the image they are set in `.env` or
55
- `.aireview.yml`:
55
+ shipped in the image"); a gem or a checkout falls back to the same file
56
+ until you set models of your own in `.env` or `.aireview.yml`:
56
57
 
57
58
  ```bash
58
59
  GITLAB_URL=https://gitlab.company.com
@@ -61,24 +62,31 @@ JIRA_URL=https://jira.company.com
61
62
  JIRA_LOGIN=user
62
63
  JIRA_PASSWORD=xxx
63
64
  GEMINI_API_KEY=xxx
64
- GEMINI_API_KEYS=xxx,yyy
65
65
  LLM_PROVIDER=gemini
66
66
  LLM_TEMPERATURE=0
67
67
  LLM_TIMEOUT=120
68
68
  LLM_TIME_BUDGET=1800
69
69
  LLM_HTTP_PROXY=http://127.0.0.1:8888
70
70
  LLM_GENERATE_PROVIDER=gemini
71
- LLM_GENERATE_MODEL=gemini-3.7-flash
71
+ LLM_GENERATE_MODEL=gemini-3.6-flash
72
72
  LLM_GENERATE_FALLBACK_MODEL=gemini-3.8-flash
73
73
  LLM_GENERATE_TEMPERATURE=0.3
74
74
  LLM_CRITIQUE_PROVIDER=gemini
75
75
  LLM_CRITIQUE_MODEL=gemini-3.8-flash
76
- LLM_CRITIQUE_FALLBACK_MODEL=gemini-3.7-flash
76
+ LLM_CRITIQUE_FALLBACK_MODEL=gemini-3.6-flash
77
77
  LLM_CRITIQUE_TEMPERATURE=0
78
78
  REVIEW_LANGUAGE=ru
79
79
  REVIEW_MODE=update
80
80
  ```
81
81
 
82
+ For GitHub pull requests the GitLab variables are not needed; the token is
83
+ `GITHUB_TOKEN` (a personal or fine-grained token with read access to the
84
+ code and pull requests, plus write access to pull requests for `--post`).
85
+ The API address comes from the pull request URL — `api.github.com` for
86
+ github.com, `https://<host>/api/v3` for GitHub Enterprise — unless
87
+ `GITHUB_API_URL` says otherwise. `GITHUB_REVIEW_AUTHOR` is needed for tokens
88
+ that cannot read their own user, see "A single comment per merge request".
89
+
82
90
  The providers are `gemini`, `ollama`, `openai`, `anthropic` and
83
91
  `openrouter`, and any OpenAI-compatible server of your own (vLLM, llama.cpp,
84
92
  LM Studio) as `openai` with an `api_base`. The provider and the model of each
@@ -88,9 +96,9 @@ shared default when a stage has no provider of its own. Gemini and Ollama
88
96
  are the ones the image defaults and the verified models are about; for the
89
97
  others run `aireview models check` before relying on a model.
90
98
 
91
- Each provider takes its keys from its own variables:
92
- `GEMINI_API_KEY(S)`, `OPENAI_API_KEY(S)`, `ANTHROPIC_API_KEY(S)`,
93
- `OPENROUTER_API_KEY(S)`; `LLM_API_KEY` is the shared fallback.
99
+ Each provider takes its key from its own variable:
100
+ `GEMINI_API_KEY`, `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`,
101
+ `OPENROUTER_API_KEY`; `LLM_API_KEY` is the shared fallback.
94
102
 
95
103
  `REVIEW_LANGUAGE` (or `review_language` in `.aireview.yml`) sets the language
96
104
  of the review: both the LLM answers and the headings of the rendered report.
@@ -107,18 +115,40 @@ Models, timeouts and the report language are baked into the image as
107
115
  project in an organization has nothing to configure: no `.aireview.yml`, no
108
116
  variables with model names. Changing the model for every project is one
109
117
  edit of that file and a new image release. Outside the image the variable is
110
- unset and the layer does not exist, so local runs are unaffected; point
111
- `AIREVIEW_DEFAULTS` at any file to get the same layer elsewhere. The
112
- defaults define a shared pool of five Gemini models (see "Shared model
113
- pool"): Generate starts from a mid-range model and goes round the pool,
118
+ unset; then the gem (or the checkout) uses its own `config/defaults.yml` as
119
+ the `bundled defaults` layer, but only while neither `.aireview.yml`, the
120
+ environment nor a CLI flag (`--generate-model`, `--critique-model`) names a
121
+ model (`llm.models` or a stage `model`). So
122
+ `gem install aireview` plus an API key is enough to run a review, and a
123
+ local setup with models of its own is not affected. Point
124
+ `AIREVIEW_DEFAULTS` at any file to get the image layer elsewhere. The
125
+ defaults define a shared pool of four Gemini models (see "Shared model
126
+ pool"): Generate starts from the second model (`gemini-3.8-flash`) and goes round the pool,
114
127
  Critique takes the strongest live model not below the one Generate answered
115
128
  with; every model of the pool is confirmed by `aireview models check` on
116
129
  release.
117
130
 
131
+ What `config/defaults.yml` sets today (the file is the source of truth):
132
+
133
+ | Setting | Default |
134
+ |---|---|
135
+ | Model pool, strongest first | `gemini-4-hydrogen`, `gemini-3.8-flash`, `gemini-3.6-flash`, `gemini-3.5-flash-lite` (all `gemini`) |
136
+ | Generate | starts at `gemini-3.8-flash`, temperature 0.1 |
137
+ | Critique | first live model not below the one Generate answered with (`rank: not_below_generate`, `allow_weaker: false`), temperature 0 |
138
+ | Request timeout | 180 s per request, up to three attempts per model per stage |
139
+ | Time budget | 1800 s shared across the LLM stages, including retry waits |
140
+ | Overload quarantine | 120 s |
141
+ | Report language | `en` |
142
+
143
+ The default model pool only needs `GEMINI_API_KEY`;
144
+ GitLab access still requires `GITLAB_TOKEN`.
145
+
118
146
  The configuration layers, weakest first:
119
147
 
120
148
  1. built-in values (`Config::DEFAULTS`);
121
- 2. image defaults — the file from `AIREVIEW_DEFAULTS`; no variable, no layer;
149
+ 2. image defaults — the file from `AIREVIEW_DEFAULTS`; without the variable,
150
+ the bundled `config/defaults.yml` when no upper layer (CLI included) names
151
+ a model;
122
152
  3. the project's `.aireview.yml`;
123
153
  4. environment variables (`LLM_GENERATE_MODEL` and the rest);
124
154
  5. CLI flags (`--generate-model`, `--critique-model`, the temperatures).
@@ -154,7 +184,7 @@ every model, the layer it came from:
154
184
  ```
155
185
  === LLM SETTINGS ===
156
186
  Config: image defaults /app/config/defaults.yml, .aireview.yml /app/.aireview.yml
157
- Generate: gemini-3.7-flash temperature=0.1 (model from image defaults, provider from image defaults)
187
+ Generate: gemini-3.8-flash temperature=0.1 (model from image defaults, provider from image defaults)
158
188
  fallbacks: gemini/gemini-3.6-flash -> ... (fallbacks from image defaults)
159
189
  Critique: qwen2.5-coder:7b temperature=0 (model from .aireview.yml, provider from .aireview.yml)
160
190
  Time budget: 1800s, overloaded quarantine: 120s
@@ -178,7 +208,7 @@ release at peak hours.
178
208
  No model is probed before a review: there are no test requests to five
179
209
  models per MR, availability is learned from the working requests — the first
180
210
  Generate request is the probe, and what the router learns it remembers until
181
- the end of the run (see "Fallback models and keys"). The separate smoke test
211
+ the end of the run (see "Fallback models"). The separate smoke test
182
212
  of every model with both schemas (`aireview models check`) runs on an image
183
213
  release and on a schedule, not on MRs.
184
214
 
@@ -226,6 +256,12 @@ or without auth when that is not set, and needs no key to start. Without an
226
256
  `api_base` a model goes to its provider's API, or to `LLM_API_BASE` for
227
257
  Gemini, OpenAI and OpenRouter as before.
228
258
 
259
+ A stage's temperature goes only to the models that take one: OpenAI
260
+ reasoning models (`o1`, `o3`, `gpt-5`…) and search models
261
+ (`gpt-4o-search-preview`…) accept no other, so they get none and run with
262
+ their own default. The RubyLLM registry decides, and the name
263
+ for a model it does not know.
264
+
229
265
  Instead of an LLM the critic can be Jev (see "Critique engine").
230
266
 
231
267
  ### Local Ollama
@@ -310,7 +346,7 @@ run right away: the model gets one short retry (~30 s), then goes into
310
346
  quarantine for two minutes while the request goes to the next model;
311
347
  without a fallback model the router waits for the quarantine to end and
312
348
  tries once more. Three requests per model per stage in total (see "Fallback
313
- models and keys"). Only the failed stage is repeated, not the whole run.
349
+ models"). Only the failed stage is repeated, not the whole run.
314
350
 
315
351
  Project rules live in `.aireview.yml`. The `generate.model` and
316
352
  `critique.model` settings are not inherited from the base `llm` settings: a
@@ -365,7 +401,7 @@ llm:
365
401
  max_prompt_chars: 400000
366
402
  generate:
367
403
  provider: gemini
368
- model: gemini-3.7-flash
404
+ model: gemini-3.6-flash
369
405
  temperature: 0.3
370
406
  fallbacks:
371
407
  - gemini-3.8-flash
@@ -416,11 +452,10 @@ with an error instead of silently reviewing less. Raise the limits or extend
416
452
  `ignore_paths`. `--dry-run` prints the sizes of every part and the coverage;
417
453
  `--verbose` logs them during a real run.
418
454
 
419
- ### Fallback models and keys
455
+ ### Fallback models
420
456
 
421
- The primary model can sit under load (503) for half a day, and a key can run
422
- out of its daily quota. Neither is cured by waiting, so a stage can have a
423
- fallback model and a provider can have a fallback key:
457
+ The primary model can sit under load (503) for half a day or run out of its
458
+ daily quota. Neither is cured by waiting, so a stage can have fallback models:
424
459
 
425
460
  - `llm.generate.fallbacks` / `llm.critique.fallbacks` in YAML or
426
461
  `LLM_GENERATE_FALLBACK_MODEL` / `LLM_CRITIQUE_FALLBACK_MODEL` in the
@@ -429,14 +464,6 @@ fallback model and a provider can have a fallback key:
429
464
  without it the stage provider is used. A fallback model can have its own
430
465
  `max_prompt_chars`: when the assembled request does not fit, that model is
431
466
  skipped, the context is not cut for it.
432
- - `GEMINI_API_KEYS=key1,key2`: keys in order of preference; `GEMINI_API_KEY`
433
- still works and means a single key. Google counts quotas per Google Cloud
434
- project and per model, so a reserve key only makes sense from another
435
- project. Use fallback credentials in compliance with the provider's quota
436
- and billing terms: Google's
437
- [API limitations](https://developers.google.com/terms#api_limitations)
438
- forbid circumventing its limits regardless of the project's billing. Keys
439
- live only in the environment, never in `.aireview.yml`.
440
467
 
441
468
  #### Shared model pool
442
469
 
@@ -453,23 +480,32 @@ from model names:
453
480
  llm:
454
481
  provider: gemini
455
482
  models: # order = priority for Critique
483
+ - gemini-4-hydrogen
456
484
  - gemini-3.8-flash
457
- - gemini-3.7-flash
458
485
  - gemini-3.6-flash
459
486
  - provider: ollama
460
487
  model: qwen2.5-coder:7b
461
488
  max_prompt_chars: 20000
462
489
  generate:
463
- start: gemini-3.7-flash # Generate starts here, then downwards and round
490
+ start: gemini-3.8-flash # Generate starts here, then downwards and round
464
491
  critique:
465
492
  rank: not_below_generate # or any — the chains are independent
466
493
  allow_weaker: false # true — go below when nothing above is alive
467
494
  ```
468
495
 
469
- Environment equivalents: `LLM_MODELS=gemini/gemini-3.8-flash,gemini/gemini-3.7-flash,…`,
496
+ Environment equivalents: `LLM_MODELS=gemini/gemini-4-hydrogen,gemini/gemini-3.8-flash,…`,
470
497
  `LLM_GENERATE_START`, `LLM_CRITIQUE_START`, `LLM_CRITIQUE_RANK`,
471
498
  `LLM_CRITIQUE_ALLOW_WEAKER`. The rules:
472
499
 
500
+ - with the rank applied (`rank: not_below_generate`, both stages in the
501
+ pool), a critique by the same model that answered in Generate is the last
502
+ resort: when a model the critique chain puts before it is only
503
+ quarantined and a full request (`llm.timeout`) still fits into the time
504
+ budget after its release, Critique waits for it (the log says `waiting …
505
+ instead of critiquing with …`). A self-check remains when Generate
506
+ answered with the strongest model of the pool, the stronger ones are out
507
+ until the end of the run, or `critique.start` names that model itself;
508
+ stages with chains of their own and `rank: any` keep their order;
473
509
  - no permitted live model for Critique and `allow_weaker: false` — the run
474
510
  fails, candidates are not published without a critique; with
475
511
  `allow_weaker: true` Critique goes below Generate and the report gets a
@@ -502,9 +538,9 @@ What happens on which error:
502
538
 
503
539
  | Error | Reaction |
504
540
  |---|---|
505
- | Daily quota (`quotaId` like `…PerDay…` in Google's answer) | No retries: the next key on the same model. The "key + model" pair is remembered until the end of the run so that Critique and the JSON repair do not hit it again. Out of keys: the model is excluded until the end of the run, the request goes to the next one. |
506
- | Per-minute limit (429 with a "retry in N s" hint) | One retry after the hinted delay, then the next key. Out of keys: the model is quarantined for the hinted time, the request goes to the next one. |
507
- | Overloaded (503) or timeout | One short retry (~30 s), then a quarantine of `llm.overloaded_quarantine` / `LLM_OVERLOADED_QUARANTINE` (120 s by default) and the next model with the same key. |
541
+ | Daily quota (`quotaId` like `…PerDay…` in Google's answer) | No retries: the model is excluded until the end of the run so that Critique and the JSON repair do not hit it again, and the request goes to the next one. |
542
+ | Per-minute limit (429 with a "retry in N s" hint) | One retry after the hinted delay, then the model is quarantined for the hinted time and the request goes to the next one. |
543
+ | Overloaded (503) or timeout | One short retry (~30 s), then a quarantine of `llm.overloaded_quarantine` / `LLM_OVERLOADED_QUARANTINE` (120 s by default) and the next model. |
508
544
  | The provider has no such model (the answer text names the model: retired, a typo, not pulled into Ollama) | No retries: the model is excluded until the end of the run, the request goes to the next one. A bare 404 without such text is fatal: a wrong `LLM_API_BASE` answers the same, and the next model will not help. |
509
545
  | An invalid result (not JSON, not the schema, foreign ids in the verdicts) — and still invalid after one repair by the same model | The model is excluded for this stage, the stage starts over on the next model with the original request. For Critique the candidates already obtained are kept, Generate is not repeated. |
510
546
  | Other API errors (context length, auth) | The run fails right away: a fallback model would answer the same. |
@@ -517,11 +553,11 @@ finite:
517
553
 
518
554
  - **three requests per model per stage** (`MAX_ATTEMPTS_PER_MODEL`). Every
519
555
  request sent counts regardless of its outcome, including the short retry
520
- and the JSON repair; the keys of one model share one counter, a quarantine
521
- does not reset it. Out of requests — the model leaves the stage; a JSON
522
- repair without requests left is not sent, and the result counts as invalid
523
- (see the table). When every model of the stage is out or excluded, the
524
- stage ends at once, quarantines are not waited for;
556
+ and the JSON repair; a quarantine does not reset it. Out of requests —
557
+ the model leaves the stage; a JSON repair without requests left is not
558
+ sent, and the result counts as invalid (see the table). When every model
559
+ of the stage is out or excluded, the stage ends at once, quarantines are
560
+ not waited for;
525
561
  - **the time budget** of the LLM part of the run: `llm.time_budget` /
526
562
  `LLM_TIME_BUDGET`, 1800 seconds by default. A pause or a quarantine wait
527
563
  that does not fit into the remainder is skipped, the request timeout is
@@ -544,13 +580,12 @@ The review key (see "A single comment per merge request") is computed from
544
580
  the configured primary model, not from the one that answered: a review made
545
581
  by a fallback model is not rewritten on the next push without changes in the
546
582
  MR, and adding a fallback model to a per-stage chain does not re-run the
547
- review on every open MR. When a stage went to a fallback model, the report
548
- ends with a `Fallback model used: critique — …` line; the log names, for
549
- every stage, the model that answered and its place in the chain
550
- (`model=gemini/gemini-3.6-flash (2/5)`). A key switch stays in the log only,
551
- and key values never reach the log. `--dry-run` prints the model chains, the
552
- number of keys per provider, the time budget and the quarantine length;
553
- `--no-fallbacks` leaves one model and one key per stage.
583
+ review on every open MR. The report ends with a `Models: generate — …,
584
+ critique — …` line naming the models that answered; the log names, for every
585
+ stage, the model that answered and its place in the chain
586
+ (`model=gemini/gemini-3.6-flash (2/5)`). Key values never reach the log.
587
+ `--dry-run` prints the model chains, the time budget and the quarantine
588
+ length; `--no-fallbacks` leaves only the primary model per stage.
554
589
 
555
590
  ### Checking that findings point at the diff
556
591
 
@@ -696,13 +731,14 @@ unverifiable. Any other 422 is not retried.
696
731
  ## Usage
697
732
 
698
733
  ```bash
699
- bundle _2.3.26_ exec bin/aireview review https://gitlab.company.com/team/project/-/merge_requests/123
700
- bundle _2.3.26_ exec bin/aireview review https://gitlab.company.com/team/project/-/merge_requests/123 --post
701
- bundle _2.3.26_ exec bin/aireview review https://gitlab.company.com/team/project/-/merge_requests/123 --no-jira
702
- bundle _2.3.26_ exec bin/aireview review https://gitlab.company.com/team/project/-/merge_requests/123 --dry-run --verbose
703
- bundle _2.3.26_ exec bin/aireview review https://gitlab.company.com/team/project/-/merge_requests/123 --generate-model gemini-3.7-flash --critique-model gemini-3.8-flash
704
- bundle _2.3.26_ exec bin/aireview review https://gitlab.company.com/team/project/-/merge_requests/123 --generate-model gemini-3.7-flash --generate-temperature 0.3 --critique-model gemini-3.8-flash --critique-temperature 0
705
- bundle _2.3.26_ exec bin/aireview review https://gitlab.company.com/team/project/-/merge_requests/123 --no-critique
734
+ bundle exec bin/aireview review https://gitlab.company.com/team/project/-/merge_requests/123
735
+ bundle exec bin/aireview review https://gitlab.company.com/team/project/-/merge_requests/123 --post
736
+ bundle exec bin/aireview review https://github.com/owner/repo/pull/42 --post
737
+ bundle exec bin/aireview review https://gitlab.company.com/team/project/-/merge_requests/123 --no-jira
738
+ bundle exec bin/aireview review https://gitlab.company.com/team/project/-/merge_requests/123 --dry-run --verbose
739
+ bundle exec bin/aireview review https://gitlab.company.com/team/project/-/merge_requests/123 --generate-model gemini-3.6-flash --critique-model gemini-3.8-flash
740
+ bundle exec bin/aireview review https://gitlab.company.com/team/project/-/merge_requests/123 --generate-model gemini-3.6-flash --generate-temperature 0.3 --critique-model gemini-3.8-flash --critique-temperature 0
741
+ bundle exec bin/aireview review https://gitlab.company.com/team/project/-/merge_requests/123 --no-critique
706
742
  ```
707
743
 
708
744
  - `--generate-model MODEL` overrides the model for the Generate pass only.
@@ -713,15 +749,15 @@ bundle _2.3.26_ exec bin/aireview review https://gitlab.company.com/team/project
713
749
  - `--no-jira` turns off the Jira enrichment even when the MR carries an issue key.
714
750
  - `--dry-run` prints the LLM settings, the context sizes and coverage, and the Generate prompt, plus the Critique prompt unless `--no-critique` is given.
715
751
  - `--no-critique` skips the second pass and renders the Generate candidates directly.
716
- - `--no-fallbacks` uses only the primary model and the first API key of each stage.
752
+ - `--no-fallbacks` uses only the primary model of each stage.
717
753
  - `--review-mode MODE` sets the behaviour when a review has already been published: `update` or `once`.
718
754
  - `--force` reviews again even when a review for this state of the MR is already published.
719
755
 
720
756
  ### Checking the models
721
757
 
722
758
  ```bash
723
- bundle _2.3.26_ exec bin/aireview models check
724
- bundle _2.3.26_ exec bin/aireview models check --config .aireview.yml --strict --verbose
759
+ bundle exec bin/aireview models check
760
+ bundle exec bin/aireview models check --config .aireview.yml --strict --verbose
725
761
  ```
726
762
 
727
763
  Every model of both stage chains gets two small requests — one with the
@@ -735,8 +771,8 @@ per-minute limit gets one retry after the provider's hint.
735
771
 
736
772
  ```
737
773
  Checking 5 model(s) with the generate and critique schemas
738
- gemini/gemini-3.7-flash generate ok (4.6s)
739
- gemini/gemini-3.7-flash critique ok (6.9s)
774
+ gemini/gemini-3.8-flash generate ok (4.6s)
775
+ gemini/gemini-3.8-flash critique ok (6.9s)
740
776
  gemini/gemini-3.6-flash generate unverified: This model is currently experiencing high demand. …
741
777
  gemini/gemini-9.9-nope generate missing: models/gemini-9.9-nope is not found for API version v1beta, …
742
778
  ollama/qwen2.5-coder:7b generate skipped: Connection refused
@@ -796,12 +832,41 @@ attempt too. Outside of GitLab CI, `once` mode keeps skipping an existing
796
832
  review. The `--force` flag repeats the review even when nothing has changed.
797
833
 
798
834
  While the review is running, the merge request can move on. Before publishing,
799
- `aireview` re-reads it and compares `sha`, the target branch, `diff_refs`, the
800
- title and the description: if any of those changed, the result is not published —
801
- a comment must not end up holding a review of a diff that is no longer current.
835
+ `aireview` re-reads it and compares `sha`, the target branch and `diff_refs`:
836
+ if any of those changed (or `[skip review]` was added to the title), the result
837
+ is not published — a comment must not end up holding a review of a diff that
838
+ is no longer current. If only the title or description changed while the review
839
+ was running, the formed report is still published with a note that the text was
840
+ edited during the run. In `--post` mode, `[skip review]` in the fresh title
841
+ also skips the LLM run itself (useful after the initial 60-second CI wait).
802
842
  The review text is printed to stdout before the publishing attempt, so it stays
803
843
  in the job log. The previous comment is kept until the end of the next run.
804
844
 
845
+ On GitHub the same comment is a pull request conversation comment, and the
846
+ author is compared by login. A personal or fine-grained token reads its login
847
+ from `/user`. The Actions `GITHUB_TOKEN` and GitHub App installation tokens
848
+ cannot: set `GITHUB_REVIEW_AUTHOR` to the login the comments are posted as —
849
+ `github-actions[bot]` for `GITHUB_TOKEN`, `<app-slug>[bot]` for an App.
850
+ Without it such a token stops the run with an error rather than guessing: a
851
+ wrong author means the review is not found and a second one is posted. Every
852
+ workflow that comments with `GITHUB_TOKEN` writes as `github-actions[bot]`,
853
+ so a marked comment from another workflow of the repository would be taken
854
+ for the review.
855
+
856
+ A **Re-run** of the workflow counts as a retry in `once` mode
857
+ (`GITHUB_RUN_ATTEMPT` above 1). The "moved while reviewing" check compares
858
+ the merge base instead of the base branch tip: a push to the base branch
859
+ that does not change the pull request diff does not stop publishing, while
860
+ a merge of part of the pull request into the base branch does. When GitHub
861
+ returns fewer files than the pull request changes (it lists at most 3000),
862
+ the count of the missing ones is written under "Not reviewed". Comments
863
+ exceeding GitHub's 65,536-character limit are automatically fitted by
864
+ shortening the files list under "Not reviewed" (or the summary if
865
+ oversized) while keeping findings and result intact. On GitHub's files API,
866
+ pure file renames (`changes: 0` without a patch) count as having no text
867
+ changes; because Git does not count lines for binary files, byte modifications
868
+ in a renamed binary file also report zero changes.
869
+
805
870
  ## GitLab CI
806
871
 
807
872
  For merge request pipelines `aireview` can run in a separate CI job, letting
@@ -824,12 +889,12 @@ aireview:
824
889
  MR_URL: "$CI_MERGE_REQUEST_PROJECT_URL/-/merge_requests/$CI_MERGE_REQUEST_IID"
825
890
  REVIEW_LANGUAGE: "ru"
826
891
  LLM_PROVIDER: "gemini"
827
- LLM_GENERATE_MODEL: "gemini-3.7-flash"
892
+ LLM_GENERATE_MODEL: "gemini-3.6-flash"
828
893
  LLM_CRITIQUE_MODEL: "gemini-3.8-flash"
829
894
  LLM_TIMEOUT: "60"
830
895
  LLM_HTTP_PROXY: "http://127.0.0.1:8888"
831
896
  script:
832
- - bundle _2.3.26_ exec bin/aireview review "$MR_URL" --verbose
897
+ - bundle exec bin/aireview review "$MR_URL" --verbose
833
898
  timeout: 45m
834
899
  retry:
835
900
  max: 1
@@ -843,7 +908,7 @@ is itself bounded by `LLM_TIME_BUDGET` (30 minutes by default, pauses and
843
908
  fallback models included), the rest is reading the MR and Jira and
844
909
  publishing.
845
910
 
846
- Set secrets such as `GITLAB_TOKEN`, `GEMINI_API_KEY` / `GEMINI_API_KEYS` and
911
+ Set secrets such as `GITLAB_TOKEN`, `GEMINI_API_KEY` and
847
912
  the optional Jira credentials in the GitLab CI/CD variables. If the job should publish the result
848
913
  back to the merge request, add `--post` to the review command.
849
914
 
@@ -916,6 +981,77 @@ registry) → build and push → set the new tag in `stable`. The same check on
916
981
  a schedule (once a day) is the early signal that the provider retired a
917
982
  model — otherwise the first to learn about it is a live MR.
918
983
 
984
+ ## GitHub Actions
985
+
986
+ A workflow for pull requests of the same repository:
987
+
988
+ ```yaml
989
+ name: aireview
990
+
991
+ on:
992
+ pull_request:
993
+ types: [opened, synchronize, reopened, ready_for_review, edited]
994
+
995
+ permissions:
996
+ contents: read
997
+ pull-requests: write
998
+
999
+ concurrency:
1000
+ group: aireview-${{ github.event.pull_request.number }}
1001
+ cancel-in-progress: true
1002
+
1003
+ jobs:
1004
+ review:
1005
+ # Fork PRs get no secrets and a read-only token: skip them. Dependabot
1006
+ # PRs come from branches of this repo, pass the fork check, but get no
1007
+ # Actions secrets either: skip them too.
1008
+ if: >-
1009
+ github.event.pull_request.head.repo.full_name == github.repository &&
1010
+ github.actor != 'dependabot[bot]' &&
1011
+ !github.event.pull_request.draft &&
1012
+ !contains(github.event.pull_request.title, '[skip review]')
1013
+ runs-on: ubuntu-24.04
1014
+ timeout-minutes: 40
1015
+ steps:
1016
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1; for .aireview.yml
1017
+ with:
1018
+ persist-credentials: false
1019
+ - uses: ruby/setup-ruby@14594264cd68ce8a2345dd349bc3d138a4ef85c8 # v1.327.0
1020
+ with:
1021
+ ruby-version: '3.3'
1022
+ - run: gem install aireview -v '~> 2.3'
1023
+ - run: aireview review "$PR_URL" --post
1024
+ env:
1025
+ PR_URL: ${{ github.event.pull_request.html_url }}
1026
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1027
+ GITHUB_REVIEW_AUTHOR: github-actions[bot] # who GITHUB_TOKEN posts as
1028
+ GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
1029
+ REVIEW_MODE: update # once: one published review per PR, "Re-run jobs" refreshes it
1030
+ ```
1031
+
1032
+ The only secret to add is `GEMINI_API_KEY`: without `.aireview.yml` the gem
1033
+ takes its bundled defaults (the Gemini pool).
1034
+
1035
+ - `pull_request`, never `pull_request_target` with a checkout of the pull
1036
+ request head: `.aireview.yml` from the pull request can set provider
1037
+ addresses, so a fork could send the API key to a server of its own.
1038
+ - The URL goes through `env`, not through `${{ }}` inside `run:`, so that
1039
+ nothing from the event is pasted into the shell script.
1040
+ - `edited` reviews again after a title or description edit; when the edit
1041
+ does not reach the prompts, the key is the same and no LLM request is sent.
1042
+ - `timeout-minutes: 40` is `LLM_TIME_BUDGET` (30 minutes by default) plus
1043
+ reading and publishing.
1044
+
1045
+ `update` keeps the review current after every push that changes the diff.
1046
+ `once` is the cheaper option: one published review per pull request,
1047
+ refreshed with **Re-run jobs** when its inputs changed. Neither means exactly
1048
+ one LLM run: a run cancelled or failed before publishing leaves no review,
1049
+ so the next push runs the LLM again. `cancel-in-progress` drops a run
1050
+ overtaken by a push — it would usually not publish anyway — but requests
1051
+ already sent to the provider may still be billed. And a push between the
1052
+ "moved" check and the post can still leave a review of the previous diff
1053
+ until the next run replaces it.
1054
+
919
1055
  ## Docker
920
1056
 
921
1057
  ```bash
@@ -927,9 +1063,9 @@ docker run --rm --env-file .env -v "$PWD/.aireview.yml:/app/.aireview.yml:ro" ai
927
1063
  ## Testing
928
1064
 
929
1065
  ```bash
930
- bundle _2.3.26_ exec rspec
931
- bundle _2.3.26_ exec rspec spec/config_spec.rb
932
- bundle _2.3.26_ exec rspec spec/secret_scrubber_spec.rb
1066
+ bundle exec rspec
1067
+ bundle exec rspec spec/config_spec.rb
1068
+ bundle exec rspec spec/secret_scrubber_spec.rb
933
1069
  ```
934
1070
 
935
1071
  ## Notes
data/config/defaults.yml CHANGED
@@ -14,8 +14,9 @@
14
14
  # "Ollama models" with Gemini names.
15
15
  #
16
16
  # Model names come from the Gemini catalog (GET /v1beta/models), text models
17
- # without "preview" in the name only; each one is confirmed by
18
- # `aireview models check` with both schemas (2026-09-18).
17
+ # without "preview" in the name only; gemini-3.* models were confirmed by
18
+ # `aireview models check` with both schemas (2026-09-18); gemini-4-hydrogen
19
+ # was added on 2026-11-16.
19
20
 
20
21
  review_language: en
21
22
 
@@ -29,17 +30,15 @@ llm:
29
30
  overloaded_quarantine: 120
30
31
  models:
31
32
  - provider: gemini
32
- model: gemini-3.8-flash
33
+ model: gemini-4-hydrogen
33
34
  - provider: gemini
34
- model: gemini-3.7-flash
35
+ model: gemini-3.8-flash
35
36
  - provider: gemini
36
37
  model: gemini-3.6-flash
37
- - provider: gemini
38
- model: gemini-3.5-flash
39
38
  - provider: gemini
40
39
  model: gemini-3.5-flash-lite
41
40
  generate:
42
- start: gemini-3.7-flash
41
+ start: gemini-3.8-flash
43
42
  temperature: 0.1
44
43
  critique:
45
44
  rank: not_below_generate
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  require 'logger'
3
- require 'set'
4
3
 
5
4
  module Aireview
6
5
  # A mechanical check that a candidate points at the code, against the diff