← Back to Pull requests

vxpu: adopt gke-labs-infra/options for CLI flags and env config #1108

Merged
codebot-robot merged 8 files (913 lines) on Dec 06, 2026 14:20 UTC
View on GitHub
codebot-robot codebot-robot commented on Dec 06, 2026 02:19 UTC
Author

vxpu/options: wrap gke-labs-infra/options with VXPU_ default prefix

Add github.com/gke-labs/gke-labs-infra/options to vxpu/go.mod and expose
it through a thin local wrapper in vxpu/pkg/options with
DefaultEnvPrefix = "VXPU_".

The wrapper re-exports Defaulter, ResolveOption, InitDefaults,
BindFlags, LoadEnv, LoadEnvFrom, LoadMap, UnknownMapKeys, and the
ResolveOption builders, and prepends WithEnvPrefix(DefaultEnvPrefix) in
Resolve and Parse so vXPU binaries inherit VXPU_ environment loading
while allowing WithEnvPrefix overrides or WithoutEnv.

vxpu/machines: add composable HardwarePricingOptions using vxpu/pkg/options

Add InitDefaults and Validate methods to PricingOptions and introduce a
composable HardwarePricingOptions struct (HardwareLifetimeYears and
ElectricityUSDPerKWH) that binds cleanly to --hardware-lifetime-years,
--electricity-usd-per-kwh, VXPU_HARDWARE_LIFETIME_YEARS, and
VXPU_ELECTRICITY_USD_PER_KWH through vxpu/pkg/options.

Back ParsePricingOptions and ResolvePricingOptions with
HardwarePricingOptions and options.Resolve while preserving existing
callers and backwards-compatible empty-env handling.

vxpu/router: parse CLI flags and VXPU_ env vars with vxpu/pkg/options

Replace hand-rolled flag registration, flag.Visit precedence tracking,
and os.Getenv fallbacks in vxpu/cmd/vxpu-router/main.go with a
composable routerOptions struct embedding
machines.HardwarePricingOptions and parsed via vxpu/pkg/options.Parse.

Use a WithLookupEnv wrapper to preserve existing VXPU_ environment
variable names whose flag names differ from their env names
(VXPU_EXECUTOR_IMAGE, VXPU_MODELSTORE_URL, and VXPU_EXTERNAL_EXECUTORS)
and treat empty or whitespace-only environment values from manifests
such as router.yaml as unset.

Add behavioral tests covering defaults, VXPU_ environment variables,
explicit CLI flag precedence (including flags equal to defaults), empty
env fallbacks, klog flag coexistence, and validation errors.

Verified with ap generate --verify //..., ap lint //..., and ap test //....

Fixes #1107

