Skip to content

fix: normalize openai-codex and github-copilot provider IDs for media-understanding#56678

Open
YoungMoneyInvestments wants to merge 1 commit intoopenclaw:mainfrom
YoungMoneyInvestments:fix/openai-codex-media-understanding
Open

fix: normalize openai-codex and github-copilot provider IDs for media-understanding#56678
YoungMoneyInvestments wants to merge 1 commit intoopenclaw:mainfrom
YoungMoneyInvestments:fix/openai-codex-media-understanding

Conversation

@YoungMoneyInvestments
Copy link
Copy Markdown

Summary

When using openai-codex (Codex OAuth) or github-copilot as a provider, the image/media-understanding tool fails with:

No media-understanding provider registered for openai-codex

Both providers route through OpenAI models that fully support vision, but normalizeMediaProviderId() did not map them to "openai", so the registry lookup couldn't find the OpenAI media-understanding adapter.

Changes

  • src/media-understanding/provider-id.ts — Added normalization rules: openai-codex → openai and github-copilot → openai, matching the existing gemini → google pattern.
  • src/media-understanding/provider-registry.test.ts — Added two tests confirming both provider variants resolve to the openai media-understanding provider.

Test plan

  • All 5 existing + new media-understanding tests pass (pnpm vitest src/media-understanding)
  • Pre-commit hooks (lint, typecheck) pass
  • Manual verification: configure openai-codex as primary provider → image tool should work without fallback

…derstanding

openai-codex (Codex OAuth) and github-copilot both route through
OpenAI models that support vision, but their provider IDs were not
mapped to "openai" in the media-understanding registry. This caused
"No media-understanding provider registered for openai-codex" errors
when using the image tool with Codex subscription auth.

Add normalization rules in normalizeMediaProviderId() so that
openai-codex and github-copilot resolve to the openai media provider,
matching the existing gemini → google pattern.

Closes #0 (no existing issue)
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 29, 2026

Greptile Summary

This PR fixes a bug where using openai-codex or github-copilot as a provider caused a "No media-understanding provider registered" error by extending normalizeMediaProviderId() to map both variants to \"openai\", matching the existing gemini → google pattern.

Changes:

  • src/media-understanding/provider-id.ts: Two new normalization rules appended after the upstream normalizeProviderId() call — \"openai-codex\" and \"github-copilot\" both resolve to \"openai\". The logic is correct because normalizeProviderId() leaves these identifiers untouched (they have no existing mapping in src/agents/provider-id.ts), so the new conditionals are always reachable.
  • src/media-understanding/provider-registry.test.ts: Two new tests mirror the pre-existing gemini normalization test and cover both new provider variants. A minor inconsistency exists: the github-copilot test omits the capabilities assertion present in the openai-codex test, though this doesn't affect correctness.

Confidence Score: 5/5

Safe to merge — focused, low-risk fix with good test coverage and no changes to existing behaviour.

All findings are P2 style suggestions. The implementation is straightforward and correctly follows the established pattern, with no logic errors or regressions.

No files require special attention.

Important Files Changed

Filename Overview
src/media-understanding/provider-id.ts Adds normalization for openai-codex and github-copilot → openai, following the existing gemini → google pattern. Logic is correct.
src/media-understanding/provider-registry.test.ts Two new tests covering the openai-codex and github-copilot normalization paths; minor: github-copilot test omits the capabilities assertion that the openai-codex test includes.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/media-understanding/provider-registry.test.ts
Line: 99-103

Comment:
**Minor test inconsistency — missing capabilities assertion**

The `openai-codex` test asserts `provider?.capabilities` (line ~82: `expect(provider?.capabilities).toContain("image")`), but the `github-copilot` test only checks `provider?.id`. Both tests use the same mock provider data, so the assertion would trivially pass. Adding it would keep the two tests symmetric and make the intent clearer.

```suggestion
    expect(provider).toBeDefined();
    expect(provider?.id).toBe("openai");
    expect(provider?.capabilities).toContain("image");
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix: normalize openai-codex and github-c..." | Re-trigger Greptile

Comment on lines +99 to +103
const provider = getMediaUnderstandingProvider("github-copilot", registry);

expect(provider).toBeDefined();
expect(provider?.id).toBe("openai");
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Minor test inconsistency — missing capabilities assertion

The openai-codex test asserts provider?.capabilities (line ~82: expect(provider?.capabilities).toContain("image")), but the github-copilot test only checks provider?.id. Both tests use the same mock provider data, so the assertion would trivially pass. Adding it would keep the two tests symmetric and make the intent clearer.

Suggested change
const provider = getMediaUnderstandingProvider("github-copilot", registry);
expect(provider).toBeDefined();
expect(provider?.id).toBe("openai");
});
expect(provider).toBeDefined();
expect(provider?.id).toBe("openai");
expect(provider?.capabilities).toContain("image");
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/media-understanding/provider-registry.test.ts
Line: 99-103

Comment:
**Minor test inconsistency — missing capabilities assertion**

The `openai-codex` test asserts `provider?.capabilities` (line ~82: `expect(provider?.capabilities).toContain("image")`), but the `github-copilot` test only checks `provider?.id`. Both tests use the same mock provider data, so the assertion would trivially pass. Adding it would keep the two tests symmetric and make the intent clearer.

```suggestion
    expect(provider).toBeDefined();
    expect(provider?.id).toBe("openai");
    expect(provider?.capabilities).toContain("image");
```

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@YoungMoneyInvestments
Copy link
Copy Markdown
Author

Fixes #53708 — this PR adds the missing normalization rules so openai-codex and github-copilot resolve to the openai media-understanding provider. Also related to #55237 and #56266 (same class of provider-registry lookup failure).

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c597477199

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +19 to +20
if (normalized === "openai-codex" || normalized === "github-copilot") {
return "openai";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep codex/copilot IDs for media execution auth

Do not collapse openai-codex/github-copilot to openai in this shared normalizer, because runProviderEntry uses the normalized value as the actual execution/auth provider (src/media-understanding/runner.entries.ts:432-500). With this change, a media entry configured as openai-codex now resolves auth as openai, so users who only have Codex OAuth (or Copilot token auth) can no longer run media understanding even though their provider is configured. The aliasing is safe for registry lookup, but here it rewrites runtime provider identity and breaks credential/model resolution paths.

Useful? React with 👍 / 👎.

@jzakirov
Copy link
Copy Markdown
Contributor

+1, waiting for this bug fix to land in main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants