Repository navigation
fix(openai-codex): normalize stale transport metadata in resolution and discovery - #67635
Conversation
Greptile SummaryThis PR fixes stale The implementation is logically sound and the scope is well-contained. Confidence Score: 5/5Safe to merge — the fix is narrowly scoped to Codex transport normalization with no behavioral change for other providers. All findings are P2 or lower. The normalization logic is correct across both the provider plugin and the discovery seam, the regex change is precise and well-tested, and the new guard in normalizeDiscoveredPiModel preserves the original fall-back contract for models that still lack a valid api after normalization. No files require special attention. Reviews (1): Last reviewed commit: "fix(agents): normalize stale codex disco..." | Re-trigger Greptile |
|
Landed via squash. Thanks @saamuelng601-pixel and @hclsys for the original fix work this PR superseded. |
…nd discovery (openclaw#67635) Merged via squash. Supersedes: - openclaw#66969 by @saamuelng601-pixel - openclaw#67159 by @hclsys Co-authored-by: saamuelng601-pixel <[email protected]> Co-authored-by: hclsys <[email protected]>
…nd discovery (openclaw#67635) Merged via squash. Supersedes: - openclaw#66969 by @saamuelng601-pixel - openclaw#67159 by @hclsys Co-authored-by: saamuelng601-pixel <[email protected]> Co-authored-by: hclsys <[email protected]>
…nd discovery (openclaw#67635) Merged via squash. Supersedes: - openclaw#66969 by @saamuelng601-pixel - openclaw#67159 by @hclsys Co-authored-by: saamuelng601-pixel <[email protected]> Co-authored-by: hclsys <[email protected]>
…nd discovery (openclaw#67635) Merged via squash. Supersedes: - openclaw#66969 by @saamuelng601-pixel - openclaw#67159 by @hclsys Co-authored-by: saamuelng601-pixel <[email protected]> Co-authored-by: hclsys <[email protected]>
…nd discovery (openclaw#67635) Merged via squash. Supersedes: - openclaw#66969 by @saamuelng601-pixel - openclaw#67159 by @hclsys Co-authored-by: saamuelng601-pixel <[email protected]> Co-authored-by: hclsys <[email protected]>
…nd discovery (openclaw#67635) Merged via squash. Supersedes: - openclaw#66969 by @saamuelng601-pixel - openclaw#67159 by @hclsys Co-authored-by: saamuelng601-pixel <[email protected]> Co-authored-by: hclsys <[email protected]>
…nd discovery (openclaw#67635) Merged via squash. Supersedes: - openclaw#66969 by @saamuelng601-pixel - openclaw#67159 by @hclsys Co-authored-by: saamuelng601-pixel <[email protected]> Co-authored-by: hclsys <[email protected]>
…nd discovery (openclaw#67635) Merged via squash. Supersedes: - openclaw#66969 by @saamuelng601-pixel - openclaw#67159 by @hclsys Co-authored-by: saamuelng601-pixel <[email protected]> Co-authored-by: hclsys <[email protected]>
…nd discovery (openclaw#67635) Merged via squash. Supersedes: - openclaw#66969 by @saamuelng601-pixel - openclaw#67159 by @hclsys Co-authored-by: saamuelng601-pixel <[email protected]> Co-authored-by: hclsys <[email protected]>
…nd discovery (openclaw#67635) Merged via squash. Supersedes: - openclaw#66969 by @saamuelng601-pixel - openclaw#67159 by @hclsys Co-authored-by: saamuelng601-pixel <[email protected]> Co-authored-by: hclsys <[email protected]>
…nd discovery (openclaw#67635) Merged via squash. Supersedes: - openclaw#66969 by @saamuelng601-pixel - openclaw#67159 by @hclsys Co-authored-by: saamuelng601-pixel <[email protected]> Co-authored-by: hclsys <[email protected]>
Summary
openai-codexmodel metadata could survive in both runtime resolution and discovery/listing flows, especially whenapiwas missing or the stored base URL washttps://chatgpt.com/backend-api/v1.openai-codexnow canonicalizes native transport metadata toapi: "openai-codex-responses"andbaseUrl: "https://chatgpt.com/backend-api"across both model resolution and discovery normalization, with regression tests for missing-apiand stale-/v1rows.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
openai-codextransport normalization only repaired some stale native metadata paths during model resolution, and discovery normalization returned early unlessapiwas already a string.apior legacyhttps://chatgpt.com/backend-api/v1were not normalized consistently across both execution and discovery/listing seams.models.jsonentries forward from earlier versions, so the bug persisted even after auth and probes looked healthy.Regression Test Plan (if applicable)
extensions/openai/base-url.test.tsextensions/openai/openai-codex-provider.test.tssrc/agents/pi-embedded-runner/model.test.tssrc/agents/pi-model-discovery.auth.test.tsopenclaw infer model runopenai-codexrows with missingapior/backend-api/v1normalize to the canonical native Codex transport in both runtime resolution and discovery/listing flows, and the live CLI path succeeds with local Codex OAuth credentials.User-visible / Behavior Changes
openai-codexmodels with stale native metadata now self-heal during resolution and discovery/listing.Diagram (if applicable)
Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation:Repro + Verification
Environment
pnpmworkspace checkoutopenai-codex/gpt-5.4apiorhttps://chatgpt.com/backend-api/v1; localopenai-codex:defaultOAuth profile present in~/.openclaw/agents/main/agent/auth-profiles.jsonSteps
openai-codexmodel row with missingapi.openai-codexmodel row usinghttps://chatgpt.com/backend-api/v1.models.jsonvariants and the local Codex OAuth profile:OPENCLAW_AGENT_DIR=<temp-agent-dir> pnpm openclaw infer model run --model openai-codex/gpt-5.4 --prompt 'Reply with exactly OK.' --jsonExpected
api: "openai-codex-responses"andbaseUrl: "https://chatgpt.com/backend-api".Actual
OK.Evidence
Attach at least one:
Evidence notes:
apicase returned:{ "provider": "openai-codex", "model": "gpt-5.4", "outputs": [{ "text": "OK" }] }/backend-api/v1case returned:{ "provider": "openai-codex", "model": "gpt-5.4", "outputs": [{ "text": "OK" }] }Human Verification (required)
What you personally verified (not just CI), and how:
openai-codexrows with missingapinormalize correctly in provider tests/backend-api/v1rows normalize correctly in provider testspnpm openclaw infer model run --model openai-codex/gpt-5.4succeeds against local Codex OAuth credentials when the temp agent dir contains a missing-apistale rowpnpm openclaw infer model run --model openai-codex/gpt-5.4succeeds against local Codex OAuth credentials when the temp agent dir contains a stale/backend-api/v1rowhttps://chatgpt.com/backend-apiremains recognized/backend-api/v2and/backend-api/codexremain rejected by the base URL helpermemory-lancedbrecall warnings did not block Codex inference during manual verificationReview Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoRisks and Mitigations
/backend-api/v2and/backend-api/codex.