fix: route plugin LLM completions through Codex runtime#81511
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. by source inspection: current main’s plugin Real behavior proof Next step before merge Security Review detailsBest possible solution: Land the narrow runtime-provider seam after normal maintainer review and CI, keeping logical model refs stable for policy/audit while aligning plugin LLM execution with existing Codex runtime auth. Do we have a high-confidence way to reproduce the issue? Yes by source inspection: current main’s plugin Is this the best way to solve the issue? Yes; the PR reuses the existing harness-policy decision and separates logical provider from execution provider, which is narrower than changing plugin auth policy or rewriting public model refs. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 256377c029f6. |
6fd7332 to
47697a7
Compare
* fix: route plugin LLM completions through Codex runtime * fix: preserve OpenRouter completion model ids * fix: allow registry config compat guards (cherry picked from commit aac216d)
* fix: route plugin LLM completions through Codex runtime * fix: preserve OpenRouter completion model ids * fix: allow registry config compat guards
* fix: route plugin LLM completions through Codex runtime * fix: preserve OpenRouter completion model ids * fix: allow registry config compat guards
* fix: route plugin LLM completions through Codex runtime * fix: preserve OpenRouter completion model ids * fix: allow registry config compat guards
Summary
openai/gpt-*model refs as direct OpenAI API calls, even when config mapped those refs to the Codex runtime.OPENAI_API_KEY, then fall back to deterministic truncation.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Real behavior proof (required for external PRs)
Behavior addressed: lossless-claw doctor repair needed to use model-backed plugin LLM summarization while the active OpenClaw gateway was authenticated with OpenAI Codex OAuth, not a direct
OPENAI_API_KEY.Real environment tested: Josh's live OpenClaw gateway running this PR head,
OpenClaw 2026.5.12-beta.1 (47697a7), Telegram group topic sessionagent:main:telegram:group:-1003774691294:topic:3731, modelopenai/gpt-5.5, runtimeOpenAI Codex, authopenai-codex:josh@martian.engineering.Exact steps or command run after this patch: deployed this PR branch locally, rebuilt and restarted the gateway, then ran
/lossless doctor applyin the same Telegram/OpenClaw session that had a known fallback LCM summary repair candidate. Verified after the run withlcm_describe sum_22ef5580363377a1andlcm_grep "LCM fallback summary".Evidence after fix: before doctor apply,
lcm_grep "LCM fallback summary"found recent repair candidatesum_22ef5580363377a1in this session. After doctor apply,lcm_describe sum_22ef5580363377a1returned a real summary instead of the fallback marker:The live session status for the proof run showed:
Observed result after fix: doctor apply repaired the fallback summary in place with model-generated summary content and did not hit the previous direct OpenAI auth failure path. The repaired summary no longer contains
[LCM fallback summary], and a follow-up grep forLCM fallback summaryno longer returnedsum_22ef5580363377a1.What was not tested: no direct OpenAI
OPENAI_API_KEYconfiguration was tested, and no non-Codex agent runtime was changed by this live proof.Before evidence (optional but encouraged): the pre-fix failure mode from the same environment was lossless summarizer auth failure for direct OpenAI provider traffic:
Auth lookup failed for provider "openai": No API key found for provider "openai". You are authenticated with OpenAI Codex OAuth; OpenAI agent model runs use openai/gpt-* through the Codex runtime.Root Cause (if applicable)
openai/gpt-*as direct provider traffic even when the configured model policy mapped that OpenAI model ref to the Codex agent runtime.runtime.llm.completepath.Regression Test Plan (if applicable)
src/agents/simple-completion-runtime.selection.test.tssrc/agents/simple-completion-runtime.test.tssrc/plugins/runtime/runtime-llm.runtime.test.tsopenai/gpt-*refs preserve their logical identity while completion execution routes through Codex when resolved agent runtime policy sayscodex.User-visible / Behavior Changes
Plugin/context-engine LLM summarization now works with canonical OpenAI model refs that are configured to run through Codex OAuth. Users should no longer need to add
OPENAI_API_KEYjust to make plugin summarization work in a Codex-runtime OpenAI setup.Diagram (if applicable)
Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation: N/ARepro + Verification
Environment
openai/gpt-5.5andopenai/gpt-5.4-minirouted through Codex runtime/OAuthSteps
/lossless doctor applyin a session containing an LCM fallback summary candidate.lcm_describe <summary-id>.lcm_grep "LCM fallback summary".Expected
OPENAI_API_KEYauth failure appears.Actual
sum_22ef5580363377a1was repaired in place and now contains coherent summary text instead of[LCM fallback summary].47697a7with OpenAI Codex OAuth.Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
Review Conversations
Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoRisks and Mitigations
Testing
pnpm test src/agents/simple-completion-runtime.selection.test.ts -- --reporter=verbosepnpm test src/agents/simple-completion-runtime.test.ts -- --reporter=verbosepnpm test src/plugins/runtime/runtime-llm.runtime.test.ts -- --reporter=verbosepnpm test:changedpnpm format:check -- CHANGELOG.md src/agents/simple-completion-runtime.ts src/agents/simple-completion-runtime.test.ts src/agents/simple-completion-runtime.selection.test.tsnode scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/agents/simple-completion-runtime.ts src/agents/simple-completion-runtime.test.ts src/agents/simple-completion-runtime.selection.test.tsgit diff --checkKnown gap:
pnpm check:changedcurrently fails in untouchedsrc/plugins/registry.runtime-config.test.tstype assertions, unrelated to this diff.