← Back to Pull requests

docs: surface Claude Code setup #392

Merged
franciscojavierarceo merged 5 files (206 lines) on Sep 30, 2026 05:39 UTC
View on GitHub
franciscojavierarceo franciscojavierarceo commented on Sep 29, 2026 22:51 UTC
Author

Summary


  • surface self-hosted Claude Code setup from the README and documentation site navigation

  • document the unrecognized_model fix and the supported attach command

  • generate an isolated Claude Code model override from the gateway model catalog
  • Test Plan


  • bash -n scripts/agentic-claude.sh scripts/tests/agentic-launchers-test.sh

  • bash scripts/tests/agentic-launchers-test.sh

  • git diff --check
  • Diff: 206 lines (+188 / -18) across 5 files Reviewer: maralbahari Review duration: 408m
    All Vouch review confidence checks passed
    Residual risk 0.07 = Change Risk (0.46) × (1 − Review Confidence (0.85)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.46 · 206 lines diff across 5 files
    0.46
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.86 · 5 substantive comment(s)
    0.86
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    84%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.319
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    13 items
    Copilot Copilot commented on code on Sep 29, 2026 23:34 UTC
    Code Review
    scripts/agentic-claude.sh:1
    @@ -5,9 +5,11 @@ repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
     cd "$repo_root"
     
     gateway_url="${AGENTIC_GATEWAY_URL:-http://127.0.0.1:3020}"
    -model="${AGENTIC_MODEL:-${V_MODEL:-agentic-api}}"
    +model="${AGENTIC_MODEL:-${V_MODEL:-}}"
     claude_config_dir="${AGENTIC_CLAUDE_CONFIG_DIR:-/tmp/claude-agentic-3020}"

    By default, all runs share the same config directory and overwrite the same agentic-settings.json. Concurrent invocations (or multiple terminals using different gateways) can clobber each other’s settings/state. Consider making the default config dir unique per run (e.g., using mktemp -d) or unique per gateway/model (e.g., hash of $gateway_url + $model), while still allowing AGENTIC_CLAUDE_CONFIG_DIR to force a stable location.

    Copilot Copilot commented on code on Sep 29, 2026 23:34 UTC
    Code Review
    scripts/agentic-claude.sh:1
    @@ -16,12 +18,60 @@ if [[ -z "$claude_bin" || ! -x "$claude_bin" ]]; then
       echo 'error: Claude Code not found; set CLAUDE_BIN=/path/to/claude' >&2
       exit 127
     fi
    -if [[ "$model" == */* ]]; then
    -  echo "error: Claude Code requires a slash-free served model alias; start vLLM with --served-model-name and set AGENTIC_MODEL to that alias" >&2
    -  exit 2
    +for required_command in curl jq; do
    +  if ! command -v "$required_command" >/dev/null 2>&1; then
    +    echo "error: $required_command is required to discover the Agentic API model and create Claude Code settings" >&2
    +    exit 127
    +  fi
    +done
    +
    +models_tmp="$(mktemp "${TMPDIR:-/tmp}/agentic-claude-models.XXXXXX")"
    +settings_tmp="$(mktemp "${TMPDIR:-/tmp}/agentic-claude-settings.XXXXXX")"
    +trap 'rm -f "$models_tmp" "$settings_tmp"' EXIT
    +
    +curl_args=(--fail --silent --show-error)
    +if [[ -n "$gateway_api_key" ]]; then
    +  curl_args+=(-H "Authorization: Bearer $gateway_api_key")
    +fi

    Passing the bearer token via curl -H ... puts the secret in the process command line, which can be visible to other local users via process inspection tools. A safer approach is to pass secrets via a restricted-permissions temp config file (curl --config <file>) or another mechanism that avoids exposing the token in argv.

    Copilot Copilot commented on code on Sep 29, 2026 23:34 UTC
    Code Review
    scripts/agentic-claude.sh:1
    @@ -16,12 +18,60 @@ if [[ -z "$claude_bin" || ! -x "$claude_bin" ]]; then
       echo 'error: Claude Code not found; set CLAUDE_BIN=/path/to/claude' >&2
       exit 127
     fi
    -if [[ "$model" == */* ]]; then
    -  echo "error: Claude Code requires a slash-free served model alias; start vLLM with --served-model-name and set AGENTIC_MODEL to that alias" >&2
    -  exit 2
    +for required_command in curl jq; do
    +  if ! command -v "$required_command" >/dev/null 2>&1; then
    +    echo "error: $required_command is required to discover the Agentic API model and create Claude Code settings" >&2
    +    exit 127
    +  fi
    +done
    +
    +models_tmp="$(mktemp "${TMPDIR:-/tmp}/agentic-claude-models.XXXXXX")"
    +settings_tmp="$(mktemp "${TMPDIR:-/tmp}/agentic-claude-settings.XXXXXX")"
    +trap 'rm -f "$models_tmp" "$settings_tmp"' EXIT
    +
    +curl_args=(--fail --silent --show-error)
    +if [[ -n "$gateway_api_key" ]]; then
    +  curl_args+=(-H "Authorization: Bearer $gateway_api_key")
    +fi
    +curl "${curl_args[@]}" "${gateway_url%/}/v1/models" >"$models_tmp"
    +if [[ -z "$model" ]]; then
    +  model="$(jq --raw-output --exit-status '.data[0].id' "$models_tmp")" || {
    +    echo 'error: gateway model catalog does not contain a usable first model' >&2
    +    exit 2
    +  }
    +else
    +  jq --exit-status --arg model "$model" '
    +    [.data[] | select(.id == $model)]
    +    | if length == 1 then . else error("gateway model catalog must contain exactly one requested model") end
    +  ' "$models_tmp" >/dev/null || {
    +    echo "error: gateway model catalog does not contain requested model: $model" >&2
    +    exit 2
    +  }

    The script assumes the gateway model catalog is always in the OpenAI-style {object, data:[...]} shape. In this repo’s test fixtures, another /v1/models response shape ({models:[...]}) also exists, so this will be brittle across gateway/server versions. Consider normalizing the response in one jq expression (e.g., selecting from .data // .models) and then using that normalized list for both model selection/validation and context window lookup.

    Copilot Copilot commented on code on Sep 29, 2026 23:34 UTC
    Code Review
    scripts/agentic-claude.sh:1
    @@ -16,12 +18,60 @@ if [[ -z "$claude_bin" || ! -x "$claude_bin" ]]; then
       echo 'error: Claude Code not found; set CLAUDE_BIN=/path/to/claude' >&2
       exit 127
     fi
    -if [[ "$model" == */* ]]; then
    -  echo "error: Claude Code requires a slash-free served model alias; start vLLM with --served-model-name and set AGENTIC_MODEL to that alias" >&2
    -  exit 2
    +for required_command in curl jq; do
    +  if ! command -v "$required_command" >/dev/null 2>&1; then
    +    echo "error: $required_command is required to discover the Agentic API model and create Claude Code settings" >&2
    +    exit 127
    +  fi
    +done
    +
    +models_tmp="$(mktemp "${TMPDIR:-/tmp}/agentic-claude-models.XXXXXX")"
    +settings_tmp="$(mktemp "${TMPDIR:-/tmp}/agentic-claude-settings.XXXXXX")"
    +trap 'rm -f "$models_tmp" "$settings_tmp"' EXIT
    +
    +curl_args=(--fail --silent --show-error)
    +if [[ -n "$gateway_api_key" ]]; then
    +  curl_args+=(-H "Authorization: Bearer $gateway_api_key")
    +fi
    +curl "${curl_args[@]}" "${gateway_url%/}/v1/models" >"$models_tmp"
    +if [[ -z "$model" ]]; then
    +  model="$(jq --raw-output --exit-status '.data[0].id' "$models_tmp")" || {
    +    echo 'error: gateway model catalog does not contain a usable first model' >&2
    +    exit 2
    +  }
    +else
    +  jq --exit-status --arg model "$model" '
    +    [.data[] | select(.id == $model)]
    +    | if length == 1 then . else error("gateway model catalog must contain exactly one requested model") end
    +  ' "$models_tmp" >/dev/null || {
    +    echo "error: gateway model catalog does not contain requested model: $model" >&2
    +    exit 2
    +  }
     fi
     
    -claude_args=(--bare --permission-mode manual --effort "${AGENTIC_CLAUDE_EFFORT:-medium}" --model "$model")
    +context_window="$(jq --raw-output --arg model "$model" '
    +  [.data[] | select(.id == $model)]
    +  | .[0] | (.max_model_len // .context_length // 32768)
    +' "$models_tmp")"
    +if ! [[ "$context_window" =~ ^[1-9][0-9]*$ ]]; then
    +  context_window=32768
    +fi
    +
    +umask 077
    +mkdir -p "$claude_config_dir"
    +settings_path="$claude_config_dir/agentic-settings.json"
    +jq --null-input --arg model "$model" --arg canonical_model "$canonical_model" \
    +  '{modelOverrides: {($canonical_model): $model}}' >"$settings_tmp"
    +mv "$settings_tmp" "$settings_path"

    By default, all runs share the same config directory and overwrite the same agentic-settings.json. Concurrent invocations (or multiple terminals using different gateways) can clobber each other’s settings/state. Consider making the default config dir unique per run (e.g., using mktemp -d) or unique per gateway/model (e.g., hash of $gateway_url + $model), while still allowing AGENTIC_CLAUDE_CONFIG_DIR to force a stable location.

    Copilot Copilot commented on code on Sep 29, 2026 23:34 UTC
    Code Review
    docs/guides/harness-cli-testing.md:1
    @@ -37,6 +37,41 @@ PNG, and verify that the same attachment is absent with an explicit text-only ca
     CLI and gateway, without contacting a live model or claiming fresh vision inference. Run the same checks locally with `bash scripts/claude-code-smoke.sh` and
     `bash scripts/codex-smoke.sh` after building both binaries with `cargo build -p agentic-server --bins`.
     
    +## Claude Code with a self-hosted model
    +
    +Do not start Claude Code directly with a self-hosted model ID such as `zai-org/GLM-5.2-FP8`. Claude Code validates
    +the selected model against its own catalog before it sends a request, so it reports an `unrecognized_model` error for
    +IDs it does not recognize. Updating Claude Code alone does not make an arbitrary served model a catalog entry.
    +
    +Use the attach command for an existing Agentic API gateway:
    +
    +```console
    +agentic harness claude \
    +  --gateway-url http://127.0.0.1:9000 \
    +  --model zai-org/GLM-5.2-FP8 \
    +  -- -p "summarize the files in this directory"
    +```
    +
    +For a locally started gateway, use `agentic run claude --upstream <vLLM URL> --model <served model>` instead. Both
    +commands generate a private settings file that maps Claude Code's canonical
    +`claude-sonnet-4-5-20250929` identifier to the selected served model, then launch Claude with the canonical
    +identifier. They also isolate Claude state from the user's normal configuration and remove cloud-provider routing
    +variables.
    +
    +For a lightweight wrapper around an already-running gateway, use `scripts/agentic-claude.sh`. It reads
    +`GET /v1/models` to select or validate `AGENTIC_MODEL`, records the server-advertised context limit when available,
    +and writes the same canonical-model override to
    +`${AGENTIC_CLAUDE_CONFIG_DIR:-/tmp/claude-agentic-3020}/agentic-settings.json`:

    The wrapper now hard-requires curl and jq (and exits with an explicit error if missing). It would be helpful to mention these prerequisites in this section so users don’t discover it only at runtime.

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Sep 29, 2026 23:34 UTC
    Reviewer

    [!WARNING]

    Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

    <!-- ccr-overview-v2 -->

    Copilot review overview

    Review effort: Lite
    Findings: 4 <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> · 1 <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.png" alt="Low severity" width="62" height="18" align="texttop"></picture>

    <details open>
    <summary><strong>Open (5)</strong></summary>

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> [By default, all runs share the same config directory and overwrite the same…](#discussion_r4139385412) · New

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> [Passing the bearer token via curl -H ... puts the secret in the process command line, which can…](#discussion_r4139385440) · New

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> [The script assumes the gateway model catalog is always in the OpenAI-style {object, data:[...]}…](#discussion_r4139385476) · New

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> [By default, all runs share the same config directory and overwrite the same…](#discussion_r4139385507) · New

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.png" alt="Low severity" width="62" height="18" align="texttop"></picture> [The wrapper now hard-requires curl and jq (and exits with an explicit error if missing). It…](#discussion_r4139385538) · New

  • </details>

    <details>
    <summary><strong>What changed in this PR</strong></summary>

    This PR surfaces self-hosted Claude Code setup in the docs/navigation and updates the agentic-claude.sh wrapper to generate a Claude Code model-override settings file by discovering models from the gateway.

    Changes:

  • Update scripts/agentic-claude.sh to query the gateway model catalog, write an isolated Claude settings override, and pass context/output token limits to Claude Code.

  • Extend launcher tests to validate the new settings file, canonical model mapping, and context window behavior.

  • Expose the self-hosted Claude Code setup section in MkDocs navigation and README links.
  • | File | Description |
    | ---- | ----------- |
    | scripts/​tests/​agentic-launchers-test.sh | Updates test harness fakes/assertions for gateway model discovery, settings generation, and context token propagation. |
    | scripts/​agentic-claude.sh | Implements gateway /v1/models discovery, context window parsing, and writes agentic-settings.json used via --settings. |
    | mkdocs.yaml | Adds a visible nav entry pointing to the Claude Code self-hosted setup section. |
    | docs/​guides/​harness-cli-testing.md | Documents unrecognized_model behavior and how the wrapper/CLI generates a canonical-model override. |
    | README.md | Links README users directly to the self-hosted Claude Code setup instructions. |
    </details>

    ---

    💡 <a href="/vllm-project/agentic-api/new/main?filename=.github/skills/code-review/SKILL.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add a code-review agent skill</a> or configure MCP servers for context-aware, tailored reviews. <a href="https://docs.github.com/copilot/how-tos/use-copilot-agents/request-a-code-review/use-code-review?tool=webui#mcp-servers-and-agent-skills" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn more in the docs.</a>

    franciscojavierarceo franciscojavierarceo commented on code on Sep 29, 2026 23:58 UTC
    Code Review
    scripts/agentic-claude.sh:1
    @@ -5,9 +5,11 @@ repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
     cd "$repo_root"
     
     gateway_url="${AGENTIC_GATEWAY_URL:-http://127.0.0.1:3020}"
    -model="${AGENTIC_MODEL:-${V_MODEL:-agentic-api}}"
    +model="${AGENTIC_MODEL:-${V_MODEL:-}}"
     claude_config_dir="${AGENTIC_CLAUDE_CONFIG_DIR:-/tmp/claude-agentic-3020}"

    addressed in 72a167b: the default is now a unique temporary configuration directory per invocation, removed after Claude exits. AGENTIC_CLAUDE_CONFIG_DIR remains the explicit persistent-state override.

    franciscojavierarceo franciscojavierarceo commented on code on Sep 29, 2026 23:58 UTC
    Code Review
    scripts/agentic-claude.sh:1
    @@ -16,12 +18,60 @@ if [[ -z "$claude_bin" || ! -x "$claude_bin" ]]; then
       echo 'error: Claude Code not found; set CLAUDE_BIN=/path/to/claude' >&2
       exit 127
     fi
    -if [[ "$model" == */* ]]; then
    -  echo "error: Claude Code requires a slash-free served model alias; start vLLM with --served-model-name and set AGENTIC_MODEL to that alias" >&2
    -  exit 2
    +for required_command in curl jq; do
    +  if ! command -v "$required_command" >/dev/null 2>&1; then
    +    echo "error: $required_command is required to discover the Agentic API model and create Claude Code settings" >&2
    +    exit 127
    +  fi
    +done
    +
    +models_tmp="$(mktemp "${TMPDIR:-/tmp}/agentic-claude-models.XXXXXX")"
    +settings_tmp="$(mktemp "${TMPDIR:-/tmp}/agentic-claude-settings.XXXXXX")"
    +trap 'rm -f "$models_tmp" "$settings_tmp"' EXIT
    +
    +curl_args=(--fail --silent --show-error)
    +if [[ -n "$gateway_api_key" ]]; then
    +  curl_args+=(-H "Authorization: Bearer $gateway_api_key")
    +fi

    addressed in 72a167b: the bearer header now lives in a mode-600 temporary curl config file, so the token is not placed in curl argv. The launcher test asserts the command line excludes the token.

    franciscojavierarceo franciscojavierarceo commented on code on Sep 29, 2026 23:58 UTC
    Code Review
    scripts/agentic-claude.sh:1
    @@ -16,12 +18,60 @@ if [[ -z "$claude_bin" || ! -x "$claude_bin" ]]; then
       echo 'error: Claude Code not found; set CLAUDE_BIN=/path/to/claude' >&2
       exit 127
     fi
    -if [[ "$model" == */* ]]; then
    -  echo "error: Claude Code requires a slash-free served model alias; start vLLM with --served-model-name and set AGENTIC_MODEL to that alias" >&2
    -  exit 2
    +for required_command in curl jq; do
    +  if ! command -v "$required_command" >/dev/null 2>&1; then
    +    echo "error: $required_command is required to discover the Agentic API model and create Claude Code settings" >&2
    +    exit 127
    +  fi
    +done
    +
    +models_tmp="$(mktemp "${TMPDIR:-/tmp}/agentic-claude-models.XXXXXX")"
    +settings_tmp="$(mktemp "${TMPDIR:-/tmp}/agentic-claude-settings.XXXXXX")"
    +trap 'rm -f "$models_tmp" "$settings_tmp"' EXIT
    +
    +curl_args=(--fail --silent --show-error)
    +if [[ -n "$gateway_api_key" ]]; then
    +  curl_args+=(-H "Authorization: Bearer $gateway_api_key")
    +fi
    +curl "${curl_args[@]}" "${gateway_url%/}/v1/models" >"$models_tmp"
    +if [[ -z "$model" ]]; then
    +  model="$(jq --raw-output --exit-status '.data[0].id' "$models_tmp")" || {
    +    echo 'error: gateway model catalog does not contain a usable first model' >&2
    +    exit 2
    +  }
    +else
    +  jq --exit-status --arg model "$model" '
    +    [.data[] | select(.id == $model)]
    +    | if length == 1 then . else error("gateway model catalog must contain exactly one requested model") end
    +  ' "$models_tmp" >/dev/null || {
    +    echo "error: gateway model catalog does not contain requested model: $model" >&2
    +    exit 2
    +  }

    addressed in 72a167b: model selection and context-window extraction now normalize .data // .models and use either id or slug. The launcher test covers both response shapes.

    franciscojavierarceo franciscojavierarceo commented on code on Sep 29, 2026 23:58 UTC
    Code Review
    scripts/agentic-claude.sh:1
    @@ -16,12 +18,60 @@ if [[ -z "$claude_bin" || ! -x "$claude_bin" ]]; then
       echo 'error: Claude Code not found; set CLAUDE_BIN=/path/to/claude' >&2
       exit 127
     fi
    -if [[ "$model" == */* ]]; then
    -  echo "error: Claude Code requires a slash-free served model alias; start vLLM with --served-model-name and set AGENTIC_MODEL to that alias" >&2
    -  exit 2
    +for required_command in curl jq; do
    +  if ! command -v "$required_command" >/dev/null 2>&1; then
    +    echo "error: $required_command is required to discover the Agentic API model and create Claude Code settings" >&2
    +    exit 127
    +  fi
    +done
    +
    +models_tmp="$(mktemp "${TMPDIR:-/tmp}/agentic-claude-models.XXXXXX")"
    +settings_tmp="$(mktemp "${TMPDIR:-/tmp}/agentic-claude-settings.XXXXXX")"
    +trap 'rm -f "$models_tmp" "$settings_tmp"' EXIT
    +
    +curl_args=(--fail --silent --show-error)
    +if [[ -n "$gateway_api_key" ]]; then
    +  curl_args+=(-H "Authorization: Bearer $gateway_api_key")
    +fi
    +curl "${curl_args[@]}" "${gateway_url%/}/v1/models" >"$models_tmp"
    +if [[ -z "$model" ]]; then
    +  model="$(jq --raw-output --exit-status '.data[0].id' "$models_tmp")" || {
    +    echo 'error: gateway model catalog does not contain a usable first model' >&2
    +    exit 2
    +  }
    +else
    +  jq --exit-status --arg model "$model" '
    +    [.data[] | select(.id == $model)]
    +    | if length == 1 then . else error("gateway model catalog must contain exactly one requested model") end
    +  ' "$models_tmp" >/dev/null || {
    +    echo "error: gateway model catalog does not contain requested model: $model" >&2
    +    exit 2
    +  }
     fi
     
    -claude_args=(--bare --permission-mode manual --effort "${AGENTIC_CLAUDE_EFFORT:-medium}" --model "$model")
    +context_window="$(jq --raw-output --arg model "$model" '
    +  [.data[] | select(.id == $model)]
    +  | .[0] | (.max_model_len // .context_length // 32768)
    +' "$models_tmp")"
    +if ! [[ "$context_window" =~ ^[1-9][0-9]*$ ]]; then
    +  context_window=32768
    +fi
    +
    +umask 077
    +mkdir -p "$claude_config_dir"
    +settings_path="$claude_config_dir/agentic-settings.json"
    +jq --null-input --arg model "$model" --arg canonical_model "$canonical_model" \
    +  '{modelOverrides: {($canonical_model): $model}}' >"$settings_tmp"
    +mv "$settings_tmp" "$settings_path"

    addressed in 72a167b: the default is now a unique temporary configuration directory per invocation, removed after Claude exits. AGENTIC_CLAUDE_CONFIG_DIR remains the explicit persistent-state override.

    franciscojavierarceo franciscojavierarceo commented on code on Sep 29, 2026 23:58 UTC
    Code Review
    docs/guides/harness-cli-testing.md:1
    @@ -37,6 +37,41 @@ PNG, and verify that the same attachment is absent with an explicit text-only ca
     CLI and gateway, without contacting a live model or claiming fresh vision inference. Run the same checks locally with `bash scripts/claude-code-smoke.sh` and
     `bash scripts/codex-smoke.sh` after building both binaries with `cargo build -p agentic-server --bins`.
     
    +## Claude Code with a self-hosted model
    +
    +Do not start Claude Code directly with a self-hosted model ID such as `zai-org/GLM-5.2-FP8`. Claude Code validates
    +the selected model against its own catalog before it sends a request, so it reports an `unrecognized_model` error for
    +IDs it does not recognize. Updating Claude Code alone does not make an arbitrary served model a catalog entry.
    +
    +Use the attach command for an existing Agentic API gateway:
    +
    +```console
    +agentic harness claude \
    +  --gateway-url http://127.0.0.1:9000 \
    +  --model zai-org/GLM-5.2-FP8 \
    +  -- -p "summarize the files in this directory"
    +```
    +
    +For a locally started gateway, use `agentic run claude --upstream <vLLM URL> --model <served model>` instead. Both
    +commands generate a private settings file that maps Claude Code's canonical
    +`claude-sonnet-4-5-20250929` identifier to the selected served model, then launch Claude with the canonical
    +identifier. They also isolate Claude state from the user's normal configuration and remove cloud-provider routing
    +variables.
    +
    +For a lightweight wrapper around an already-running gateway, use `scripts/agentic-claude.sh`. It reads
    +`GET /v1/models` to select or validate `AGENTIC_MODEL`, records the server-advertised context limit when available,
    +and writes the same canonical-model override to
    +`${AGENTIC_CLAUDE_CONFIG_DIR:-/tmp/claude-agentic-3020}/agentic-settings.json`:

    addressed in 72a167b: the guide now lists curl and jq as wrapper prerequisites.

    maralbahari maralbahari approved these changes on Sep 30, 2026 05:38 UTC
    Approved Reviewer

    Approved these changes.

    Reviewers
    Assignees
    franciscojavierarceo franciscojavierarceo
    Labels
    risk: low confidence: 84.9% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.8% (MEDIUM) · Higher = larger blast radius
    45.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 84.9% · Lower = rushed or shallow review
    84.9%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 6.9% · Safe to merge
    6.9%