fix(evals): use cancel endpoint for evaluation runs - #3812
fix(evals): use cancel endpoint for evaluation runs#3812arvindg-openai wants to merge 2 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9019df92c1
ℹ️ 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".
| raise ValueError(f"Expected a non-empty value for `run_id` but received {run_id!r}") | ||
| return self._post( | ||
| path_template("/evals/{eval_id}/runs/{run_id}", eval_id=eval_id, run_id=run_id), | ||
| path_template("/evals/{eval_id}/runs/{run_id}/cancel", eval_id=eval_id, run_id=run_id), |
There was a problem hiding this comment.
Regenerate the API contract alongside this route change
When the full ./scripts/test suite runs, it starts Steady from the checked-in api_reference/openapi.transformed.yml, where cancelEvalRun is still defined as POST /evals/{eval_id}/runs/{run_id}. Consequently, the existing sync and async cancellation tests in tests/api_resources/evals/test_runs.py now request an unmatched /cancel route and fail, while the new isolated MockTransport tests conceal the contract mismatch; api.md also continues documenting the old path. Update the generation source and regenerate the contract, generated client, tests, and documentation together.
AGENTS.md reference: AGENTS.md:L3-L8
Useful? React with 👍 / 👎.
Changes being requested
Append
/cancelto the request path in bothRuns.cancelandAsyncRuns.cancel. They currently send POST requests to/evals/{eval_id}/runs/{run_id}.Add mocked HTTP transport regressions that assert the POST method and full cancellation URL for synchronous and asynchronous clients, including parsed, raw, and streaming response modes. All six cases fail before the endpoint correction and pass afterward.
Additional context & links
The curl example in the public Cancel an eval run reference uses
/evals/{eval_id}/runs/{run_id}/cancel. The endpoint heading on that page currently omits/cancel; this change follows the HTTP example.The resource file is generated. Please incorporate the endpoint correction into the generation source so subsequent regeneration retains it. This PR preserves the method signatures, options, and response types.
Validation
.venv/bin/python -m pytest tests/test_eval_run_cancel.py -q -n 0: 6 passed; the same tests fail against the original code..venv/bin/ruff check .: passed..venv/bin/ruff format --check src/openai/resources/evals/runs/runs.py tests/test_eval_run_cancel.py: passed.git diff --check: passed.The unchanged checkout reports a stale lockfile under
uv sync --locked --all-extras. Tests used the exact committed dependencies installed withuv sync --frozen --all-extras; no dependency or lockfile changes are included.