Repository navigation
fix: keep the Kubernetes base healthy on a read-only root and stable /ready - #199
Merged
Merged
Conversation
…/ready Found by following docs/deploying/kubernetes.md end-to-end on kind with Codex and Claude Code: - config_file: an unwritable AGENTIC_API_HOME (read-only root filesystem, the documented base) no longer aborts startup; the generated config.toml is kept in memory with a warning. The base also mounts an emptyDir at /var/lib/agentic-api so the file is written when possible. - readiness: the /ready upstream probe client no longer pools connections. Reusing a keep-alive socket the upstream (uvicorn, 5 s idle timeout) had already closed failed with hyper IncompleteMessage roughly 1-3 times a minute per pod and produced 503 readiness probe failures while vLLM was healthy. - deploy/overlays/kind: working overlay for the kind guide (host vLLM, Linux hostAliases). Overlays must live outside deploy/kubernetes; the location the guide suggested fails with a Kustomize cycle error. - docs: fix the overlay location and describe the emptyDir home. 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
Improves Kubernetes reliability on read-only filesystems and stabilizes upstream readiness checks.
Changes:
- Falls back to in-memory generated configuration when home is unwritable.
- Disables readiness-probe connection pooling.
- Adds writable storage, a kind overlay, and updated deployment guidance.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
docs/deploying/kubernetes.md |
Documents overlay placement and writable home behavior. |
deploy/overlays/kind/kustomization.yaml |
Adds a kind-specific deployment overlay. |
deploy/kubernetes/deployment.yaml |
Mounts a bounded writable emptyDir. |
crates/agentic-server/src/config_file.rs |
Handles unwritable homes without failing startup. |
crates/agentic-server-core/src/readiness.rs |
Prevents reuse of stale readiness connections. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
franciscojavierarceo
added a commit
that referenced
this pull request
Aug 21, 2026
- 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]>
- deploy/overlays/kind: point LLM_API_BASE at host.docker.internal:5050 to match the kind guide and keep it platform-neutral - deploy/overlays/kind-linux: layer the hostAliases entry native Linux Docker needs on top of the kind overlay instead of applying it everywhere - readiness: regression test that each probe opens its own TCP connection; it fails when pool_max_idle_per_host(0) is removed Co-Authored-By: Claude Fable 5 <[email protected]> Signed-off-by: Francisco Javier Arceo <[email protected]>
Collaborator
Author
|
Addressed the Copilot review in b83d048:
|
franciscojavierarceo
added a commit
that referenced
this pull request
Aug 21, 2026
## Summary On current `main`, both harness paths of the `agentic` CLI fail out of the box against vLLM serving Qwen: - `agentic run codex --upstream … --model …` → Codex exits with `Error loading config.toml: … unexpected key or value, expected newline`. The generated file contains literal `\n` sequences 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 keeps `supports_parallel_tool_calls: false` to match #197's serialized execution. - **Codex config**: write `config.toml` with real newlines and complete the model catalog schema codex 0.144.6 requires (`shell_type`, `priority`, `base_instructions`, `truncation_policy`, context windows). - **Claude effort**: always pass `--effort medium` and set `CLAUDE_CODE_EFFORT_LEVEL=medium` (the env var wins inside Claude Code), overridable with `AGENTIC_CLAUDE_EFFORT`. `--yolo` stays strictly opt-in and only adds the harness's native bypass flag. - **Validate `--upstream` at parse time** as an `http(s)://` URL with a host. A typo such as `http//127.0.0.1:8000` previously started the gateway and surfaced only as 502s on every request. - **Discover the model when `--model` is omitted with `--upstream`** from `GET {upstream}/v1/models`, instead of sending the `agentic-api` placeholder that vLLM rejects. - Clamp Anthropic `output_config.effort` `high`/`max` → `xhigh` on `/v1/messages` for Qwen templates. - Print the resolved gateway URL and model on launch. - Add `docs/guides/harness-cli-testing.md`: a shareable checklist covering validate → smoke test → tool-call round trip → interactive session → direct #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. 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`. - New unit tests: malformed upstream rejection + trailing-slash normalization, effort pinned without `--yolo`, model discovery against a stub HTTP server, explicit `--model` precedence. - Live, with a binary built from this branch against vLLM serving `Qwen/Qwen3.8-27B-FP8`: - `agentic run claude --upstream http//…` → rejected at parse with `invalid upstream URL`. - `agentic run claude --upstream http://127.0.0.1:8000` (no `--model`, inherited `CLAUDE_CODE_EFFORT_LEVEL=high`) → discovered model, effort pinned to medium, `-p` turn 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. - Baseline on `main` (same commands, binary built from `origin/main`): Codex fails to load `config.toml`; Claude Code returns the effort 500 above. - Kubernetes (kind, kustomize base with PostgreSQL): Claude Code tool-call turn and Codex `exec` + shell tool through the cluster gateway. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Francisco Javier Arceo <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]>
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
Found by following
docs/deploying/kubernetes.mdend-to-end on kind (kustomize base, 2 replicas, PostgreSQL) with Codex and Claude Code.CrashLoopBackOff): fix: harden MCP and Agentic API config startup #189 writes a generatedconfig.tomlinto/var/lib/agentic-api, but the base setsreadOnlyRootFilesystem: truewith no writable volume (failed to create temporary configuration file: Read-only file system). The server now continues with the generated configuration in memory and logs a warning when the home is unwritable (regression test included), and the base mounts a 64MiemptyDirat/var/lib/agentic-api./readyflapped 1–3×/min per pod with 503 readiness-probe failures while vLLM was healthy. The probe client reused pooled keep-alive connections that the upstream (uvicorn, 5 s idle timeout ≈ 5 s probe period) had already closed, failing withhyper::Error(IncompleteMessage). The readiness client no longer pools connections (pool_max_idle_per_host(0)), guarded by a regression test that counts TCP connections across sequential probes.cycle detected). Addeddeploy/overlays/kind(platform-neutral,host.docker.internal:5050per the kind guide) anddeploy/overlays/kind-linux(layers thehostAliasesentry native Linux Docker needs) as working examples, and fixed the doc.Split out of #193; the CLI fixes are in #198.
Review round (b83d048): kind overlay port aligned with the guide, Linux
hostAliasessplit intodeploy/overlays/kind-linux, readiness regression test.Test Plan
cargo fmt --all -- --check,cargo clippy --all-targets -- -D warnings,cargo test --workspace,kubectl kustomize deploy/overlays/kind | kubectl apply --dry-run=server -f -.create_or_load_continues_when_home_is_not_writable;readiness_client_opens_a_new_connection_per_probe(verified to fail, 1 connection vs 3, whenpool_max_idle_per_host(0)is removed).CrashLoopBackOff; after, both ready. Readiness warnings went from ~60 in 15 minutes to 0 in 10+ minutes (also 0/24 probes locally at the 5 s cadence).store: true→ rolling restart →previous_response_idcontinuation), 6 concurrent chained conversations across both replicas, Codexexecwith a shell tool over WebSocket, Claude Code tool-call turn, and an 86-case Responses/Messages edge battery. Thekind-linuxoverlay was live-applied on kind with both replicas ready.🤖 Generated with Claude Code