Handle missing trusted configuration during first-time setup #22

Closed
opened 2026-07-23 17:17:25 +01:00 by nimmo · 0 comments
Owner

Problem

A repository's first setup PR can introduce both its workflow and .forgejo/ai-review.yml, but the executable configuration is correctly loaded from the trusted base commit. That commit has no configuration yet.

On main at db44a09, fetch_config() returns {} for HTTP 404. Provider dispatch then defaults to Ollama, and a reviewable diff fails with provider.model or OLLAMA_MODEL is required when no environment model is configured. This remains an onboarding problem even though this deployment now uses Pi.

Existing behaviour

  • OLLAMA_MODEL and OLLAMA_BASE_URL already work as environment fallbacks; implementing that chain again is unnecessary.
  • An empty configuration already runs no deterministic commands.
  • Pi/OpenCode/agent-cli and HTTP providers are supported. Bootstrap handling must not assume that every repository wants Ollama or this deployment's Pi model.
  • Reading executable configuration from the PR head would weaken the trust boundary and is not an acceptable fix.

Remaining scope

  • Distinguish an absent trusted configuration from invalid configuration and API failures.
  • Define and implement a clear bootstrap outcome: a successful skip with an actionable reason, or a review using an explicitly supplied trusted fallback.
  • If a fallback review runs, report that repository configuration and deterministic checks were unavailable; retain advisory defaults and prevent an unconfigured run from gaining approval authority.
  • If no usable trusted provider is available, explain how to merge/setup configuration rather than fail later with an unrelated missing-model error.
  • Document the bootstrap procedure without requiring duplicated deployment-specific provider values.
  • Keep permission, authentication, network, malformed-response and invalid-config failures visible. Do not treat non-404 errors as missing configuration.

Acceptance

  • A first setup PR receives a clear, documented outcome without loading PR-defined commands.
  • Tests cover missing configuration with and without explicit fallback, an intentionally empty configuration, invalid configuration, and non-404 API failures.
  • No provider or publishing authority is silently selected from untrusted PR content.

Original reproduction

Reported on redview's first setup PR with an Ollama configuration at reviewer revision 1d35f73. The architectural cause remains confirmed on db44a09; the specific model/host in the original report is historical context.

## Problem A repository's first setup PR can introduce both its workflow and `.forgejo/ai-review.yml`, but the executable configuration is correctly loaded from the trusted base commit. That commit has no configuration yet. On main at `db44a09`, `fetch_config()` returns `{}` for HTTP 404. Provider dispatch then defaults to Ollama, and a reviewable diff fails with `provider.model or OLLAMA_MODEL is required` when no environment model is configured. This remains an onboarding problem even though this deployment now uses Pi. ## Existing behaviour - `OLLAMA_MODEL` and `OLLAMA_BASE_URL` already work as environment fallbacks; implementing that chain again is unnecessary. - An empty configuration already runs no deterministic commands. - Pi/OpenCode/agent-cli and HTTP providers are supported. Bootstrap handling must not assume that every repository wants Ollama or this deployment's Pi model. - Reading executable configuration from the PR head would weaken the trust boundary and is not an acceptable fix. ## Remaining scope - Distinguish an absent trusted configuration from invalid configuration and API failures. - Define and implement a clear bootstrap outcome: a successful skip with an actionable reason, or a review using an explicitly supplied trusted fallback. - If a fallback review runs, report that repository configuration and deterministic checks were unavailable; retain advisory defaults and prevent an unconfigured run from gaining approval authority. - If no usable trusted provider is available, explain how to merge/setup configuration rather than fail later with an unrelated missing-model error. - Document the bootstrap procedure without requiring duplicated deployment-specific provider values. - Keep permission, authentication, network, malformed-response and invalid-config failures visible. Do not treat non-404 errors as missing configuration. ## Acceptance - A first setup PR receives a clear, documented outcome without loading PR-defined commands. - Tests cover missing configuration with and without explicit fallback, an intentionally empty configuration, invalid configuration, and non-404 API failures. - No provider or publishing authority is silently selected from untrusted PR content. ## Original reproduction Reported on redview's first setup PR with an Ollama configuration at reviewer revision `1d35f73`. The architectural cause remains confirmed on `db44a09`; the specific model/host in the original report is historical context.
nimmo changed title from Graceful first-PR config fallback to Handle missing trusted configuration during first-time setup 2026-10-10 18:02:38 +01:00
nimmo closed this issue 2026-10-10 19:44:53 +01:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
nimmo/forgejo-auto-pr-review#22
No description provided.