Update the state of a thread.
On HTTP 409 (ConflictError) the server still considers the thread
busy — typically because the client cancelled the SSE stream before
the server finished the run. In that case, cancel any pending/running
runs with wait=True and retry the state update once. Per-run cancel
waits are bounded by _RUN_CANCEL_WAIT_SECONDS and run concurrently,
so callers cannot block indefinitely regardless of how many runs were
active.
Other exceptions from the underlying graph (server/network errors) are logged at DEBUG level and re-raised so callers can decide how to surface them (callers typically log at WARNING with a friendlier message).
Optional graph node to attribute the state update to.