Skip to content
This repository was archived by the owner on Jul 3, 2026. It is now read-only.

Add Codex reasoning effort routing#57

Merged
Pigbibi merged 1 commit into
mainfrom
codex/reasoning-effort-routing
Jul 3, 2026
Merged

Add Codex reasoning effort routing#57
Pigbibi merged 1 commit into
mainfrom
codex/reasoning-effort-routing

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary\n- add hard override and task-complexity routing for VPS Codex reasoning effort\n- pass model_reasoning_effort through service adapters and deployment env\n- keep compatibility deployment channel in sync with AIAuditBridge\n\n## Tests\n- python3 -m ruff check scripts/codex_audit_service.py service/ai_gateway_service.py service/adapters/codex_adapter.py tests/test_codex_audit_service_complexity.py\n- python3 -m py_compile scripts/codex_audit_service.py service/ai_gateway_service.py service/adapters/codex_adapter.py\n- bash -n scripts/deploy_codex_audit_service.sh\n- python3 -m unittest discover -s tests -v

Co-Authored-By: Codex <noreply@openai.com>
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

🤖 Codex PR Review

⚠️ Review skipped: The Codex review could not be completed.

Codex service request failed: 401 {"error": "OIDC workflow_ref is not allowed"}

Please ensure a human reviewer checks this PR before merging.

@Pigbibi Pigbibi merged commit 93f8032 into main Jul 3, 2026
4 checks passed
@Pigbibi Pigbibi deleted the codex/reasoning-effort-routing branch July 3, 2026 07:58

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

Copy link
Copy Markdown

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: 58b672ffda

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +379 to +386
def _resolve_reasoning_effort(payload: dict[str, Any], task: str) -> str:
requested = _normalize_reasoning_effort(str(payload.get("reasoning_effort") or ""))
if requested and requested != "auto":
return requested

configured = _normalize_reasoning_effort(os.environ.get("CODEX_AUDIT_SERVICE_REASONING_EFFORT", ""))
if configured and configured != "auto":
return configured

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 Honor the service override before caller input

When CODEX_AUDIT_SERVICE_REASONING_EFFORT is set to enforce a VPS-wide effort policy, this branch returns a caller-supplied reasoning_effort before checking the configured value, so any authorized request can bypass the documented hard override and force a different Codex effort/cost profile. Check the service env override first and only use payload/complexity routing when it is unset or auto; the same precedence issue exists in service/ai_gateway_service.py.

Useful? React with 👍 / 👎.

Comment on lines +311 to +314
if effort not in CODEX_REASONING_EFFORTS:
raise ValueError(
f"reasoning_effort must be one of auto,{','.join(sorted(CODEX_REASONING_EFFORTS))}"
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fail async jobs on invalid reasoning effort

If a request or service env contains an invalid reasoning effort, this ValueError is raised from _run_job_background after the job has already been marked running, but that worker only catches RuntimeError, subprocess errors, and OSError. The thread exits without _update_job(..., "failed"), leaving clients polling a permanently running job and duplicate submissions deduped until cleanup; validate before queuing or catch ValueError in the worker.

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant