You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: switch to first-party provider dispatch; fix agent finalization and rescue crash
A production run of PR-Lens failed with two compounding defects:
1. The ToolLoopAgent exhausted its 12-step budget without calling submit_report.
2. The rescue path then crashed with AI_NoObjectGeneratedError because the
generic @ai-sdk/openai-compatible provider was created without
supportsStructuredOutputs, so `Output.object({ schema })` silently sent the
schema-less response_format and the model returned text that didn't parse.
Rather than paper over (2) with a capability flag and keep the generic BYO
wrapper for every provider, this change pivots to provider-name dispatch:
users pass llm-provider = openai | anthropic | deepseek | google | groq |
mistral | xai | openrouter | openai-compatible, and each branch uses the
respective first-party @ai-sdk/* package which already knows its own
capability shape.
Other fixes in the same pass:
- Add prepareStep to force `submit_report` on the final allowed step, so
stopWhen: hasToolCall('submit_report') fires by construction and the rescue
becomes a true safety net rather than a normal fallback.
- Simplify rescue to a single generateText + Output.object call against
VerifyReportSchema directly. Delete the repairJson / Lenient-schema / alias-
normalisation layers and the @qraftr/json-repair dependency — structured
outputs guarantee the exact Zod shape.
- Keep @ai-sdk/openai-compatible as the explicit escape hatch
(llm-provider: openai-compatible) with supportsStructuredOutputs + includeUsage.
- Bump LanguageModelV2 → LanguageModelV3 everywhere; all provider SDKs at v3.x
implement V3.
- Fix .gitignore so dist/ actually ships (previous ignore line contradicted the
comment right below it and the README's stated intent).
Breaking change: existing workflows must add `llm-provider:` and drop
`llm-base-url:` unless they're using an OpenAI-compatible self-hosted endpoint.
README and self-test workflow updated accordingly.
Smoke-tested end-to-end against sindresorhus/ky#853 via Moonshot kimi-k2.5
(openai-compatible branch): 7 steps, submittedViaTool=true, 15k tokens, no
warnings.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+69-21Lines changed: 69 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,40 +32,88 @@ It is intentionally orthogonal to code-review bots. It answers *"what should a h
32
32
with: { fetch-depth: 0 }
33
33
- uses: Iris-Ares/pr-lens-github-actions@v0
34
34
with:
35
-
llm-base-url: ${{ secrets.LLM_BASE_URL }}
35
+
llm-provider: openai
36
36
llm-api-key: ${{ secrets.LLM_API_KEY }}
37
-
llm-model: gpt-4o
37
+
llm-model: gpt-4.1
38
38
```
39
39
40
40
2. Store your provider credentials as repo secrets:
41
-
- `LLM_BASE_URL` — any OpenAI-compatible endpoint (e.g. `https://api.openai.com/v1`, `https://api.deepseek.com/v1`, `https://openrouter.ai/api/v1`, or a local `https://vllm.internal/v1`).
42
-
- `LLM_API_KEY`— the API key for that endpoint.
41
+
- `LLM_API_KEY` — the API key for the provider you picked.
43
42
44
43
3. (Optional) Seed a starter memory file at `.pr-lens/business.md` with your project's domain glossary. The agent will read from it and propose additions over time.
0 commit comments