← Back to Pull requests

fix: check --env flags when validating API keys during deploy #292

Closed
unknown closed this pull request without merging on Mar 11, 2026 20:13 UTC
View on GitHub
unknown unknown commented on Mar 06, 2026 05:06 UTC
Author

Description

  • Adds --env / -e flag to arctl agent deploy for passing environment variables (KEY=VALUE)

  • validateAPIKey() now checks --env values before falling back to OS environment

  • buildDeployConfig() includes all --env entries in the deployment config, with flag values taking precedence over OS env

  • Fixes the reported issue where arctl agent deploy myagent --env GOOGLE_API_KEY=somekey failed with "required API key not set"

  • Adds --env / -e flag to arctl agent run for passing environment variables (KEY=VALUE) (for command consistency)

  • Updated agent run tests to verify behavior.
  • Fixes #151

    /kind fix
    

    ``release-note
    Add missing
    --env flag for arctl agent deploy to allow setting environment variables on the agent deployment.

    
    ## Validation Steps
    
    
    sh

    assuming you don't have GOOGLE_API_KEY env set already...

    agent deploy test


    go run cmd/cli/main.go agent init adk python dice
    go run cmd/cli/main.go agent build dice
    go run cmd/cli/main.go agent publish dice
    go run cmd/cli/main.go agent deploy dice # hit error
    go run cmd/cli/main.go agent deploy dice --env GOOGLE_API_KEY=test # works

    agent run test


    go run cmd/cli/main.go agent init adk python dice
    go run cmd/cli/main.go agent build dice
    go run cmd/cli/main.go agent run dice # hit error
    go run cmd/cli/main.go agent run dice --env GOOGLE_API_KEY=test # pass
    `

    Test plan


  • New TestValidateAPIKey_WithExtraEnv (6 cases): extra env, OS env, missing, precedence, nil fallback, unknown provider

  • New TestBuildDeployConfig_WithEnvOverrides` (5 cases): override inclusion, precedence, OS fallback, telemetry, absent keys

  • All existing agent CLI tests pass
  • 🤖 Generated with Claude Code

    Diff: 225 lines (+168 / -57) across 2 files Reviewer: inFocus7 Review duration: 8106m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.60) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.60 · 225 lines diff across 2 files
    0.60
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    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.324
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.060
    Real PR Conversation Timeline
    1 comments
    "Review active on #292"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% 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: 60.1% (MEDIUM) · Higher = larger blast radius
    60.1%
    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: 56.8% · Lower = rushed or shallow review
    56.8%
    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: 26.0% · Safe to merge
    26.0%