diff --git a/CHANGELOG.md b/CHANGELOG.md index 5dbe60a..dfacc7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to the OpenClaw Home Assistant Integration will be documented in this file. +## [0.1.39] - 2026-02-20 + +### Fixed +- Aligned gateway chat requests with OpenClaw session behavior by sending OpenAI `user` with the stable session ID. +- Added `x-openclaw-session-key` request header for explicit session routing on OpenClaw gateways. +- Improves multi-turn continuity where `/v1/chat/completions` would otherwise default to stateless per-request sessions. +- Removed per-request chat-history replay to avoid unnecessary prompt growth when gateway session memory is active. + ## [0.1.37] - 2026-02-20 ### Fixed diff --git a/custom_components/openclaw/__init__.py b/custom_components/openclaw/__init__.py index 26a6f7e..5b0a610 100644 --- a/custom_components/openclaw/__init__.py +++ b/custom_components/openclaw/__init__.py @@ -78,7 +78,7 @@ _CARD_PATH = Path(__file__).parent / "www" / _CARD_FILENAME # URL at which the card JS is served (registered via register_static_path) _CARD_STATIC_URL = f"/openclaw/{_CARD_FILENAME}" # Versioned URL used for Lovelace resource registration to avoid stale browser cache -_CARD_URL = f"{_CARD_STATIC_URL}?v=0.1.37" +_CARD_URL = f"{_CARD_STATIC_URL}?v=0.1.39" OpenClawConfigEntry = ConfigEntry @@ -386,6 +386,7 @@ def _async_register_services(hass: HomeAssistant) -> None: system_prompt = apply_context_policy(raw_context, max_chars, strategy) _append_chat_history(hass, session_id, "user", message) + response = await client.async_send_message( message=message, session_id=session_id, diff --git a/custom_components/openclaw/__pycache__/__init__.cpython-312.pyc b/custom_components/openclaw/__pycache__/__init__.cpython-312.pyc index b775949..69d0de4 100644 Binary files a/custom_components/openclaw/__pycache__/__init__.cpython-312.pyc and b/custom_components/openclaw/__pycache__/__init__.cpython-312.pyc differ diff --git a/custom_components/openclaw/__pycache__/api.cpython-312.pyc b/custom_components/openclaw/__pycache__/api.cpython-312.pyc index 1e25152..8aff5c3 100644 Binary files a/custom_components/openclaw/__pycache__/api.cpython-312.pyc and b/custom_components/openclaw/__pycache__/api.cpython-312.pyc differ diff --git a/custom_components/openclaw/api.py b/custom_components/openclaw/api.py index 8d4fc10..4007e88 100644 --- a/custom_components/openclaw/api.py +++ b/custom_components/openclaw/api.py @@ -193,6 +193,7 @@ class OpenClawApiClient: } if session_id: payload["session_id"] = session_id + payload["user"] = session_id if model: payload["model"] = model @@ -200,6 +201,7 @@ class OpenClawApiClient: headers = self._headers() if session_id: headers["X-Session-Id"] = session_id + headers["x-openclaw-session-key"] = session_id session = await self._get_session() url = f"{self._base_url}{API_CHAT_COMPLETIONS}" @@ -253,12 +255,14 @@ class OpenClawApiClient: } if session_id: payload["session_id"] = session_id + payload["user"] = session_id if model: payload["model"] = model headers = self._headers() if session_id: headers["X-Session-Id"] = session_id + headers["x-openclaw-session-key"] = session_id session = await self._get_session() url = f"{self._base_url}{API_CHAT_COMPLETIONS}" diff --git a/custom_components/openclaw/manifest.json b/custom_components/openclaw/manifest.json index 79dc099..c18c93b 100644 --- a/custom_components/openclaw/manifest.json +++ b/custom_components/openclaw/manifest.json @@ -8,7 +8,7 @@ "iot_class": "local_polling", "issue_tracker": "https://github.com/techartdev/OpenClawHomeAssistant/issues", "requirements": [], - "version": "0.1.37", + "version": "0.1.39", "dependencies": ["conversation"], "after_dependencies": ["hassio", "lovelace"] } diff --git a/www/openclaw-chat-card.js b/www/openclaw-chat-card.js index 5807994..bbaa813 100644 --- a/www/openclaw-chat-card.js +++ b/www/openclaw-chat-card.js @@ -1,7 +1,7 @@ (async () => { try { if (!customElements.get("openclaw-chat-card")) { - const src = "/openclaw/openclaw-chat-card.js?v=0.1.37"; + const src = "/openclaw/openclaw-chat-card.js?v=0.1.39"; console.info("OpenClaw loader importing", src); await import(src); }