Diff: 913 lines (+784 / -129) across 8 files Reviewer: justinsb Review duration: 720m
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.76) × (1 − Review Confidence (0.69)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.76 · 913 lines diff across 8 files
0.76
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.41 · 2 substantive comment(s)
0.41
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
68%
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.400
Sensitive Paths sensitive_paths
0.076
Real PR Conversation Timeline
6 items
kube-agents-bot[bot] kube-agents-bot[bot] commented on Dec 06, 2026 02:19 UTC
Bot

<!-- kube-agents-bot:intro -->
Hello, I'm kube-agents-bot 👋 I read
pull requests here and flag what looks wrong. I've started on this one — I'll post my
findings in a few minutes, or tell you I found none.

| Command | What it does |
| --- | --- |
| /review | The strict read of the current commit: what I'm certain of, plus a high-severity finding just under that bar, marked as such. |
| /review all | The same read, kept wider — findings I checked and believe are real as well as the ones I'm certain of. This is what my first review of a pull request does. |
| /review fresh | Reads the commit again from scratch. Without it, a command on a commit I have already read re-cuts that read at the bar you asked for instead of reading again — same findings, other bar, no cost — and says so. |

Comment any of them on a line of its own. Repository owners, members and collaborators only.

Worth knowing:

  • I review automatically when a pull request is opened, reopened, or marked ready for

  • review
    . Pushing more commits does _not_ start a new review — comment /review when
    you want another look, or /review all for one as wide as the first. The one
    exception: if I said the branch doesn't merge, I'll start on my own after your next push.
  • I always say when I'm done, even when I found nothing — so a review that finishes

  • clean gets a short "no findings" note rather than silence, saying how I read the change
    and how many possible issues I checked on the way. The 👀 means I've started; a comment
    from me means I've finished. If you get 👀 and nothing follows, I broke.
  • I never push code and never merge. I comment; I approve only where this repository's

  • own configuration asks me to, and otherwise I am not a required approval.
  • Low-severity items I confirm — a literal that could be named, a sentence a change made

  • stale — are folded into a collapsed list in my summary, not posted as findings, and
    don't count against the review. Whether to act on them is your call; nothing waits on
    them.
  • I judge a change against the code, against any principles this repository has

  • written down and pointed me at, and with the review method it has nominated, if it
    has one. Whether a feature or a design should exist at all is
    a human's call — a review from me saying nothing about that is not an endorsement.
  • Label a pull request agent:ignore and I will leave it alone entirely, /review

  • included.
  • I can be wrong. Check anything I say before acting on it.
  • kube-agents-bot[bot] kube-agents-bot[bot] commented on Dec 06, 2026 02:24 UTC
    Reviewer

    No findings. I read this change three ways and checked 2 possible issues against the code; none cleared the bar.

    _This was a wider pass: as well as what I am certain of, it includes findings I checked and believe are real without being sure. Comment /review for a stricter re-read._

    ---

    Automated review by kube-agents-bot ec8b09e on kube-agents-bot-gke.
    Triggered by this pull request being opened; read d813314 as merged into main.

    <sub>React 👍 if this was useful, 👎 if it was not. Add the agent:ignore label to opt this pull request out.</sub>

    justinsb justinsb requested changes on Dec 06, 2026 03:35 UTC
    Changes Requested Reviewer

    (Automatic review) on d813314a99dc6d4dbf5df24b318853dfdb1dfdbf: the code looks clean and the only CI failure (test-vxpu-gpu (python)) was a Spot preemption, but this branch now has merge conflicts with main. Please rebase onto main, resolve the conflicts, and re-verify with ap generate, ap lint, and ap test.

    justinsb justinsb approved these changes on Dec 06, 2026 06:04 UTC
    Approved Reviewer

    (Automatic review) Approved on d46b62c7bdb827dc85b7114d6799fd22538f2fac. All checks pass (note: test-vxpu-gpu (go-router) was rerun after an unrelated TestSeparateDraftSpeculationOverGRPC segfault flake and a Spot preemption, then passed).

    justinsb justinsb commented on code on Dec 06, 2026 14:20 UTC
    Code Review
    vxpu/pkg/options/options_test.go:1
    @@ -0,0 +1,136 @@
    +// Copyright 2026 Google LLC
    +//
    +// Licensed under the Apache License, Version 2.0 (the "License");
    +// you may not use this file except in compliance with the License.
    +// You may obtain a copy of the License at
    +//
    +//     http://www.apache.org/licenses/LICENSE-2.0
    +//
    +// Unless required by applicable law or agreed to in writing, software
    +// distributed under the License is distributed on an "AS IS" BASIS,
    +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +// See the License for the specific language governing permissions and
    +// limitations under the License.
    +
    +package options
    +
    +import (
    +	"flag"
    +	"io"
    +	"slices"
    +	"testing"
    +)
    +
    +type wrapperTestOptions struct {
    +	Name  string
    +	Port  int
    +	Hosts []string
    +}
    +
    +func (opts *wrapperTestOptions) InitDefaults() {
    +	opts.Name = "default-name"
    +	opts.Port = 50051
    +}
    +
    +func mapEnvLookup(values map[string]string) func(string) (string, bool) {
    +	return func(key string) (string, bool) {
    +		value, ok := values[key]
    +		return value, ok
    +	}
    +}
    +
    +func TestDefaultEnvPrefixDelegation(t *testing.T) {

    follow-on: I'm not sure these tests are valuable. See the tests section of here, for example: https://raw.githubusercontent.com/gke-labs/eval-runner/refs/heads/main/AGENTS.md

    Reviewers
    Assignees
    codebot-robot codebot-robot
    Labels
    risk: low confidence: 68.7% reviewed sensitive_module
    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: 76.4% (HIGH) · Higher = larger blast radius
    76.4%
    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: 68.7% · Lower = rushed or shallow review
    68.7%
    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: 23.9% · Safe to merge
    23.9%