Skip to content

fix(harness): improve error message when model API key is missing#85

Open
anj-s wants to merge 1 commit into
mainfrom
u/anj/issue-63-agent-error-msg
Open

fix(harness): improve error message when model API key is missing#85
anj-s wants to merge 1 commit into
mainfrom
u/anj/issue-63-agent-error-msg

Conversation

@anj-s

@anj-s anj-s commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Implemented robust credentials validation inside the Antigravity Python harness server (harness_server.py) before entering the agent session context.
  • Validates environment variables (GEMINI_API_KEY, GOOGLE_API_KEY, GOOGLE_GENAI_USE_VERTEXAI, GOOGLE_GENAI_USE_ENTERPRISE) with explicit truthiness checking (e.g. ignoring "False" strings).
  • Validates programmatic credentials defined directly in configuration files, including top-level properties and nested gemini_config (supporting both shared and model-specific models.default.api_key properties).
  • Cleans up standard imports (moving import os to the top of harness_server.py).
  • Added pytest unit tests:
    • test_grpc_connect_missing_credentials: verifies failure response when credentials are not configured.
    • test_grpc_connect_programmatic_credentials: verifies success response when credentials are set programmatically inside the config file despite missing environment variables.
  • Updated mock_config fixture to inject mock env keys by default, ensuring existing success tests pass cleanly in clean CI environments.

Type of Change

  • Bug fix
  • Refactor

Related Issues

Closes #63

Test Plan

  • Python tests pass: pytest python/antigravity/harness_server_test.py
  • Go integration tests pass: go test ./...

Closes #63. Checks for GEMINI_API_KEY, GOOGLE_API_KEY, and GOOGLE_GENAI_USE_VERTEXAI environment variables inside the Antigravity Python harness server before executing the turn, yielding a descriptive STATE_FAILED gRPC response detailing how the user can set the environment keys.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve error message when agent process has errors

1 participant