fix(python): budget cold profile initialization

The Windows x64 installed-wheel job timed out while waiting for initialize even though the same head passed on rerun. Exact packaged-runtime VM evidence showed a 6.47-second first cold handshake and 2.69-2.94-second warm fresh-home handshakes, leaving too little variance below the public 10-second default.\n\nRaise the independent initialize default to 30 seconds in both Python SDK configuration layers. Ordinary turn and shutdown timeouts remain unchanged, callers retain an explicit override, and tests plus paired documentation pin the public behavior.
This commit is contained in:
Tianyi Cui
2026-08-24 19:09:40 +08:00
parent 8101a0d097
commit dff3e18afd
9 changed files with 14 additions and 8 deletions
+2 -2
View File
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write python/sdk/README.md
README.md: cf9bb3e3ccac4908e9212d8f7247545b5a6b5d8e
README.zh.md: 9acb8f26129144a77a834f94854cdd3f1a200086
README.md: 1b03fe5553f25da3bc62f8a7eec2a274b0afb66a
README.zh.md: c0bfa8bdd9e2ecbaad0a019a274b94516e219ac6
+1 -1
View File
@@ -26,7 +26,7 @@ with DeepSeekHarness(
print(result.final_response)
```
`DeepSeekHarness` starts lazily and reuses its runtime until `close()` or context-manager exit. The initial profile handshake has an independent 10-second default bound through `initialize_timeout_seconds`; ordinary turns remain unbounded unless `request_timeout_seconds` is set. A timeout names the selected profile and includes retained runtime diagnostics. `cwd` is the agent workspace; `runtime_cwd` independently selects the subprocess working directory. Both become absolute before launch. `provider`, `model`, and optional positive `max_tokens` are sent during JSON-RPC initialization. `base_url` and `api_key` explicitly override `DEEPSEEK_BASE_URL` and `DEEPSEEK_API_KEY` in the child environment.
`DeepSeekHarness` starts lazily and reuses its runtime until `close()` or context-manager exit. The initial profile handshake has an independent 30-second default bound through `initialize_timeout_seconds`; ordinary turns remain unbounded unless `request_timeout_seconds` is set. A timeout names the selected profile and includes retained runtime diagnostics. `cwd` is the agent workspace; `runtime_cwd` independently selects the subprocess working directory. Both become absolute before launch. `provider`, `model`, and optional positive `max_tokens` are sent during JSON-RPC initialization. `base_url` and `api_key` explicitly override `DEEPSEEK_BASE_URL` and `DEEPSEEK_API_KEY` in the child environment.
## Customize plugins
+1 -1
View File
@@ -26,7 +26,7 @@ with DeepSeekHarness(
print(result.final_response)
```
`DeepSeekHarness` 延迟启动运行时,并在调用 `close()` 或退出上下文管理器前复用该进程。首次 profile 握手通过 `initialize_timeout_seconds` 使用独立的 10 秒默认上限;普通轮次在未设置 `request_timeout_seconds` 时仍不设上限。超时诊断会指明所选 profile,并包含保留的运行时诊断。`cwd` 是 agent workspace`runtime_cwd` 独立选择子进程工作目录。两者都会在启动前转成绝对路径。`provider``model` 和可选的正整数 `max_tokens` 通过 JSON-RPC 初始化发送。`base_url``api_key` 会显式覆盖子进程环境中的 `DEEPSEEK_BASE_URL``DEEPSEEK_API_KEY`
`DeepSeekHarness` 延迟启动运行时,并在调用 `close()` 或退出上下文管理器前复用该进程。首次 profile 握手通过 `initialize_timeout_seconds` 使用独立的 30 秒默认上限;普通轮次在未设置 `request_timeout_seconds` 时仍不设上限。超时诊断会指明所选 profile,并包含保留的运行时诊断。`cwd` 是 agent workspace`runtime_cwd` 独立选择子进程工作目录。两者都会在启动前转成绝对路径。`provider``model` 和可选的正整数 `max_tokens` 通过 JSON-RPC 初始化发送。`base_url``api_key` 会显式覆盖子进程环境中的 `DEEPSEEK_BASE_URL``DEEPSEEK_API_KEY`
## 自定义插件
+1 -1
View File
@@ -29,7 +29,7 @@ class DeepSeekHarnessConfig:
patches: tuple[str, ...] = ()
dsh_home: str | None = None
env: dict[str, str] = field(default_factory=dict)
initialize_timeout_seconds: float = 10.0
initialize_timeout_seconds: float = 30.0
request_timeout_seconds: float | None = None
shutdown_timeout_seconds: float | None = 1.0
base_url: str | None = None
+1 -1
View File
@@ -31,7 +31,7 @@ class HarnessConfig:
dsh_home: str | None = None
cwd: str | None = None
env: dict[str, str] | None = None
initialize_timeout_seconds: float = 10.0
initialize_timeout_seconds: float = 30.0
request_timeout_seconds: float | None = None
shutdown_timeout_seconds: float | None = 1.0
_launch_args: tuple[str, ...] | None = None
+2
View File
@@ -873,6 +873,8 @@ def test_public_signatures_omit_unsupported_wire_parameters() -> None:
)
assert "initialize_timeout_seconds" in DeepSeekHarnessConfig.__dataclass_fields__
assert "initialize_timeout_seconds" in HarnessConfig.__dataclass_fields__
assert DeepSeekHarnessConfig().initialize_timeout_seconds == 30.0
assert HarnessConfig().initialize_timeout_seconds == 30.0
for removed in ("cordis", "session_root", "runtime_bin", "bridge_bin", "launch_args_override"):
assert removed not in DeepSeekHarnessConfig.__dataclass_fields__
assert removed not in HarnessConfig.__dataclass_fields__