Skip to content

fix(gatekeeper): use OpenAI-compatible structured output schema and relax OpenRouter routing - #647

Open
Jazzcort wants to merge 1 commit into
rhel-lightspeed:mainfrom
Jazzcort:fix-response-format-issue
Open

Jazzcort wants to merge 1 commit into
rhel-lightspeed:mainfrom
Jazzcort:fix-response-format-issue

Conversation

@Jazzcort

@Jazzcort Jazzcort commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

OpenAI requires all fields in structured output schemas to be listed as required. Add a dedicated schema variant and use it for OpenAI-routed models. Also default require_parameters to false to avoid OpenRouter filtering out providers that don't advertise support for every parameter.

…elax OpenRouter routing

OpenAI requires all fields in structured output schemas to be listed as
required. Add a dedicated schema variant and use it for OpenAI-routed
models. Also default require_parameters to false to avoid OpenRouter
filtering out providers that don't advertise support for every parameter.
@Jazzcort
Jazzcort requested a review from a team as a code owner October 7, 2026 19:34
@codecov

codecov Bot commented Oct 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 98.45% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...rc/linux_mcp_server/gatekeeper/check_run_script.py 100.00% <100.00%> (ø)
src/linux_mcp_server/gatekeeper/openai_client.py 100.00% <ø> (ø)
...c/linux_mcp_server/gatekeeper/openrouter_client.py 100.00% <100.00%> (ø)
tests/gatekeeper/test_check_run_script.py 100.00% <100.00%> (ø)
tests/gatekeeper/test_openrouter_client.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Jazzcort Jazzcort left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just some notes there for the detail of the decision I made. 😁

class GatekeeperResult(BaseModel):
status: GatekeeperStatus
detail: str = ""
detail: Annotated[str, BeforeValidator(_empty_string_if_none)] = ""

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

With this we can eliminate the "" or None situation. Let me know ifstr | None is preferred more. 😁


class OpenRouterProvider(BaseModel):
require_parameters: bool = True
require_parameters: bool = False

@Jazzcort Jazzcort Oct 7, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This change is because it strictly forces the parameters we provide in the request to match the supported parameters in the model's metadata.
As we can see here in https://openrouter.ai/api/v1/parameters/openai/gpt-5.2, temperature is not listed so when our request contains it with require_parameters=True we will hit a API error from OpenRouter.

I think we don't have to force the parameters we provide to strictly match what the model supports since usually those not supported parameters will be ignored gracefully. What do you think @owtaylor?

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant