Skip to content

Conversation

@ryoppippi
Copy link
Member

@ryoppippi ryoppippi commented Aug 18, 2025

Summary

This PR removes the automatic loading of the STACKONE_ACCOUNT_ID environment variable from the StackOneToolSet initialization. This change provides more explicit control over account ID configuration.

Changes Made

  • Removed automatic fallback to os.getenv(STACKONE_ACCOUNT_ID) in StackOneToolSet.init()
  • Updated docstring to reflect that account_id parameter requires explicit provision
  • Updated CLAUDE.md documentation to clarify the new behavior

Rationale

  • Improves code clarity by requiring explicit account ID provision when needed
  • Prevents unexpected behavior from environment variables
  • Maintains consistency with explicit configuration patterns
  • The API key still supports environment variable fallback as it is required for authentication

Testing

  • All existing tests pass without modification
  • No breaking changes to the public API (account_id parameter remains optional)
  • Type checking and linting pass

Test plan

  • Run existing test suite to ensure no regressions
  • Verify linting and type checking pass
  • Confirm that account_id=None behavior works as expected

Summary by cubic

Removed automatic loading of STACKONE_ACCOUNT_ID in StackOneToolSet; account_id is now used only when passed explicitly. This makes configuration predictable while keeping STACKONE_API_KEY env fallback; docs updated.

  • Migration
    • If you relied on the STACKONE_ACCOUNT_ID env var, pass account_id explicitly when creating StackOneToolSet.

Remove automatic loading of STACKONE_ACCOUNT_ID from environment variables in StackOneToolSet initialization to provide more explicit control over account ID configuration.

The account_id parameter now requires explicit provision if needed, improving clarity and preventing unexpected behavior from environment variables.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes automatic environment variable loading for the STACKONE_ACCOUNT_ID in the StackOneToolSet initialization. The change requires explicit provision of the account_id parameter when needed, improving code clarity and preventing unexpected behavior from environment variables.

Key Changes

  • Removed automatic fallback to os.getenv("STACKONE_ACCOUNT_ID") in StackOneToolSet.init()
  • Updated docstring and documentation to clarify that account_id requires explicit provision
  • Maintained the API key's environment variable fallback for authentication purposes

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
stackone_ai/toolset.py Removed automatic STACKONE_ACCOUNT_ID environment variable loading and updated docstring
CLAUDE.md Updated documentation to clarify that account_id requires explicit provision

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

toolset = StackOneToolSet(
api_key="your-api-key", # or STACKONE_API_KEY env var
account_id="optional-id" # or STACKONE_ACCOUNT_ID env var
account_id="optional-id" # explicit account ID required
Copy link

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment 'explicit account ID required' is contradictory since the parameter is still optional (as indicated by 'optional-id'). Consider changing to 'explicit account ID if needed' or similar to clarify that while the parameter is optional, when provided it must be explicit.

Suggested change
account_id="optional-id" # explicit account ID required
account_id="optional-id" # explicit account ID if needed

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryoppippi good flag here from copilot, is this optional (as the value seems to indicate) or is this required?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no we can set it later.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files. Review in cubic

Copy link
Contributor

@glebedel glebedel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

toolset = StackOneToolSet(
api_key="your-api-key", # or STACKONE_API_KEY env var
account_id="optional-id" # or STACKONE_ACCOUNT_ID env var
account_id="optional-id" # explicit account ID required
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryoppippi good flag here from copilot, is this optional (as the value seems to indicate) or is this required?

@ryoppippi ryoppippi merged commit aa0aaf6 into main Aug 18, 2025
3 checks passed
@ryoppippi ryoppippi deleted the ENG-10861-remove-auto-env-vars-loading-in-python-ai-sdk branch August 18, 2025 16:45
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.

3 participants