Repository navigation
feat(tier3): support Claude Code on Agent Platform and add active preflight probe - #140
Conversation
300fcbb to
8fcc379
Compare
Add Vertex AI Anthropic endpoint routing and ADC authentication for Claude Code. Enforce security boundaries rejecting cluster infrastructure kwargs in skill configs. Harden sensitive credential redaction across CLI, environment, and process args. Support task.path resolution and stdio MCP env forwarding in local agents. Signed-off-by: Karl Weinmeister <[email protected]>
Implement an active 1-token preflight probe against Vertex AI Agent Platform OpenAPI endpoints to verify credentials, permissions, and model availability with minimal latency. - Detect Vertex AI OpenAPI base URLs and extract project/location metadata. - Send a 1-token chat/completions probe using HTTPStatus enum values. - Fall back to Google Cloud ADC when an explicit API key is not supplied. - Classify successful probes as VERIFIED and fail fast as FATAL on 401/403/404. - Add unit tests in test_harbor_runtime_preflight covering 200, 401, 403, 404, 429, timeouts, and redirects. Signed-off-by: Karl Weinmeister <[email protected]>
8fcc379 to
fea99b9
Compare
- Address PR review feedback for GKE execution and Vertex AI routing. - Decouple live agent Claude/Vertex provider routing from evaluator configs. - Support Google Application Default Credentials (ADC) for Vertex AI OpenAPI endpoints with automatic 401 token refresh in LLMClient. - Harden CLI environment kwargs parsing to fail fast on credentials and malformed input. - Expand GKE infrastructure kwargs blocklist in evals config and improve credential redaction precision. - Normalize multi-path KUBECONFIG resolution and ensure path resolution consistency. - Add packaging dependency guards and comprehensive unit and regression tests. Signed-off-by: Karl Weinmeister <[email protected]>
# Conflicts: # CHANGELOG.md
… handling - Enforce safe allowlist for Harbor environment kwargs in skill evals config. - Sanitize runner constructor kwargs and expand sensitive key detection to prevent credential leaks in CLI argv. - Maintain fatal preflight checks for Vertex OpenAPI judge while gracefully handling Claude Vertex Workload Identity. - Implement in-process access token refresh for Google ADC on 401 Unauthorized responses. - Cache and validate multi-path KUBECONFIG files via KubeConfigMerger with fail-fast error handling. - Replace external kubectl process checks with direct Kubernetes API health check. - Inject OPENAI_API_KEY into SkillSpector child process environment when using Vertex OpenAPI with ADC. Signed-off-by: Karl Weinmeister <[email protected]>
11777f6 to
c06cfb3
Compare
|
@chrisknvidia @rng1995 Resolved the merge conflict in |
Signed-off-by: Karl Weinmeister <[email protected]>
Signed-off-by: Karl Weinmeister <[email protected]>
chrisknvidia
left a comment
There was a problem hiding this comment.
Re-reviewed at 1cc2f83c974afb2a005a334826d6b79b8b52a073. The three latest requested changes are implemented: the probe now runs in an init container before application startup, the unsupported BusyBox wget option is removed, and the storage adjustment is restricted to the intended Autopilot cases.
Two actionable code issues remain: the new P1 inline comment below covers replaying a command after losing its completion status, and the P2 follow-up in the existing MCP thread shows that accepted bare variable references still reach Claude-launched MCP processes literally.
Please also resolve the current merge conflicts against main. GitHub reports CONFLICTING/DIRTY, and a local merge check against main bde533a9 confirms conflicts in src/skillevaluator/inference/client.py, src/skillevaluator/tier3/harbor/runner.py, src/skillevaluator/tier3/harbor/templates/eval.py, tests/test_provider_agent_routing.py, and tests/validators/test_security.py. CI/Security/DCO workflows require maintainer approval at this head. The PR is not ready to merge.
Validation included 1,013 selected tests and Ruff, plus a separate 287-test provider/agent review run with some overlap. The command replay was reproduced through real Kubernetes/WebSocket clients and Harbor 0.24 against a local test endpoint executing harmless shell side effects; the MCP issue was reproduced with the real Claude CLI over stdio and HTTP. These local integrations do not establish live GKE/Autopilot/Vertex or DinD behavior: gcloud and a GKE context are unavailable here, and Docker is unavailable. Please retain successful live integration evidence after the fixes and conflict resolution, then rerun the required checks on the resulting head.
Brings in NVIDIA#188 (GPT-6.1 Sol / Claude Opus 5.5 defaults, reasoning effort, refusal handling, per-model token sizing), NVIDIA#193 (Docker agent Node/npm bootstrap) and NVIDIA#199 (per-step token runtime-failure evidence). Conflicts: - src/skillevaluator/inference/client.py: keep main's per-provider _openai_kwargs builder, reasoning effort and _extract_choice_content refusal/truncation checks; wrap that call in the PR's one-shot ADC token refresh on 401 for Vertex AI OpenAPI endpoints. - src/skillevaluator/tier3/harbor/runner.py: import both sides' provider_config names; docker and gke share the PR's branch, with docker defaulting to main's DOCKER_AGENT_IMPORT_PATHS and gke to the PR's CONTAINER_AGENT_IMPORT_PATHS, and the GKE secure environment kept. - src/skillevaluator/tier3/harbor/templates/eval.py: take main's _call_openai_compatible refactor (refusal fallback, empty-reply fallback, judge-call recording) and move the PR's Vertex ADC 401 refresh into _call_openai_compatible. - tests/test_provider_agent_routing.py: union of both sides' imports. - tests/validators/test_security.py: keep the PR's Vertex ADC SkillSpector tests and main's SkillSpector model/effort tests. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
…t bootstrap After merging main, local_agents imported main's installed_agents SkillEvaluatorClaudeCode (Node/npm bootstrap fix from NVIDIA#193) and then redefined the name with this branch's Vertex AI / MCP wrapper, so the NVIDIA Build Claude wrapper lost main's bootstrap fix and Docker mode lost this branch's Vertex AI routing. - local_agents.SkillEvaluatorClaudeCode now extends the installed-agent wrapper, so Docker, GKE, and NVIDIA Build Claude Code keep both the installer fix and Vertex AI routing. - DOCKER_AGENT_IMPORT_PATHS routes claude-code to that container wrapper; Codex keeps main's installed-agent wrapper. - The Docker import-route test expects the container wrapper, and the repaired-bootstrap test also covers it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Resolve conflicts with NVIDIA#182 (Kata): - runner.py: keep both collections.abc imports; Docker, Kata and GKE share one branch. Docker and Kata use the Docker agent wrappers and their secure environment, GKE keeps the container agent wrappers and the secure GKE environment. - docs/agents-and-sandboxes.mdx: keep both the GKE mode and Kata mode sections. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
GKEExecStreamClosedError is raised after the exec stream opened, so the command may already have run when its status was lost. Retrying super().exec() repeated its side effects. The error now propagates on the first occurrence, with the message still redacted. The transient kubelet-error retry also matched a dispatched command's own stderr. The routed exec wrapper now records, per exec() attempt, whether the WebSocket handshake completed, and only an attempt whose handshakes all failed (so the command never started) is retried. The regression drives Harbor's real GKE exec with a fake stream that runs the command and then drops its status, and asserts exactly one dispatch. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
CodeQL flagged the startswith("autopilot.gke.io/") label test as
incomplete URL substring sanitization. Autopilot detection now parses each
node label key as a qualified prefix/name key and compares the prefix with
autopilot.gke.io exactly, so malformed keys and keys that only contain the
text elsewhere are not treated as Autopilot.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
Brings in NVIDIA#77 (required publication evidence and runtime source binding). Conflicts: - src/skillevaluator/tier3/harbor/runner.py: take main's report rendering (_render_current_report, re-render when the publication identity changes, and removal of the stale report), then keep this branch's GKE Workload Identity security notice after the report is rendered. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Resolve the runner.py import conflict with NVIDIA#124: keep this branch's GKE environment and kubeconfig imports and take main's metrics import (score_policy_for_metrics); score_definition is no longer used here. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Conflicted files: - CHANGELOG.md: kept main's new --env-mode runta/mosaic entry next to the kata entry, and this branch's --previous-skill entry, under the single Added heading. - src/skillevaluator/tier3/workflow.py: kept the branch's early skip of preparation when --previous-skill shows the prior evaluation still applies, and inside the non-skip path took main's (#140) preflight that returns the resolved environment kwargs and passes them to the environment preflight. - tests/tier3/test_workflow.py: both sides appended tests at the end; kept the branch's previous-skill workflow tests and main's GKE env-var precedence test. tests/golden/cli_surface.json merged cleanly; regenerating it with `PYTHONPATH=src python tests/golden/generate_cli_surface.py` produced no change (the only difference from main is --previous-skill). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Conflicted files: - CHANGELOG.md: kept main's new --env-mode runta/mosaic entry and this branch's error-code entry under the single Added heading. - src/skillevaluator/tier3/harbor/runner.py: credential-probe loop keeps the branch's probe error-code derivation and passes main's (#140) env_mode to credential_probe_disposition. - src/skillevaluator/tier3/harbor/runtime_preflight.py: the catalog 404 ModelProbeResult keeps main's HTTPStatus.NOT_FOUND and the branch's MODEL_NOT_FOUND error code. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Main's Vertex AI and Vertex OpenAPI model probes (#140) report four timeouts (HTTP read, busy worker slot, expired deadline before start, deadline while waiting) as failure_kind=unavailable without a timeout signal, so they mapped to SKILLEVALUATOR-DEPENDENCY-001. The branch maps every equivalent Bedrock and catalog deadline to DEPENDENCY-005 via timed_out=True; pass the same signal and code for the Vertex timeouts. Tests pin the Vertex timeout and HTTP status codes (401, 403, 404, 429, 500) and, end to end, that main's new GKE Workload Identity and Mosaic config prerequisite failures return the branch's prerequisite code (UNKNOWN) while Vertex credential/configuration rejections from the runtime plan return CONFIG-001. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Sync with main at 6068b3a: #124 (one versioned five-dimension overall-score policy, custom-only ranking and compare), #183 (Runta and Mosaic), #140 (GKE mode, Vertex AI routing for Claude Code, MCP declaration validation), #179 (performance dashboard) and the commits between them. Conflicts and resolutions: - CHANGELOG.md: main's Added entries (dashboard, GKE, Vertex AI, MCP validation) next to the PR's under Unreleased; main's Fixed entries were already present. One Added, Changed and Fixed heading each. - docs/cli-reference.mdx: the PR's agents row (experimental Hermes) and main's 27-mode env row (runta and mosaic selectable). - docs/reports.mdx, docs/tier3-live-evaluation.mdx: main's lift units and range sentence added to the PR's same-basis, N/A-aware lift text. - tier3/harbor/__init__.py: Docker Codex keeps the PR's subagent-aware local_agents wrapper; Docker Claude Code uses main's container wrapper. - tier3/harbor/local_agents.py: main's Vertex-aware SkillEvaluatorClaudeCode now also takes the PR's SetupNetworkErrorAgent mixin (every wrapper must rename setup network failures); the local and NVIDIA Build Claude Code wrappers inherit it from there; the PR's AgentSetupNetworkError and Codex rollout wrapper are kept. - tier3/harbor/adapter.py: main's MCP declaration models and fail-closed validate_mcp_server_declarations, and the PR's strict plugin_mcp_servers.toml loader; every loaded file, plugin servers included, now passes main's MCP security policy. - tier3/harbor/metrics.py: main's score policies, canonical dimension mean and overall_score_from_metrics, made N/A-aware: an N/A metric drops out of its dimension, a dimension with none scored drops out of the mean; the PR's finite_number replaces main's _finite_number. - tier3/harbor/templates/eval.py: main's dimension-mean overall with the PR's N/A exclusion (_reward_overall), main's Vertex token refresh, and the PR's fnmatch import. - tier3/harbor/templates/metric.py: main's metric-set and score-policy validation; a metric absent from the numeric-only reward.json is N/A (an explicit null or out-of-range value still fails); the overall is the dimension mean over scored dimensions; runs on older Pythons (future annotations, tuple isinstance). - tier3/harbor/collector.py: main's #124 policy handling ported into the PR's per-arm collector: each arm records its score policy (mixed policies fail it), its overall follows the policy, ambiguous policies reconcile and conflicting ones fail both conditions before any lift; the paired lift uses the shared policy, needs equal metric sets, and equals the difference of the condition overalls when both arms scored the same cases and metrics; pass@k lift needs equal metric sets; summaries carry score_policy and the results the per-condition overall, metrics and policy keys; N/A metrics stay in the run's metric list. - tier3/harbor/report_data.py: main's metric_set and score_policy keys, per arm key. - tier3/harbor/progress.py, runner.py, utils/redaction.py: both sides (secret-name regex, GKE imports and Vertex checks next to Hermes, ya29 redaction next to prefixed tokens). - tier3/commands.py (compare): main's policy and metric-set checks and custom-only handling with the PR's N/A rows; the Overall lift compares the metrics both arms scored. - tier3/result_display.py: main's policy-aware overall with N/A, main's custom-only Overall label with the PR's members and partial-run labels. - evaluation/tier3_report.py: _build_agent scores each arm by the score policy (N/A-aware for the current policy) and keeps the PR's same-basis lift, sum-of-parts and integration blocks; arms under different policies or metric sets get no lift; partial report builders resolve the same policy; main's attempt-policy read and the PR's dataset source. - uv.lock: main's lock plus the PR's regex dependency (uv lock --check). - tests (conftest, metrics truth, collector truth, public runtime, installed agent bootstrap): both sides. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…scan Main (#140) added 169.254.169.254 and metadata.google.internal to the credential stores the runtime security check flags, matching them as substrings of the command. The PR's scan matches credential stores as whole paths, so a command that reaches the metadata server by URL was no longer flagged (test_check_security_flags_imds_*). Both copies of the shared runtime-security block (eval_core/checks.py and the Harbor verifier template) now report an executed command that names either metadata host as a sensitive_path_access, as main does. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
…flight probe (#140) * fix(harbor): support Claude Code on Vertex AI and harden GKE execution * fix(harbor): add active 1-token probe for Vertex AI OpenAPI endpoints * fix(harbor): decouple agent provider routing and harden GKE environment * fix(harbor): address review comments on GKE execution and credentials handling * fix(harbor): harden GKE Workload Identity, MCP secret boundaries, and KUBECONFIG path merging * fix(harbor): address PR #140 review on ADC token refresh overwrite and MCP runtime env propagation * fix(tier3): enforce GKE pod SA isolation, ADC provenance gating, and per-exec token refresh * fix(tier3): harden GKE kubelet exec readiness, retry, redaction, and ADC refresh * fix(tier3): resolve GKE env kwargs in workflow preflight and harden ADC refresh * fix(harbor): enforce GKE metadata isolation and fix MCP placeholder stripping * fix(harbor): isolate metadata probe in companion container and allow DNS egress * fix(tier3): harden GKE metadata init probe, BusyBox wget, and Autopilot pod lifecycle Signed-off-by: Karl Weinmeister <[email protected]>
…flight probe (#140) * fix(deps): raise oauthlib floor to clear dependency review * fix(harbor): build the Claude container wrapper on the installed-agent bootstrap * fix(gke): do not replay exec commands whose completion status was lost * fix(gke): match the Autopilot node label prefix exactly Signed-off-by: Narendran Raghavan <[email protected]>
Conflicted files: - CHANGELOG.md: kept main's new --env-mode runta/mosaic entry and this branch's error-code entry under the single Added heading. - src/skillevaluator/tier3/harbor/runner.py: credential-probe loop keeps the branch's probe error-code derivation and passes main's (#140) env_mode to credential_probe_disposition. - src/skillevaluator/tier3/harbor/runtime_preflight.py: the catalog 404 ModelProbeResult keeps main's HTTPStatus.NOT_FOUND and the branch's MODEL_NOT_FOUND error code. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Main's Vertex AI and Vertex OpenAPI model probes (#140) report four timeouts (HTTP read, busy worker slot, expired deadline before start, deadline while waiting) as failure_kind=unavailable without a timeout signal, so they mapped to SKILLEVALUATOR-DEPENDENCY-001. The branch maps every equivalent Bedrock and catalog deadline to DEPENDENCY-005 via timed_out=True; pass the same signal and code for the Vertex timeouts. Tests pin the Vertex timeout and HTTP status codes (401, 403, 404, 429, 500) and, end to end, that main's new GKE Workload Identity and Mosaic config prerequisite failures return the branch's prerequisite code (UNKNOWN) while Vertex credential/configuration rejections from the runtime plan return CONFIG-001. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Conflicted files: - CHANGELOG.md: kept main's new --env-mode runta/mosaic entry next to the kata entry, and this branch's --previous-skill entry, under the single Added heading. - src/skillevaluator/tier3/workflow.py: kept the branch's early skip of preparation when --previous-skill shows the prior evaluation still applies, and inside the non-skip path took main's (#140) preflight that returns the resolved environment kwargs and passes them to the environment preflight. - tests/tier3/test_workflow.py: both sides appended tests at the end; kept the branch's previous-skill workflow tests and main's GKE env-var precedence test. tests/golden/cli_surface.json merged cleanly; regenerating it with `PYTHONPATH=src python tests/golden/generate_cli_surface.py` produced no change (the only difference from main is --previous-skill). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Sync with main at 6068b3a: #124 (one versioned five-dimension overall-score policy, custom-only ranking and compare), #183 (Runta and Mosaic), #140 (GKE mode, Vertex AI routing for Claude Code, MCP declaration validation), #179 (performance dashboard) and the commits between them. Conflicts and resolutions: - CHANGELOG.md: main's Added entries (dashboard, GKE, Vertex AI, MCP validation) next to the PR's under Unreleased; main's Fixed entries were already present. One Added, Changed and Fixed heading each. - docs/cli-reference.mdx: the PR's agents row (experimental Hermes) and main's 27-mode env row (runta and mosaic selectable). - docs/reports.mdx, docs/tier3-live-evaluation.mdx: main's lift units and range sentence added to the PR's same-basis, N/A-aware lift text. - tier3/harbor/__init__.py: Docker Codex keeps the PR's subagent-aware local_agents wrapper; Docker Claude Code uses main's container wrapper. - tier3/harbor/local_agents.py: main's Vertex-aware SkillEvaluatorClaudeCode now also takes the PR's SetupNetworkErrorAgent mixin (every wrapper must rename setup network failures); the local and NVIDIA Build Claude Code wrappers inherit it from there; the PR's AgentSetupNetworkError and Codex rollout wrapper are kept. - tier3/harbor/adapter.py: main's MCP declaration models and fail-closed validate_mcp_server_declarations, and the PR's strict plugin_mcp_servers.toml loader; every loaded file, plugin servers included, now passes main's MCP security policy. - tier3/harbor/metrics.py: main's score policies, canonical dimension mean and overall_score_from_metrics, made N/A-aware: an N/A metric drops out of its dimension, a dimension with none scored drops out of the mean; the PR's finite_number replaces main's _finite_number. - tier3/harbor/templates/eval.py: main's dimension-mean overall with the PR's N/A exclusion (_reward_overall), main's Vertex token refresh, and the PR's fnmatch import. - tier3/harbor/templates/metric.py: main's metric-set and score-policy validation; a metric absent from the numeric-only reward.json is N/A (an explicit null or out-of-range value still fails); the overall is the dimension mean over scored dimensions; runs on older Pythons (future annotations, tuple isinstance). - tier3/harbor/collector.py: main's #124 policy handling ported into the PR's per-arm collector: each arm records its score policy (mixed policies fail it), its overall follows the policy, ambiguous policies reconcile and conflicting ones fail both conditions before any lift; the paired lift uses the shared policy, needs equal metric sets, and equals the difference of the condition overalls when both arms scored the same cases and metrics; pass@k lift needs equal metric sets; summaries carry score_policy and the results the per-condition overall, metrics and policy keys; N/A metrics stay in the run's metric list. - tier3/harbor/report_data.py: main's metric_set and score_policy keys, per arm key. - tier3/harbor/progress.py, runner.py, utils/redaction.py: both sides (secret-name regex, GKE imports and Vertex checks next to Hermes, ya29 redaction next to prefixed tokens). - tier3/commands.py (compare): main's policy and metric-set checks and custom-only handling with the PR's N/A rows; the Overall lift compares the metrics both arms scored. - tier3/result_display.py: main's policy-aware overall with N/A, main's custom-only Overall label with the PR's members and partial-run labels. - evaluation/tier3_report.py: _build_agent scores each arm by the score policy (N/A-aware for the current policy) and keeps the PR's same-basis lift, sum-of-parts and integration blocks; arms under different policies or metric sets get no lift; partial report builders resolve the same policy; main's attempt-policy read and the PR's dataset source. - uv.lock: main's lock plus the PR's regex dependency (uv lock --check). - tests (conftest, metrics truth, collector truth, public runtime, installed agent bootstrap): both sides. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…scan Main (#140) added 169.254.169.254 and metadata.google.internal to the credential stores the runtime security check flags, matching them as substrings of the command. The PR's scan matches credential stores as whole paths, so a command that reaches the metadata server by URL was no longer flagged (test_check_security_flags_imds_*). Both copies of the shared runtime-security block (eval_core/checks.py and the Harbor verifier template) now report an executed command that names either metadata host as a sensitive_path_access, as main does. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Summary
Adds support for routing Claude Code through Google Cloud Agent Platform (Vertex AI) endpoints, hardens Harbor GKE runtime execution boundaries, and introduces an active 1-token preflight probe for Agent Platform OpenAPI endpoints.
Why this change is needed:
CLAUDE_CODE_USE_VERTEX=1) and authenticate via Application Default Credentials (ADC).--env-mode gke) requires enforcing security boundaries to reject cluster infrastructure settings in skill configs in favor of host CLI flags/environment variables, while ensuring credentials passed in--ekkeys/values are redacted from process listings without dropping rate limits or token configs.SKILLEVALUATOR_GKE_ALLOW_WORKLOAD_IDENTITY=0), enforces defense-in-depth metadata isolation via a pod-scoped egressNetworkPolicy(preserving UDP/TCP port 53 DNS), a pre-startskillevaluator-metadata-probe-initinit container, and a runtimeskillevaluator-metadata-probecompanion container, with automatic GKE Autopilot10Giephemeral-storage budgeting and fast failure on pod preemption.Verification
make lintmake testmake buildRelease Impact
CHANGELOG.md