Skip to content

fix: support ALIBABA_CLOUD_REGION_ID env var as fallback for region_id#92

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/fix-region-id-logic
Closed

fix: support ALIBABA_CLOUD_REGION_ID env var as fallback for region_id#92
Copilot wants to merge 2 commits intomainfrom
copilot/fix-region-id-logic

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 22, 2026

Config only fell back to AGENTRUN_REGION / FC_REGION for region_id, breaking the ALIBABA_CLOUD_* convention followed by every other credential parameter. Users who set ALIBABA_CLOUD_REGION_ID (standard Alibaba Cloud SDK env var) received cn-hangzhou instead of their configured region.

Changes

  • agentrun/utils/config.py — add ALIBABA_CLOUD_REGION_ID to the region_id fallback chain; update docstring to document all supported env vars
    • Lookup order: explicit param → AGENTRUN_REGIONFC_REGIONALIBABA_CLOUD_REGION_ID"cn-hangzhou"
  • tests/unittests/utils/test_config_extended.py — add tests for ALIBABA_CLOUD_REGION_ID resolution and priority ordering
# Now works without requiring AGENTRUN_REGION
os.environ["ALIBABA_CLOUD_REGION_ID"] = "cn-shanghai"
config = Config()
config.get_region_id()  # "cn-shanghai"

Copilot AI linked an issue Apr 22, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix logic for retrieving region_id in Config method fix: support ALIBABA_CLOUD_REGION_ID env var as fallback for region_id Apr 22, 2026
Copilot AI requested a review from OhYee April 22, 2026 13:44
@OhYee
Copy link
Copy Markdown
Member

OhYee commented May 6, 2026

关闭:暂不扩展更多环境变量。

我们倾向于先收敛而非继续累加 env var fallback 链(当前每个字段已有 2-3 个名字并存)。如未来决定全面对齐 ALIBABA_CLOUD_* 标准,会作为一次系统性改造统一处理(同时覆盖 region_id、account_id 等),而非按字段单独 PR。

感谢贡献 🙏

@OhYee OhYee closed this May 6, 2026
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.

region_id 获取值的逻辑有问题

2 participants