docs(examples): OCR_LLM_MODEL is required, not optional — fix the GitLab example#17
docs(examples): OCR_LLM_MODEL is required, not optional — fix the GitLab example#17chethanuk wants to merge 1 commit into
Conversation
|
Warning Review limit reached
Next review available in: 57 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughChangesOCR LLM configuration
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Code Review
This pull request updates the GitFlic and GitLab CI/CD examples to mark OCR_LLM_MODEL as a required variable, as OpenCodeReview (OCR) lacks a built-in default model and fails when it is unset. It also introduces shell parameter validation checks to ensure required variables are set, quotes the variables to prevent word splitting, and removes unnecessary directory creation commands. There are no review comments, so I have no further feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
@coderabbitai review |
✅ Action performedReview finished.
|
6f99eff to
580abcd
Compare
The GitLab example documented OCR_LLM_MODEL as optional with a gpt-4o
default in three places. There is no such default: internal/llm/resolver.go:411
treats an empty model as unresolved, and the only gpt-4o in non-test Go code
is a provider catalogue entry at internal/llm/providers.go:292.
Unset, the variable word-splits away and leaves a 2-arg 'ocr config set',
so parseConfigArgs sees ["set", "llm.model"] and the len(args) < 3 guard at
cmd/opencodereview/flags.go:268 rejects it with the opaque usage error
returned on :269.
Add ${VAR:?} guards naming each missing variable, quote all three
assignments, correct the docs in both READMEs, and drop the dead
'mkdir -p ~/.open-code-review' - the real config dir is ~/.opencodereview.
580abcd to
781df21
Compare
Description
The GitLab example documents
OCR_LLM_MODELas optional with agpt-4odefault. It isrequired, and no such default exists anywhere in the codebase. A user who follows the docs
and leaves it unset gets a red pipeline and this:
Three places make the claim:
examples/gitlab_ci/.gitlab-ci.yml# OCR_LLM_MODEL - Model name (default: gpt-4o)examples/gitlab_ci/README.md| `OCR_LLM_MODEL` | No | No | Model name (defaults to `gpt-4o`) |examples/gitflic_ci/README.md| `OCR_LLM_MODEL` | No | Model name (e.g., `gpt-4o`) |The code disagrees.
internal/llm/resolver.go:411treats an empty model as unresolved:with the same guard on the env path at
:169. And there is nogpt-4ofallback to fallback to — the only occurrence in non-test Go code is a provider catalogue entry:
So the mechanism today is: the unquoted
$OCR_LLM_MODELword-splits away, leaving a 2-argocr config set, whichcmd/opencodereview/flags.go:262rejects. GitLab jobs run underset -e, so the job dies right there.Why the obvious fix is the wrong one
The sibling GitFlic example already "handles" this at
examples/gitflic_ci/gitflic-ci.yaml:51-53:Copying that would make things worse, and I verified it rather than assuming. Skipping
the assignment doesn't summon a default — it just moves the failure later and hides it:
A green config step, no model configured, and the review then dies with an error that
.gitlab-ci.yml:68's|| trueswallows — leaving the user a generic "OpenCodeReviewencountered an error" MR comment. That is strictly worse than today's immediate failure.
Quoting alone is also not a no-op. An unset variable, quoted, becomes a 3-arg call with
an empty value:
Exit 0, a reassuring
Set llm.url =, and nothing written. Quoting is only safe when pairedwith an explicit required-variable check — which is why this PR does both together rather
than shipping the quoting as a tidy-up.
The fix
${VAR:?msg}rather than${VAR:-default}deliberately: there is no correct default tosupply.
gpt-4ois wrong for every non-OpenAI endpoint this example targets, andllm.urlis user-specific by definition.
GitLab's own templates use
${VAR:-default}inJobs/Build.gitlab-ci.yml:7andSecurity/DAST.gitlab-ci.yml:32— but only where a genuine fallback exists(
${CI_APPLICATION_TAG:-$CI_COMMIT_SHA}). Where one doesn't,gitlabhq/gitlabhq.gitlab/ci/qa-common/omnibus.gitlab-ci.yml:8fails fast instead:if [ -z "$RELEASE" ]; then echo "…requires…"; exit 1. That distinction is exactly the onebeing applied here.
Third bug in the same five lines — a directory nothing reads
.gitlab-ci.yml:51creates~/.open-code-review. The real config directory is~/.opencodereview, no hyphens (internal/session/persist.go:104). Confirmed by runningthe binary: after a successful config step,
~/.opencodereview/config.jsonexists and thehyphenated directory was never created.
ocr config setcreates the real directory itself,so the line is dead either way — it only misleads anyone debugging the example. Removed.
Verification
The whole chain, run against a live LLM endpoint:
OCR_LLM_MODELusage: ocr config set <key> <value>. Opaque, but immediate.if [ -n ]guard (rejected)ocr llm testfailsno valid LLM endpoint configured, swallowed by|| trueOCR_LLM_MODEL: set OCR_LLM_MODEL in Settings -> CI/CD -> Variables~/.opencodereview/config.jsonAnd the fixed block end-to-end against a real endpoint, to confirm the guards are
transparent when the variables are set:
shellcheckon the extracted script block, before and after:python3 -c "yaml.safe_load(...)"on the changed.gitlab-ci.yml— parses clean.Scope
The README duplicates the entire broken snippet at
examples/gitlab_ci/README.md:145-155,so the same fix is applied there — otherwise this would fix the example and leave the
documentation of the example broken.
examples/gitflic_ci/README.md:42makes the same false optionality claim about the samevariable, so I corrected that one line too. I did not touch
examples/gitflic_ci/gitflic-ci.yaml: itsif [ -n ]guard papers over this same bug, butchanging it is a behaviour change to a different example on a platform whose CI feature set
I could not verify. Happy to follow up separately.
Deliberately not included
only: merge_requests→rules:.only/exceptis legacy and GitLab's own templatesuse
rules:, but the two exercise different pipeline-selection paths, so it isbehaviour-adjacent rather than cosmetic. It does not belong in a bugfix. Glad to send it
as a follow-up.
workflow: auto_cancel: {on_new_commit: interruptible}.interruptible: trueat:38is inert without it, so this is a real gap — but it changes cancellation behaviour,and mixing that with a bugfix risks the bugfix. Also a follow-up if wanted.
Limitations
require credit-card identity verification, which I did not do. Everything above was proven
locally against the real
ocrbinary and a live LLM endpoint, which exercises the exactfailure path — but I have not watched this run as a GitLab job, and I am not claiming I did.
pipeline.
OCR_LLM_URL/OCR_LLM_AUTH_TOKENwere already effectively required; the guards makethat explicit and are the reason quoting them is safe. That is a small behaviour change for
those two — previously an unset URL also produced the same opaque usage error, so the
failure mode improves rather than changes.
Type of Change
How Has This Been Tested?
set/unset variables — table above
if [ -n ]variant reaches a green config step with no model, thenfails at
ocr llm testwithno valid LLM endpoint configured✓ Connection test successfulshellcheck -s bash— 3× SC2086 before, clean afteryaml.safe_loadon the changed.gitlab-ci.yml~/.opencodereview/config.jsonis written and~/.open-code-reviewnever isChecklist
harness executes
examples/. Verified against the real binary instead, as above.AI assistance: Claude Code helped research and verify this change. I reviewed the full diff
and take responsibility for it.
Summary by CodeRabbit
Documentation
OCR_LLM_MODEL.Bug Fixes