MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / _resolve_session_id

Function _resolve_session_id

uncommon_route/proxy.py:942–949  ·  view source on GitHub ↗

Derive a session ID for cache keys and composition (not routing).

(request: Request, body: dict)

Source from the content-addressed store, hash-verified

940
941
942def _resolve_session_id(request: Request, body: dict) -> str | None:
943 """Derive a session ID for cache keys and composition (not routing)."""
944 raw_headers = {k: v for k, v in request.headers.items()}
945 sid = raw_headers.get("x-session-id") or raw_headers.get(_OPENCLAW_SESSION_HEADER)
946 if sid:
947 return sid
948 messages = body.get("messages", [])
949 return derive_session_id(messages)
950
951
952# Process-wide registry for derive_session_id_v2 (shadow mode).

Callers 2

_build_selector_previewFunction · 0.85
_handle_chat_coreFunction · 0.85

Calls 2

derive_session_idFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected