fix(python-sdk): harden profile runtime startup

Resolve packaged profile proxies with Node ESM import conditions from each package installation, and fail loud when an explicit runtime export or legacy main entry is missing. Serialize the shared profile fallback under the existing cross-process writer lock so concurrent dsh processes cannot observe partial proxies; either carrier now replaces the other carrier’s managed entry without manual cleanup.

Give Python initialize its own 10-second default bound and name the selected profile in timeout diagnostics, while leaving ordinary agent turns unbounded by default. Package the dynamically resolved web frontend and skill-badge assets so the runtime wheel’s normal dsh profiles do not depend on pkg static-discovery accidents.

Rewrite the root launch rule and every active stale SDK-runtime note to the shipped dsh profile architecture in both languages. Focused tests prove import-only and transitive package exports, lock contention, cross-carrier transitions, missing-entry failures, asset inventory, and bounded initialization.
This commit is contained in:
Tianyi Cui
2026-08-24 17:28:27 +08:00
parent f0f9b294dd
commit 9edf1b9f10
35 changed files with 321 additions and 127 deletions
+5 -1
View File
@@ -731,7 +731,8 @@ time.sleep(60)
with HarnessClient(
HarnessConfig(
_launch_args=(sys.executable, str(script)),
request_timeout_seconds=0.1,
profile="web",
initialize_timeout_seconds=0.1,
)
) as client:
start = time.monotonic()
@@ -740,6 +741,7 @@ time.sleep(60)
except TimeoutError as exc:
assert time.monotonic() - start < 2
assert "bridge is still starting" in str(exc)
assert "profile 'web'" in str(exc)
else:
raise AssertionError("initialize should time out")
@@ -832,6 +834,8 @@ def test_public_signatures_omit_unsupported_wire_parameters() -> None:
assert {"dsh_bin", "profile", "patches", "dsh_home"} <= set(
HarnessConfig.__dataclass_fields__
)
assert "initialize_timeout_seconds" in DeepSeekHarnessConfig.__dataclass_fields__
assert "initialize_timeout_seconds" in HarnessConfig.__dataclass_fields__
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__