Last reviewed: 2026-06-08
Direct answer
Before a coding agent posts a code change, collecting review evidence from more than one model reduces the risk that a single model’s blind spots reach your main branch. The practical workflow is:
- Route all review calls through a single gateway endpoint (such as the CometAPI chat completions or responses endpoint) so every model call is logged in one place.
- Run at least two model calls per diff — one for correctness and one for security or style — and capture each response as a structured record.
- Attach the evidence records to the pull request description or as PR comments before the agent requests human review.
- Gate the PR merge on the presence of evidence records that confirm each review step ran.
Verify the exact endpoint paths, request fields, and response structures in the linked sources before using them in production. Exact field names and auth schemes must be confirmed against current docs.
For broader release checks, see AI Coding Agent Setup, Security, and Model Routing .
Who this is for
This guide is for engineers and platform teams who:
- Run a coding agent (such as OpenAI Codex, Claude Code, or a similar tool) that opens pull requests autonomously or semi-autonomously.
- Need a reproducible evidence trail showing that each PR was reviewed by more than one model before it reached human review.
- Want to integrate that evidence collection with an OpenAI-compatible model gateway so review calls are observable, cost-trackable, and recoverable after a channel failure.
- Need to explain to teammates or auditors which models reviewed a change and what each one returned.
If you are setting up the gateway itself from scratch, see Route Coding Agent Model Calls Without Endpoint Drift first.
Key takeaways
- Multi-model evidence is a record of what each model returned for a specific diff, not a consensus vote. Store each response separately.
- Route review calls through a single gateway so you get one log entry per model call, not per model vendor.
- A PR that carries no evidence records should be treated as unreviewed, regardless of how many commits it contains.
- The smoke-test workflow below covers the minimum assertions an operator should make when setting up evidence collection for the first time.
- Exact endpoint paths, auth header names, request body fields, response formats, and model identifiers must be verified in the linked sources before you rely on them in production code.
Smoke-test workflow
Setup assumptions
- You have a gateway account with an API key stored in an environment variable (for example REVIEW_GATEWAY_KEY). Never hard-code credentials.
- You have a target endpoint URL stored separately (for example REVIEW_GATEWAY_BASE_URL). Verify the current base URL and endpoint path in the CometAPI docs before sending requests. See CometAPI chat completions reference and CometAPI responses endpoint reference.
- You have a small test diff that is safe to send to an external API — no secrets, no proprietary business logic, no PII.
- Your agent opens PRs via the standard GitHub pull request workflow. See GitHub pull requests documentation for the PR creation API and review request API contract areas to verify.
Happy-path plan
- Send the test diff to the gateway chat completions endpoint with a system prompt instructing the model to review for correctness. Use a placeholder model identifier that you have confirmed exists in the current model list at CometAPI models overview. Do not use a model ID that is not listed there.
- Capture the response body. Verify it contains the expected output field (check current field names in the docs — do not assume they match OpenAI’s format without verification).
- Send the same diff to the gateway a second time with a different system prompt (for example, security review). This can use the same or a different model — confirm availability before committing to a specific identifier.
- Capture the second response body.
- Attach both response records to the PR. A minimal attachment is a JSON object with: { “review_step”: “”, “model_requested”: “”, “gateway_request_id”: “”, “outcome_summary”: “”, “ran_at”: “” }.
- The PR description or a PR comment must contain a section titled ## Review evidence with one record per model call.
- Create a draft PR using the GitHub API or gh CLI and confirm the evidence section is present before marking the PR as ready for review.
Error-path check
- Send a request with an invalid or missing authorization header. Confirm the gateway returns a non-2xx status code. Record the status code in your test log.
- Send a request with a model identifier you have not confirmed. Check whether the gateway returns a clear error or falls back silently. Record the behavior. If silent fallback is possible, add an assertion that the response identifies which model actually ran. Verify fallback behavior in the CometAPI help center documentation at https://apidoc.cometapi.com/support/help-center .
- Simulate a missing gateway response (for example, by using a bad URL) and confirm your agent does not open the PR when evidence collection fails. The PR should remain in draft or not be opened at all.
Minimum assertions
- Each review call returns HTTP 2xx.
- The response body can be parsed as JSON.
- The response contains an output or message field with non-empty content (verify the exact field name in the current docs).
- The evidence record attached to the PR contains a ran_at timestamp and a non-empty outcome_summary.
- The PR has at least two evidence records before it is marked ready for review.
Pass/fail logging fields
Record the following fields after each smoke-test run:
smoke_test_run_id: ran_at: gateway_base_url_verified: true/false model_identifier_confirmed: true/false review_call_1_http_status: review_call_1_response_parseable: true/false review_call_2_http_status: review_call_2_response_parseable: true/false evidence_records_attached: pr_opened_without_evidence: true/false error_path_auth_fail_status: notes:
What the smoke test must not assert
- Do not assert specific pricing, token counts, or billing amounts. These are account-specific and subject to change. Verify cost-related information at CometAPI pricing documentation before budgeting for review calls.
- Do not assert that a specific model is always available. Model availability can change. Check the current model list before hardcoding identifiers.
- Do not assert specific latency targets. Latency is not guaranteed.
- Do not assert the exact response field name without checking the current docs — field names can differ between the chat completions and responses endpoints.
Log-record template
Use this template to record evidence after each review call. Replace all placeholder values with real values at runtime. Never commit real credentials, full prompts, or full generated responses to the repository.
{
"evidence_schema_version": "1.0",
"run_id": "<your-run-id-placeholder>",
"pr_ref": "<branch-name-placeholder>",
"review_steps": [
{
"step": "correctness-review",
"model_requested": "<model-id-placeholder>",
"gateway_endpoint": "<endpoint-path-placeholder>",
"http_status": 200,
"response_parseable": true,
"outcome_summary": "<first-100-chars-placeholder>",
"ran_at": "<iso-timestamp-placeholder>"
},
{
"step": "security-review",
"model_requested": "<model-id-placeholder>",
"gateway_endpoint": "<endpoint-path-placeholder>",
"http_status": 200,
"response_parseable": true,
"outcome_summary": "<first-100-chars-placeholder>",
"ran_at": "<iso-timestamp-placeholder>"
}
],
"pr_evidence_attached": true,
"operator_notes": "<free-text-placeholder>"
}
Connecting evidence to the PR workflow
The OpenAI Codex AGENTS.md documentation (https://github.com/openai/codex/blob/main/docs/agents_md.md ) describes how coding agents read repository instruction files to understand workflow rules. You can add a rule to your AGENTS.md (or equivalent instruction file) that requires evidence records to be present before any PR is opened. This makes the evidence requirement part of the agent’s operating instructions rather than an external check that might be skipped.
The GitHub pull requests documentation (https://docs.github.com/en/pull-requests ) covers the PR creation API, review request endpoints, and PR comment endpoints you need to attach evidence programmatically. Verify current API paths and authentication requirements there before building the attachment step.
For agents that call a model gateway to perform reviews, the CometAPI chat completions endpoint (https://apidoc.cometapi.com/api/text/chat ) and responses endpoint (https://apidoc.cometapi.com/api/text/responses ) are the two primary interface contracts to verify. Both use the standard OpenAI-compatible interface, but exact field names, auth header format, and error response shapes must be confirmed in the current docs rather than assumed from memory.
If you need to route review calls through CometAPI and want context on how the gateway handles multi-model routing, see Route Coding Agent Review Calls Through CometAPI Without Losing Context.
To understand what the responses endpoint specifically requires when your coding agent calls a gateway, see How to Check the Responses Endpoint When Your Coding Agent Calls a Gateway.
Failure modes
- Evidence gap: the agent cannot inspect the failing log, source page, pull request, or local command output. The safe action is to stop and record the missing evidence instead of guessing.
- Scope drift: the agent edits files that are not connected to the observed failure. Keep the repair tied to the failing signal and leave unrelated cleanup for a separate task.
- Environment mismatch: the local check uses different versions, credentials, feature flags, or runtime settings than the hosted path. Record the mismatch before treating the result as proof.
- Unreviewed fallback: the agent changes models, endpoints, permissions, or retry behavior to make a run pass without preserving the review boundary. Treat access and provider failures as operational blockers, not topic failures.
- Weak handoff: the final note says the issue is fixed but omits the command, result, changed files, and remaining uncertainty. That makes the next operator repeat the investigation.
Sources checked
- OpenAI Codex AGENTS.md guidance - accessed 2026-06-08; purpose: verify repository instruction-file context for coding agents.
- GitHub pull requests documentation - accessed 2026-06-08; purpose: verify pull request review and collaboration boundaries.
- CometAPI documentation - accessed 2026-06-08; purpose: verify current CometAPI documentation navigation.
- CometAPI chat completions reference - accessed 2026-06-08; purpose: verify chat completion contract areas.
- CometAPI responses reference - accessed 2026-06-08; purpose: verify responses endpoint contract areas.
- CometAPI help center - accessed 2026-06-08; purpose: verify support and escalation documentation areas.
Contract details to verify
| Area | What to verify | Source URL | Accessed | Safe candidate wording |
|---|---|---|---|---|
| Chat completions endpoint path | Exact URL path and HTTP method for submitting a chat completion request | https://apidoc.cometapi.com/api/text/chat | 2026-06-08 | “Verify the current endpoint path in the CometAPI chat completions docs before sending requests.” |
| Responses endpoint path | Exact URL path and HTTP method for the responses interface | https://apidoc.cometapi.com/api/text/responses | 2026-06-08 | “Verify the current endpoint path in the CometAPI responses docs before sending requests.” |
| Auth header format | Whether the gateway uses Authorization: Bearer or another header scheme | https://apidoc.cometapi.com/api/text/chat | 2026-06-08 | “Check the current auth header name and format in the docs; do not assume it matches OpenAI’s format.” |
| Response output field name | Name of the field in the response body that contains the model’s output text | https://apidoc.cometapi.com/api/text/chat | 2026-06-08 | “Verify the exact output field name in the current docs before parsing responses.” |
| Error response shape | HTTP status codes and error body fields returned for auth failures, bad model IDs, and gateway errors | https://apidoc.cometapi.com/support/help-center | 2026-06-08 | “Verify error response fields in the help center docs before writing error-handling code.” |
| PR creation and comment API | GitHub API paths for creating PRs and attaching PR comments programmatically | https://docs.github.com/en/pull-requests | 2026-06-08 | “Verify current GitHub PR API paths and auth requirements in the GitHub docs before building attachment code.” |
| AGENTS.md instruction file scope | Which agent tools read AGENTS.md and how instruction rules are enforced | https://github.com/openai/codex/blob/main/docs/agents_md.md | 2026-06-08 | “Check the current AGENTS.md docs for the specific tools and versions that honor repository instruction files.” |
Reader next step
Compare the workflow against Start with CometAPI .
Use AI Coding Agent Setup, Security, and Model Routing as the next comparison point. Keep Triage CI Failures With a Coding Agent Without Losing the Evidence nearby for setup and permission checks.
FAQ
Why collect evidence from more than one model instead of just the best one?
Different models have different strengths and blind spots. A model that is strong at correctness reasoning may miss a common security anti-pattern that a second model trained on security data catches. Collecting both responses and attaching them to the PR lets a human reviewer see where the models agree and where they diverge, which is more informative than a single verdict.
Does the evidence need to be stored in the repo?
No. The evidence records need to be readable by the human reviewer at review time. Attaching them as PR comments or to the PR description is sufficient. Storing them in the repo as committed files is an option but adds noise to the commit history. Use whichever approach matches your team’s review workflow.
What if the gateway returns a non-2xx status during evidence collection?
The agent should not open the PR in a ready-for-review state. It should either retry (if the error is transient), leave the PR in draft with a note about the failed review step, or surface the error to an operator. Never silently skip evidence collection and open the PR as if all reviews passed. For guidance on gateway error handling, verify current behavior in the CometAPI help center documentation.
Can I reuse the same model twice with different prompts and call that multi-model review?
Two calls to the same model with different prompts is better than one call, but it is not the same as routing through two independent models. The value of multi-model evidence comes from model diversity. If cost or availability limits you to one model, document that constraint in your evidence record so reviewers know.
How do I confirm which models are currently available through the gateway?
Check the CometAPI models overview for the current list. Do not rely on documentation or code from a previous session — model availability can change. Verify the identifier before each new deployment.
Where can I get support if the gateway is behaving unexpectedly?
Start with the CometAPI help center for error codes, maintenance windows, and escalation paths. For multi-model gateway setup questions, Start with CometAPI to explore current account and support options.