Repository navigation
fix: harden harness CLI upstream handling and Claude effort - #198
Merged
Merged
Conversation
- validate --upstream as an http(s):// URL at parse time so typos such as `http//127.0.0.1:8000` fail fast instead of surfacing as 502s - discover the harness model from the upstream's /v1/models when --model is omitted alongside --upstream, replacing the `agentic-api` placeholder - always pin Claude Code to a Qwen-compatible effort (`medium`, overridable with AGENTIC_CLAUDE_EFFORT) instead of only under --yolo - print the harness summary (gateway URL + resolved model) on launch - write the Codex config.toml with real newlines (the literal `\n` broke TOML parsing) and complete the model catalog schema codex 0.144.6 needs - clamp Anthropic output_config.effort high/max to xhigh for Qwen templates - add docs/guides/harness-cli-testing.md with the local and Kubernetes verification checklist, and refresh README and getting-started Co-Authored-By: Claude Fable 5 <[email protected]> Signed-off-by: Francisco Javier Arceo <[email protected]>
franciscojavierarceo
requested review from
bbrowning,
jiahuei,
leseb,
maralbahari,
noobHappylife,
qandrew and
tjtanaa
as code owners
August 21, 2026 19:48
There was a problem hiding this comment.
Pull request overview
Hardens CLI harness startup against invalid upstreams, missing models, incompatible Claude effort, and malformed Codex configuration.
Changes:
- Adds upstream validation, model discovery, and Claude effort pinning.
- Updates Codex model catalog/config generation.
- Normalizes Messages effort and adds harness testing documentation.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
README.md |
Documents model discovery and Claude effort. |
mkdocs.yaml |
Adds the harness testing guide. |
docs/guides/harness-cli-testing.md |
Provides end-to-end testing procedures. |
docs/developing/getting-started.md |
Updates CLI setup guidance. |
crates/agentic-server/src/handler/http/messages.rs |
Normalizes reasoning effort. |
crates/agentic-server/src/agentic_process.rs |
Adds model discovery and launch behavior. |
crates/agentic-server/src/agentic_harness.rs |
Fixes generated Codex configuration. |
crates/agentic-server/src/agentic_cli.rs |
Validates upstream URLs. |
Suppressed comments (1)
crates/agentic-server/src/handler/http/messages.rs:124
- This maps
high/maxfor every/v1/messagesrequest, regardless of the requested model or configured upstream. A non-Qwen backend that acceptshighbut notxhighwill now reject requests that previously passed through unchanged—the note above already identifies this failure mode. Make the translation conditional on an explicit backend/model capability instead of applying it globally.
let mapped = match effort.as_str()? {
"high" | "max" => "xhigh",
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- normalize an upstream ending in /v1 before model discovery so --upstream http://host/v1 does not request /v1/v1/models - reject query strings and fragments in --upstream, since endpoint paths are appended to the base URL - model output_config.effort as typed OutputConfig/ReasoningEffort in agentic-server-core types and clamp through MessagesRequest instead of an untyped JSON value at the handler boundary - note in the testing guide that the Kubernetes remedies require #199 Co-Authored-By: Claude Fable 5 <[email protected]> Signed-off-by: Francisco Javier Arceo <[email protected]>
Collaborator
Author
|
Addressed the Copilot review in e03b115:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On current
main, both harness paths of theagenticCLI fail out of the box against vLLM serving Qwen:agentic run codex --upstream … --model …→ Codex exits withError loading config.toml: … unexpected key or value, expected newline. The generated file contains literal\nsequences instead of newlines.agentic run claude --upstream … --model …(without--yolo) →API Error: 500 Unexpected reasoning effort high. Supported types are xhigh (default), medium, and low. The compatible effort was only pinned under--yolo.This PR fixes those and the other CLI failure modes hit while reproducing #190 end-to-end. It does not change gateway behavior for
parallel_tool_calls; that is #197. The Codex catalog keepssupports_parallel_tool_calls: falseto match #197's serialized execution.config.tomlwith real newlines and complete the model catalog schema codex 0.144.6 requires (shell_type,priority,base_instructions,truncation_policy, context windows).--effort mediumand setCLAUDE_CODE_EFFORT_LEVEL=medium(the env var wins inside Claude Code), overridable withAGENTIC_CLAUDE_EFFORT.--yolostays strictly opt-in and only adds the harness's native bypass flag.--upstreamat parse time as anhttp(s)://URL with a host and without a query string or fragment (endpoint paths are appended to the base). A typo such ashttp//127.0.0.1:8000previously started the gateway and surfaced only as 502s on every request.--modelis omitted with--upstreamfromGET {upstream}/v1/models, instead of sending theagentic-apiplaceholder that vLLM rejects. The base is normalized first, so an upstream ending in/v1does not request/v1/v1/models.output_config.efforthigh/max→xhighon/v1/messagesfor Qwen templates, through new typedOutputConfig/ReasoningEffort/ReasoningEffortLeveltypes onMessagesRequestinagentic-server-core(unknown effort strings are preserved verbatim; all other fields round-trip viaextra).docs/guides/harness-cli-testing.md: a shareable checklist covering validate → smoke test → tool-call round trip → interactive session → direct Testing with codex: Handle parallel_tool_calls flag #190 curl repro → Kubernetes verification (Claude Code and Codex over WebSocket) → troubleshooting. README and getting-started updated to match.Split out of #193; the Kubernetes base fixes are in #199, and the testing guide's Kubernetes troubleshooting rows state that dependency.
Review round (e03b115):
/v1-suffixed upstream normalization, query/fragment rejection, typedoutput_configmodel, and the #199 dependency note in the guide.Known follow-up (not in this PR): the CLI places the Codex session home under the system temp dir, so Codex warns
Refusing to create helper binaries under temporary dir "/tmp"and skips its PATH aliases. Sessions still work.Test Plan
cargo fmt --all -- --check,cargo clippy --all-targets -- -D warnings,cargo test --workspace(743 passed),pre-commit run --all-files.--yolo, model discovery against a stub HTTP server (including a/v1-suffixed upstream), explicit--modelprecedence, typed effort clamp with extras preserved.Qwen/Qwen3.8-27B-FP8:agentic run claude --upstream http//…→ rejected at parse withinvalid upstream URL.agentic run claude --upstream http://127.0.0.1:8000(no--model, inheritedCLAUDE_CODE_EFFORT_LEVEL=high) → discovered model, effort pinned to medium,-pturn answered.agentic run codex --upstream http://127.0.0.1:8000 --yolo -- exec …(no--model) → Codex loaded the generated config, ran a shell tool call over WebSocket, listed the crates.main(same commands, binary built fromorigin/main): Codex fails to loadconfig.toml; Claude Code returns the effort 500 above.exec+ shell tool through the cluster gateway.🤖 Generated with Claude Code