Files
deepseek-harness/python/sdk/src
LegGasai 0750436cb4 feat(sdk): report why a session agent was disposed (#8738)
* feat(sdk): report why a session agent was disposed

A request for a session whose agent left the registry now states whether the
whole runtime is shutting down, the SDK server is shutting down, or only the
agent loop was unloaded. During runtime shutdown it names the last process
event observed before teardown; for an agent-loop unload it gives the time and
the plugin whose unload began first. The liveness check reads the registry as
optional, so both stages of root disposal report the same failure.

Refs #8737

* fix(sdk): keep the runtime observation out of the plugin entry exports

The static gates reject a new read of the Cordis root context, a value export
from a function plugin entry, and new assertions to unknown. The plugin entry
now passes the server an observation built from the root fiber it already
holds, the helper lives in the internal process-events module, and the new
tests complete the handshake instead of casting the server.

Refs #8737

* fix(sdk): keep the process-event record from throwing and state the unload origin as an observation

A rejection value without a string form made the failure text throw inside a
prepended listener, which would end the dispatch before the listener that owns
the event. The text now falls back to a fixed marker. The plugin named for an
agent-loop unload is the first one unloading at that time, which overlapping
unloads can make unrelated, so the message and README say that.

Refs #8737

* feat(python-sdk): log the runtime's stderr lines as they arrive

The runtime writes its fatal report, including the stack of an unhandled
rejection that ends the process, to its own stderr. The SDK kept those lines
in memory and attached them only to initialization, timeout, and transport
failures, so a host saw none of it for an ordinary JSON-RPC error. Each line
now also goes to the Python logger deepseek_harness.runtime at INFO.

Refs #8737
2026-11-19 07:59:52 +00:00
..