Repository navigation
feat(model): forward the effort of a Messages request when configured - #6904
alexandery-nvidia wants to merge 20 commits into
Conversation
The model server answers a streamed /v1/messages request only when the whole generation has returned, so the client receives no byte until then. Claude Code 2.1.312 gives a request up after about 360 seconds without a response byte and sends it again. API_TIMEOUT_MS does not lengthen that wait. A longer generation therefore runs twice, and the answer of the first run is lost. A stream that is open and then silent is given up after 300 seconds. A stream that carries a ping event every 15 seconds is kept for as long as the events come. stream_keepalive_s now applies to /v1/messages as it does to /v1/responses. A call that is still running after one interval opens the stream with a ping event and sends another at every interval. The events of the message follow unchanged. A call that ends within the first interval is served as before, so its failure keeps its HTTP status. A call that fails after the stream has opened ends it with an error event. Its type is invalid_request_error for a refusal that the server propagates and for another 4xx status, rate_limit_error for 429, and api_error otherwise. Claude Code answers an error event that precedes message_start by sending the request once more with "stream": false, and that request gets the HTTP status. No event can hold that request open: Claude Code gives it up after about 300 seconds without a response. A client that leaves cancels the backend call, in the first interval and after the stream has opened, as for /v1/responses. A server whose response ids come from an upstream Responses API refuses the setting at startup, as before, so it holds no Messages stream open either. Model-call capture does not count a ping event as the first token. The checkpoint gate of a policy model server does not take a ping event for the start of the answer. As after the lifecycle events of a /v1/responses stream, a checkpoint holds such a call instead of waiting for it, and the ledger row of the call is published when the message starts. Signed-off-by: alexandery <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
The Anthropic Messages route of a model server converts a request to the Responses API and calls the server's own `responses()`. The conversion dropped `output_config.effort`, so the reasoning effort of a Claude Code session never reached the backend, where a /v1/responses request with `reasoning.effort` reaches the engine as `reasoning_effort`. A model server now has the setting `forward_anthropic_reasoning_effort`. With it, the conversion states the effort as the Responses `reasoning.effort`, and the Chat Completions conversion sends it to the engine as it does for a Responses request. The setting is off by default, which keeps the effort dropped: Claude Code states an effort in every request, `high` unless it is configured otherwise, and an engine can refuse a level that it does not serve. Signed-off-by: alexandery <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
/ok to test 2ac97e4 |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE. I found three RISK issues, with no BLOCKER.
I reviewed all 13 changed files and connected callers with three delegated reviewers. The normal effort-forwarding path works, and the streaming probes found no backend-task leak or premature checkpoint publication. The findings concern late-error attribution, lost failure reports and an unsupported forwarding configuration.
Validation:
- I relied on head CI run
46111777187: all four core shards, all eight server-suite shards,Unit tests / Test,Unit tests / Combined core coverageandUnit tests / Server suitepassed. Lint passed. Changed-server and session-routing jobs were skipped. The overall run is red because non-blocking conformance/compliance checks failed; I did not attribute those failures to this diff. - CPU probes ran in
766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:ba3eeeb0a60df9a7cd3bb9d2c1f36cabb0a493b5, the default branch’s CI image because the head had no successful container-build check. WithPYTHONPATHpointing to the admitted checkout,leader/concurrent_messages.pypassed 32 concurrent effort/keepalive requests. Delegated probes covered backend mappings, SDK parsing, disconnect cleanup, capture timing and checkpoint hold/resume. Error probes reproduced the findings below, including a base-versus-head comparison for failure-report loss. - I did not rerun the CI suites or run a real model/GPU workload. Claude Code’s documented long-duration retry timing was not exercised.
Inline comments (escaped v1):
-
nemo_gym/models/model_call_capture.pyline 1129: RISK: Preserve the backend failure category after Messages pings.The new late-error branch returns HTTP 200 plus an Anthropic error event, so this fallback now labels a delayed upstream 422 as
upstream_errorinstead ofclient_error. My route-levelcapture-checkpoint-1/recovery_probe.pyreproduced that change. After normalizing the captured record,is_server_fault_callalso changed from false to true for the same invalid request.This affects captured Messages calls with keepalives enabled, especially adapters without separate execution metadata. Recovery treats
upstream_erroras an evaluation-side fault, so request duration can change timeout attribution.Could you retain the original status/category in request state or terminal metadata and use it before the generic SSE fallback? Keep the required HTTP-200-plus-error-event wire behavior and adapter-specific propagation policy. Acceptance: delayed 400/422, 429 and 5xx cases should retain the same capture category and recovery responsibility with keepalives disabled or enabled, including a shared non-vLLM adapter.
-
nemo_gym/models/base_responses_api_model.pyline 1029: RISK: Carry the structured failure report on the terminal Messages event.This conversion keeps only the exception’s type/message after headers have gone out. Unlike the sibling Responses/Chat keepalive paths, it does not retain the request failure log or serialize its final report.
I ran
leader/messages_failure_report.pyagainst base and head. Base preserved the known model failure ID inX-NG-Failure-Report; head with a short keepalive interval carried it in neither headers nor SSE. The same loss occurs for recovered-attempt observations before a successfulmessage_stop. A direct terminalNgFailureEventalso disappears from capture when it was not independently observed; an already-observed event can survive locally but loses its selected terminal identity.Could you preserve the bounded report, including the caught exception, on the terminal
errorormessage_stopevent and in local capture? Extend the stream reader and captured-report consumption for Messages, rather than adding an unread field. Preserve ping framing, fast-error HTTP statuses, cancellation cleanup and propagation of capture-finalization errors. Acceptance: explicit failure IDs/causes survive late failures and recovered-success cases through both the receiving reader and capture; oversized reports retain the existing omitted marker. -
responses_api_models/vllm_model/app.pyline 906: RISK: Reject effort forwarding for the Completions backend.The new
forward_anthropic_reasoning_effortoption is accepted withuse_completions_api: true, but the Completions request builder dropsreasoning_effort. Ineffort-conversion-1/probe.py, streamed and non-streamed/v1/messagesrequests withoutput_config.effort: maxreturned 200 while the fake engine received onlymax_tokens,modelandprompt.Operators who enable the flag therefore still run without the requested effort on this backend, contrary to the new option’s documented behavior. This is limited to the opt-in combination; default-off behavior is unchanged.
Could you extend the existing incompatibility validation here to reject the new flag when the Completions backend is selected, and document that limitation? Acceptance: the unsupported combination rejects before serving, Completions with forwarding disabled still works, Chat/Responses-backed forwarding stays supported, and configured sampling overrides keep their existing precedence.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
A streamed /v1/messages call that outlasts one interval of stream_keepalive_s opens its stream with a ping event, so its HTTP headers go out before the backend call ends. The failure that ended such a call, and the failures that the call observed, were then not reported to the client: the failure header was already sent, and the stream carried no failure report. A keepalive /v1/responses stream and a streamed chat completion carry the report on their terminal event in that case. The terminal event of a Messages stream that ping events opened now carries the request's failure report in the same field, nemo_gym_failure_report: the error event of a call that failed, and message_stop of a call that answered. The report selects the failure that ended the call and holds the failures that the call observed, such as an attempt that a retry replaced. A request with nothing to report sends its events unchanged. StreamFailureReportReader accepts a report on these two event types. Rollout collection reads the report from a captured Messages stream as it does for the two other dialects, so the events reach the rollout's row. The function that adds the report to an event takes the event types from the reader, so they are stated once. Signed-off-by: alexandery <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
This branch is stacked on alexandery/messages-stream-keepalive. The merge brings in that branch's commit "fix(model): carry the failure report on a keepalive Messages stream", so the terminal event of a Messages stream that ping events opened carries the request's failure report here too. Signed-off-by: alexandery <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
The conversion of a Messages request read `output_config.effort` before it checked whether the effort is forwarded. A request whose `output_config` is not an object, such as a string or a list, therefore failed with an AttributeError and HTTP 500 on a model server that drops the effort, where the field was ignored before the setting existed. The conversion now reads `output_config` only with `forward_anthropic_reasoning_effort`. Without the setting, the field is ignored whatever its value is. Signed-off-by: alexandery <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
vllm_model accepted `forward_anthropic_reasoning_effort` together with `use_completions_api`. A /v1/completions request has no `reasoning_effort`, so the server answered a Messages request with HTTP 200 and sent the engine no effort, although the setting says that the effort is forwarded. The configuration now refuses the combination at startup, with the check that already refuses `forward_unvalidated_reasoning_effort` with `use_completions_api` for the same reason. The documentation of the setting states the requirement. Signed-off-by: alexandery <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
/ok to test a0114ee |
|
Replies to the three findings of the automatic review of this pull request. The capture record of a call that fails after the first I reproduced this: a 422 or a 429 that the backend raises after the first The code is the keepalive path of #6903, and it is not changed there either. A What #6903 now changes is the failure report: commit 2477ee8 puts it on the terminal Messages event, so a typed failure keeps its id, kind and HTTP status on the wire and in the rollout row. The failure report on the terminal Messages event. I reproduced this: after a This is the keepalive path of #6903 and is fixed there in commit 2477ee8, which this branch holds through the merge c4139f4. The terminal event ( No separate case for an oversized report was added: the Messages route calls the same The setting together with the Completions API. I reproduced this: with Commit a0114ee refuses the combination when the configuration is validated, with the check that already refuses |
|
/review reset=true |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE. Two prior RISK findings remain, plus one new NOTE; I found no BLOCKER.
I reviewed all 18 changed files and connected consumers with three delegated reviewers. Compared with review 6096170678 at 2ac97e43866feb8665f2d89e894ebcbe9fb365dc, the Completions incompatibility is fixed. Terminal failure reports now survive Messages SSE and reach episode observations. Backend-error attribution is still wrong after pings, and the terminal failure is still missing from the individual call's report.
Validation:
- I relied on head CI run
46429399907: all eight server-suite shards and their aggregate passed; core shards 1–3, Sandbox tests and LongMT scoring passed. Lint passed. Core shard 0 failed with1 failed, 6538 passed, 22 skipped;Unit tests / TestandNemo_CICD_Testare red, and combined core coverage was skipped. Changed-server and session-routing jobs were skipped. Non-blocking compliance/conformance checks also failed. - The core failure is
TestDispatchBudget::test_a_row_the_budget_runs_out_on_while_its_reservation_waits_is_drained_unreserved[deadline], withposted == []rather than[0]. That test and its implementation are unchanged from base. A focusedpytestrun of that exact test with--cpu -o addopts='' -p no:cacheproviderpassed once. I have not established the CI failure's cause or a matching upstream failure, so CI is not validated green. - CPU probes used
766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:ba3eeeb0a60df9a7cd3bb9d2c1f36cabb0a493b5, the default branch's CI image because the admitted head had no container-build check. Imports were bound to the admitted checkout.current-review/concurrent_messages.pypassed 32 concurrent requests.effort-reset-1/probe.pyverified backend mappings and configuration precedence.current-review/status_matrix.pyandcapture-reset-1/per_call_probe.pyreproduced the two RISK findings. Checkpoint hold/resume, byte-fragmented reports, SDK parsing and disconnect cleanup probes passed.messages-reset-1/error_types_probe.pyreproduced the NOTE. - I did not rerun passing CI suites or exercise a real model/GPU workload or Claude Code's long-duration retry behavior.
Inline comments (escaped v1):
-
nemo_gym/models/model_call_capture.pyline 1131: RISK: Preserve the backend failure category after Messages pings.The new late-error path returns HTTP 200, so this fallback still records every terminal
errorasupstream_error. The added structured report does not correct that category. My current route/capture probe (current-review/status_matrix.py) records the same upstream 422 asclient_errorwithout keepalives andupstream_errorafter a ping; normalizedis_server_fault_callchanges from false to true. A 429 similarly changes fromrate_limittoupstream_error.This affects captured Messages calls, particularly shared adapters without separate upstream execution metadata. Recovery checks this category before the typed events, so request duration can change whether an agent timeout has evaluation-side fault evidence.
Could you retain the original backend status/category in request state or terminal metadata and prefer it before this fallback? Preserve HTTP-200 SSE behavior and each adapter's propagation policy. Acceptance: delayed 400/422, 429 and 5xx cases retain equivalent capture categories and recovery responsibility with keepalives off/on, including a non-vLLM adapter.
-
nemo_gym/models/model_call_capture.pyline 711: RISK: Keep the terminal failure report on the individual call.The wire-report fix works, but this capture projection still loses a direct terminal
NgFailureEventraised after a ping unless it was independently observed. The route catches the exception,_stream_reportconstructs a reply without updating the request log, and_recordlater receives nofailure.My current
capture-reset-1/per_call_probe.pyreads the correct selected ID from terminal SSE, but the attached call hasfailure_report.events == {}andfailure_id == null; call-level health recovery observations are also absent. The new raw-SSE merge recovers the event only for the enclosing episode. Default serialization then dropsresponse_raw, leaving saved call/trajectory consumers without the failure association.Could you carry the terminal exception/report into per-call capture, or merge the terminal report into the call before serialization? Preserve its selected ID and causal closure on the call, while continuing to treat it only as an observation at episode scope. Acceptance: a direct unobserved terminal
NgFailureEventretains its ID/causes in SSE, raw capture, attached call and trajectory metadata; recovered success has observations but no final ID, and the episode's independently selected failure stays unchanged. -
nemo_gym/models/base_responses_api_model.pyline 1062: NOTE, suggestion: retain specific Anthropic error types.This fallback maps a delayed upstream 401/403/404 to
invalid_request_errorand 529 toapi_error. Mymessages-reset-1/error_types_probe.pyreproduced this through/v1/messages; base kept the original HTTP statuses. The installed Anthropic schema distinguishesauthentication_error,permission_error,not_found_errorandoverloaded_error, so clients inspecting the terminal type lose that distinction after a ping.Could you map those four statuses explicitly before the fallback? Keep status-hiding adapters generic, 429 as
rate_limit_error, and refusals asinvalid_request_error. Extend the existing late-error route cases for bothHTTPExceptionand propagatedClientResponseError, while retaining fast HTTP-error behavior. I did not confirm an affected Claude Code retry decision; this is a non-blocking API-accuracy suggestion.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
|
Thanks for the review. Both points are in work: a refusal of |
main changed six files that this branch also changes, and Git merged each of them without a conflict. In nemo_gym/models/base_responses_api_model.py main imports chat_stream_error_message on the lines below the import that this branch extends with ANTHROPIC_PING_SSE. The merge keeps both. The lines that this branch adds and removes against main are the same as before the merge. Signed-off-by: alexandery <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
main added a check to the configuration validator of responses_api_models/vllm_model/app.py that refuses translate_none_reasoning_effort together with use_completions_api. It stands directly below the check of forward_unvalidated_reasoning_effort, which this branch turned into a loop over that option and forward_anthropic_reasoning_effort. The merge keeps both: the loop of this branch, followed by the check that main added. The lines that this branch adds and removes against the keepalive branch are the same as before the merge. Signed-off-by: alexandery <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
base_model inherits forward_anthropic_reasoning_effort and sends every request to /v1/completions, which has no reasoning_effort. With the setting on, a Messages request that states an effort was answered with 200 and the effort was missing from the request to the backend. BaseResponsesAPIModelConfig now has reasoning_effort_unsupported_reason, which returns None by default, and one validator that refuses forward_anthropic_reasoning_effort at startup with the reason that the method returns. A configuration whose server sends its backend no reasoning effort overrides the method. base_model does, and so does agentic_if_text, which sends the effort of its own reasoning_effort setting and never reads the effort of a request. The tests construct each of the two configurations with the setting on and expect the refusal. A test of the base class does the same with a configuration that overrides the method. Signed-off-by: alexandery <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
VLLMModelConfig refused forward_anthropic_reasoning_effort whenever use_completions_api was on. With is_responses_native also on, a Messages request goes to /v1/responses, which takes reasoning.effort, so that server could apply the setting and did not start. The configuration now states its reason through reasoning_effort_unsupported_reason: the setting is refused only with use_completions_api=true and without is_responses_native=true, where a Messages request goes to /v1/completions. The check of its own in the validator is removed, so that validator is the one of main again. One test starts a server with all three settings on and expects the effort of a Messages request in the /v1/responses request. The other expects the refusal with use_completions_api alone. Signed-off-by: alexandery <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
The rule read that a model server which sends its backend no reasoning effort refuses forward_anthropic_reasoning_effort, and one page said that base_model and agentic_if_text send none. agentic_if_text does send an effort, the one of its own reasoning_effort setting. It refuses the setting because it never sends the effort of a request. The two pages, the description of the setting and the docstring of reasoning_effort_unsupported_reason now say that a server refuses the setting when it does not send its backend the reasoning effort of a request. Signed-off-by: alexandery <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
/ok to test 69d5809 |
|
/review reset=true |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
Changes requested:
- Delayed Messages errors become server-fault evidence, even for invalid requests.
- Terminal failures disappear from saved calls and trajectory metadata.
Inline comments (escaped v1):
-
nemo_gym/models/model_call_capture.pyline 1617: RISK (moderate risk)What I tested
I sent delayed 422 and 429 failures through/v1/messageson CPU, with keepalives off and on.What I found
The same 422 producesclient_error/server_fault=falsebefore pings andupstream_error/server_fault=trueafterward. The terminal-error fallback treats client errors as server faults, changing which side timeout recovery blames. A delayed 429 also losesrate_limit.What I recommend
Keep the backend status and category in request state, and prefer them here while preserving each adapter's error policy. Add delayed 422/429 tests that preserve capture categories and recovery decisions with keepalives off and on. -
nemo_gym/models/model_call_capture.pyline 1159: RISK (moderate risk)What I tested
I raised a terminalNgFailureEventwith one cause after a Messages ping on CPU.What I found
The stream carries both events, but per-call capture savesfailure_id=nullandevents={}. The route catches the exception, so capture never receives it. Default serialization drops the raw stream, leaving saved calls and trajectory metadata without those failures.What I recommend
Merge the terminal report into each call before serialization, keeping its selected ID and causes. Add a serialization round-trip test that preserves them without changing the episode's independently selected failure.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
A streamed /v1/messages request with stream_keepalive_s has sent its HTTP status 200 before its backend call ends, so a later failure reaches the client as an error event. Model-call capture saved every such call as upstream_error with no selected failure. A 422 or a 429 of the backend then counted as a server fault, a timeout lost its category, and a typed failure lost its id and its causes, while the same failure before the first ping event was saved with them. note_stream_failure stores the failure in the request state, where the capture middleware already reads what a route notes. For a call with a noted failure the middleware takes the category from the expression that it uses for a failure that a route raises (_classify_failure), passes the failure to the saved failure report, and saves the HTTP status of the backend as upstream_status_code where the adapter noted none. status_code stays 200, the status that the client received. The status of an HTTPException is this server's own and is not saved as the backend's. Only the Messages route notes its failure. The keepalive streams of /v1/responses and /v1/chat/completions are saved as before. The tests send the same failure before and after the first keepalive event through the middlewares that run_webserver installs, for a 422, a 429, the error that the model client raises with its observed attempt as cause, a timeout and a typed failure. They compare the category, the server fault, the status of the backend and the failure events of the saved rows, and they state which failure the late call selects. One test covers a late HTTPException, and one reads a typed failure back from the saved row and checks that the episode keeps its own selected failure. Signed-off-by: alexandery <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
The keepalive Messages branch now saves a failure that arrives after a ping event with the category, the status of the backend and the failure report of the failure. The merge brings that state. Git merged every file without a conflict, and the lines that this branch adds and removes against the keepalive branch are the same as before the merge. Signed-off-by: alexandery <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
With forward_anthropic_reasoning_effort on, the conversion of a Messages request reads the effort of output_config. An output_config that is not an object raised AttributeError there, and an effort that the pinned OpenAI SDK does not list failed the validation of the Responses request, so the route answered HTTP 500 without calling the backend. The route now validates output_config before the conversion when the setting is on (_validate_forwarded_output_config). A value that is neither null nor an object, and an effort outside the SDK's list, are refused with FastAPI's standard 422, as a /v1/responses body is. The error names output_config or output_config.effort as its location. With the setting off the field is not read, as before. The tests post three values that are no object and two efforts that are not listed, streamed and not streamed, and expect the 422, the location and no call of responses(). With the setting off the same three values are answered with 200. Signed-off-by: alexandery <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
/ok to test c13b0e8 |
|
Replies to the findings of this round. A and B concern the keepalive code of #6903 and are fixed by commit 0d83184 there, which this branch holds by a merge. C is fixed by commit c13b0e8 here. A late failure changes its saved classification. Reproduced through an app with the middlewares that A typed failure after a ping is missing from the saved call. Reproduced: a typed failure with one cause, raised after a ping, was saved with A malformed |
|
/review reset=true |
yaoyu-33
left a comment
There was a problem hiding this comment.
The startup checks now follow the route that actually serves Messages, and malformed output_config gets a 422 before the backend is called when forwarding is enabled. That addresses my review. I’m happy with the default-off behavior.
Please coordinate with #5962 on how vLLM should handle explicit effort together with thinking: {"type": "disabled"}. The rollout here covers the OpenAI-compatible endpoint. That specific vLLM combination still needs its own check.
|
On the coordination with #5962 for an explicit With vLLM at its Proposal: this PR merges as approved, because the setting is off by default, and one follow-up settles the combination together with @RyaliNvidia: the rule, tests for a request with |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
LGTM, but please take a look at the following findings:
Review generated by codex. This was a full review. Request a full review with /review reset=true.
| failure_status, _ = _exception_http_details(stream_failure) | ||
| error_category = _classify_failure(stream_failure, failure_status) | ||
| # The status of an HTTPException is this server's own; every other status is the backend's. | ||
| upstream_status = None if isinstance(stream_failure, HTTPException) else failure_status |
There was a problem hiding this comment.
RISK (moderate risk)
What I tested
I raised HTTPException(504) before and after a /v1/messages ping on CPU. I then serialized the captured call and ran the recovery predicates.
What I found
For model implementations raising this error, this assignment discards the only saved 504 status. Capture keeps HTTP 200 and timeout, so is_infrastructure_agent_timeout() changes from true to false. A server timeout can therefore be blamed on the model when an agent deadline expires.
What I recommend
Keep the server's failed status separately and let recovery read it. Add an early/late 504 test without labeling that status as the backend's.
There was a problem hiding this comment.
Reproduced. I built the app with the calls of run_webserver in its order and let the Messages route raise the same HTTPException before and after the first ping event. Only a 504 differs by default. Its category is timeout, which is no server-fault category, and the late call saved no status, so is_server_fault_call answered True before the stream opened and False after it. A 500, 502 or 503 is a server fault at both times through its category. A 408 or another 4xx is none at both times, but a by_status_code rule for such a status matched only the early call.
No model server in the repository raises an HTTPException with 504 or 408 today, so this was a gap in the contract of the saved call and not an observed failure.
Commit 7399b37 on #6903 closes it. Capture saves the status of such an exception as the new key local_status_code (nemo_gym/models/model_call_capture.py:1647 and :1175), and is_server_fault_call reads it as it reads status_code and upstream_status_code (nemo_gym/rollouts/rollout_recovery.py:323). The status is not saved as the backend's. Commit 284e90d compares the decisions before and after the ping event for a 504 and a 409, also under a by_status_code rule (tests/unit_tests/models/test_stream_failure_capture.py:220).
The line is #6903's, so the fix is pushed there. #6904 and #6905 take the commit when #6903 has merged and main is merged into them, so the two approved branches do not change now.
Signed-off-by: svcnemo-autobot <[email protected]>
|
/ok to test 803ae16 |
|
The repository's automation merged |
What does this PR do?
The Anthropic Messages route of a model server converts a request to the Responses API and calls the server's own
responses(). The conversion dropsoutput_config.effort. The reasoning effort of a Claude Code session therefore never reaches the backend, where a/v1/responsesrequest withreasoning.effortreaches the engine asreasoning_effort. This PR adds a setting that forwards the effort. It serves a run that setsreasoning_effortonclaude_code_agentand expects the engine to apply it.What changes:
forward_anthropic_reasoning_effort, off by default.output_configas the Responsesreasoning.effort. The Chat Completions conversion then sends it to the engine as it does for a Responses request.reasoningunset.base_modelandagentic_if_textalways refuse it.vllm_modelrefuses it where a Messages request goes to/v1/completions, which has noreasoning_effort: withuse_completions_api: trueand withoutis_responses_native: true.output_configis neither null nor an object, or whose effort the pinned OpenAI SDK does not list, is refused with HTTP 422. The error namesoutput_configoroutput_config.effort.claude_code_agentstate the setting.What does not change: without the setting the effort is dropped, and the conversion does not read
output_config, whatever its value is. The testtest_output_config_effort_remains_ignored, which #5464 added, passes unchanged. The setting is opt-in for a reason. Claude Code states an effort in every request,highunless it is configured otherwise, and an engine can refuse a level that it does not serve.Validation
pytest tests/unit_tests/models: 2797 passed, wheremainhas 2762.pytest responses_api_models/vllm_model: 1317 passed, wheremainhas 1313.pytest responses_api_models/base_model: 99 passed, wheremainhas 98.pytest responses_api_models/agentic_if_text: 6 passed, wheremainhas 5.ruff checkandruff format --check(ruff 0.9.9) on the changed Python files: no finding.pre-commit run --all-fileswas not run. Its box below is unticked.main:anthropic_converter.py,base_responses_api_model.py, andapp.pyofvllm_model,base_modelandagentic_if_text. The other 14 pass there too: the setting is off, or the request states no effort.Rollouts
One task ran with a real model at
mainand at an earlier head of #6905, which is stacked on this one and held the first commit of this PR:vllm_model,claude_code_agentwith Claude Code 2.1.312 andreasoning_effort: low,single_agent_turn_legacyand a Docker sandbox ofubuntu:24.04. The model is an OpenAI model behind an OpenAI-compatible endpoint that serves the Chat Completions API. A process in front of the endpoint recorded the fields of each request that the model server sent.output_config: {"effort": "low"}in each of its two requests.mainthe requests at the endpoint have the fieldsmax_tokens,messages,modelandtools, and noreasoning_effort.forward_anthropic_reasoning_effort: trueboth requests at the endpoint havereasoning_effort: low.healthy, as atmain.No rollout tried a level that the endpoint refuses.
Compatibility and benchmark impact
None. The setting is new and off by default.
Checklist
pre-commit run --all-files) (so CI lint/format checks pass).git commit -s) (so the DCO check passes).🤖 Generated with Claude Code