Fix config not propagated to data-plane URL construction in DataAPI and Sandbox.__get_client()#88
Draft
Fix config not propagated to data-plane URL construction in DataAPI and Sandbox.__get_client()#88
Conversation
Copilot
AI
changed the title
[WIP] Fix Sandbox.delete_by_id config merging issue
Fix config not propagated to data-plane URL construction in DataAPI and Sandbox.__get_client()
Apr 20, 2026
OhYee
added a commit
that referenced
this pull request
Apr 25, 2026
问题,但同模式在其他资源模块依然存在:调用方一路向下传递 config,但在 ResourceClass.__get_client() 这一层被静默丢弃,导致下层 Client / DataAPI 以空 config 构造 base URL,最终抛出 "account id is not set"。 本次扩展同样修复至 6 个资源模块和 endpoint 调用点: - agent_runtime/runtime: __get_client() 新增 config 形参并转发到 AgentRuntimeClient,14 处调用全部补齐 config 实参 - agent_runtime/endpoint: __get_client() 已接受 config 但 12 处调用未传, 逐一修正;同时修复实例方法 get_async 调用 get_by_id_async 时漏传 config 的同类问题 - credential/credential: 同 runtime 修复模式 - knowledgebase/knowledgebase: 同 runtime 修复模式 - memory_collection/memory_collection: 同 runtime 修复模式 - model/model_service: 同 runtime 修复模式 - model/model_proxy: 同 runtime 修复模式 实际改动只发生在 __*_async_template.py 源文件上,同步版本通过 make codegen 重新生成,确保与 #88 已修复的 sandbox 模块保持完全一致的写法。 收益:调用方在 ResourceClass.method(config=cfg) 处提供的 config 现在能 完整传到 base URL 构造、auth、headers 全链路,不再因 __get_client 层丢失 而触发 account_id 缺失或落到错误 endpoint 的问题。 Change-Id: Iff7177062d1ad574f9a65eb663aff70e670e7fcd Co-developed-by: Claude <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: OhYee <oyohyee@oyohyee.com>
…) config forwarding Agent-Logs-Url: https://github.com/Serverless-Devs/agentrun-sdk-python/sessions/0e50b98f-f5e7-4961-a4fc-b9669d0ee8af Co-authored-by: OhYee <13498329+OhYee@users.noreply.github.com> Signed-off-by: OhYee <oyohyee@oyohyee.com>
问题,但同模式在其他资源模块依然存在:调用方一路向下传递 config,但在 ResourceClass.__get_client() 这一层被静默丢弃,导致下层 Client / DataAPI 以空 config 构造 base URL,最终抛出 "account id is not set"。 本次扩展同样修复至 6 个资源模块和 endpoint 调用点: - agent_runtime/runtime: __get_client() 新增 config 形参并转发到 AgentRuntimeClient,14 处调用全部补齐 config 实参 - agent_runtime/endpoint: __get_client() 已接受 config 但 12 处调用未传, 逐一修正;同时修复实例方法 get_async 调用 get_by_id_async 时漏传 config 的同类问题 - credential/credential: 同 runtime 修复模式 - knowledgebase/knowledgebase: 同 runtime 修复模式 - memory_collection/memory_collection: 同 runtime 修复模式 - model/model_service: 同 runtime 修复模式 - model/model_proxy: 同 runtime 修复模式 实际改动只发生在 __*_async_template.py 源文件上,同步版本通过 make codegen 重新生成,确保与 #88 已修复的 sandbox 模块保持完全一致的写法。 收益:调用方在 ResourceClass.method(config=cfg) 处提供的 config 现在能 完整传到 base URL 构造、auth、headers 全链路,不再因 __get_client 层丢失 而触发 account_id 缺失或落到错误 endpoint 的问题。 Change-Id: Iff7177062d1ad574f9a65eb663aff70e670e7fcd Co-developed-by: Claude <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: OhYee <oyohyee@oyohyee.com>
__get_client(config=config) 链式调用超过行宽,需要折行。仅为格式调整, 不改变运行时行为。 Change-Id: Ie74ebdffd6f7f9dec413b60b195d3a019433e258 Co-developed-by: Claude <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: OhYee <oyohyee@oyohyee.com>
a27ca65 to
e6d5dc9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
config(carryingaccount_id, region, credentials, etc.) was passed only at call time (not at construction), it was silently ignored during data-plane base URL assembly, causingValueError: account id is not seteven though a valid config was provided.Two independent bugs:
DataAPIHTTP methods ignoredconfiginwith_path()—get,post,put,patch,delete(and their_asyncvariants), pluspost_file,get_file,get_videoall calledself.with_path(path, query=query)without forwardingconfig. Sincewith_path→get_base_url(config)usesConfig.with_configs(self.config, config), the call-site config never reached URL construction.Sandbox.__get_client()always returned a config-lessSandboxClient()— so even if every downstream method receivedconfig=config, theSandboxDataAPIinstance embedded in the client was initialized with an empty config.Changes
agentrun/utils/data_api.py+__data_api_async_template.py: All 16 HTTP wrapper methods now passconfigtowith_path():agentrun/sandbox/sandbox.py+__sandbox_async_template.py:__get_client()now accepts and forwardsconfig:All ~20 call sites updated to pass
config=config.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
astral.sh/usr/bin/curl curl -LsSf REDACTED(dns block)If you need me to access, download, or install something from one of these locations, you can either: