Repository navigation
Add SpaceXSI conversation integration - #181709
jeffglousher wants to merge 8 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Setup must reject or recover from a configured model that is no longer available.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a community-maintained SpaceXAI conversation integration using browser OAuth and Grok models.
Changes:
- Adds OAuth device authorization and token refresh.
- Adds conversation history, Assist tools, and model selection.
- Adds metadata, dependency registration, and comprehensive tests.
File summaries
| File | Description |
|---|---|
.strict-typing |
Enables strict typing. |
CODEOWNERS |
Assigns integration ownership. |
homeassistant/components/spacexai/__init__.py |
Manages setup, OAuth, and runtime data. |
homeassistant/components/spacexai/config_flow.py |
Implements device authorization and agent setup. |
homeassistant/components/spacexai/const.py |
Defines integration defaults. |
homeassistant/components/spacexai/conversation.py |
Implements conversation and tool handling. |
homeassistant/components/spacexai/manifest.json |
Registers integration metadata and dependency. |
homeassistant/components/spacexai/quality_scale.yaml |
Declares quality-scale compliance. |
homeassistant/components/spacexai/strings.json |
Adds configuration and error translations. |
homeassistant/generated/config_flows.py |
Registers the config flow. |
homeassistant/generated/integrations.json |
Adds generated integration metadata. |
mypy.ini |
Enables strict mypy checks. |
requirements_all.txt |
Adds the client dependency. |
tests/components/spacexai/__init__.py |
Adds a setup test helper. |
tests/components/spacexai/conftest.py |
Provides shared fixtures. |
tests/components/spacexai/test_config_flow.py |
Tests OAuth and configuration flows. |
tests/components/spacexai/test_conversation.py |
Tests conversations, tools, and errors. |
tests/components/spacexai/test_init.py |
Tests setup, unloading, and refresh behavior. |
Review details
- Files reviewed: 16/18 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Check requirementsChecked at commit All requirements checks passed. ✅
📦 spacexai-subscription-client: 0.1.1
|
Check requirementsChecked at commit All requirements checks passed. ✅
📦 spacexai-subscription-client: 0.1.1
|
| def oauth_implementation(hass: HomeAssistant) -> LocalOAuth2Implementation: | ||
| """Return the public OAuth implementation used by Grok CLI.""" | ||
| return LocalOAuth2Implementation( | ||
| hass=hass, | ||
| domain=DOMAIN, | ||
| client_id=GROK_CLI_OAUTH_CLIENT_ID, | ||
| client_secret="", | ||
| authorize_url=AUTHORIZE_URL, | ||
| token_url=TOKEN_URL, | ||
| ) |
There was a problem hiding this comment.
why isn't this in application_credentials.py
There was a problem hiding this comment.
It mostly came from borrowing the idea from Hermes Agent and then trying to split what was necessary between the library and the HA side. I missed this, but it can be collapsed. Thanks—I’ll follow up with the code.
| @override | ||
| async def async_step_user( | ||
| self, user_input: dict[str, Any] | None = None | ||
| ) -> ConfigFlowResult: | ||
| """Start device authorization.""" | ||
| return await self.async_step_device() | ||
|
|
||
| async def async_step_device( |
There was a problem hiding this comment.
I was trying to keep it simple and separate concerns, but that’s a better idea. I’ll collapse the steps.
| return self.async_show_form( | ||
| step_id="conversation", | ||
| data_schema=vol.Schema( | ||
| { | ||
| vol.Required(CONF_MODEL): SelectSelector( | ||
| SelectSelectorConfig( | ||
| options=self._models, | ||
| mode=SelectSelectorMode.DROPDOWN, | ||
| sort=True, | ||
| ) | ||
| ), |
There was a problem hiding this comment.
why don't you use subentries so you can add multiple models for the same account
There was a problem hiding this comment.
I do want better capabilities and have been working on more, but I was trying to keep the first PR very simple. Could we leave the extra agents for a follow-up?
| from homeassistant.const import CONF_LLM_HASS_API, CONF_PROMPT | ||
| from homeassistant.helpers import llm | ||
|
|
||
| DOMAIN = "spacexai" |
There was a problem hiding this comment.
It’s been a moving target. Looks like the current branding guidelines now say SpaceXSI.
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Check requirementsChecked at commit All requirements checks passed. ✅
📦 spacexai-subscription-client: 0.1.1
|
9ee4053 to
dd28564
Compare
cb70784 to
434bdba
Compare
434bdba to
7fc5f85
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Live sign-in, token refresh, and same-account reauthentication require human validation because mocked tests cannot establish provider compatibility with the unofficial API and third-party OAuth client.
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Provider compatibility remains unverified for the unofficial subscription API and reused Grok CLI OAuth client, requiring maintainer end-to-end validation of live sign-in, same-account reauthentication, and token refresh.
Review effort: Balanced
7fc5f85 to
7247149
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Human validation is needed because mocked tests do not establish provider support for the third-party CLI OAuth client or compatibility with live refresh-token rotation.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
| "integration_type": "service", | ||
| "iot_class": "cloud_polling", | ||
| "quality_scale": "bronze", | ||
| "requirements": ["spacexai-subscription-client==0.1.3"] |
There was a problem hiding this comment.
🔵 Needs a closer look
Human validation is needed because the new subscription client is unavailable for inspection or end-to-end verification, leaving its provider API contract and Grok public OAuth device authorization unverified beyond mocked tests.
Review effort: Balanced



Breaking change
None. This adds a new integration.
Proposed change
Add the community-maintained SpaceXSI integration to use Grok as a conversation agent through a subscription.
Setup uses browser-based device authorization and creates one conversation agent per account. Users select a model, instructions, and Home Assistant AI tools. Same-account reauthentication preserves the agent and its settings. No API key or installed CLI is required.
The integration uses Home Assistant's application-credentials and OAuth helpers, shared HTTP sessions, conversation history, and LLM tool interface. Subscription API requests use
spacexai-subscription-client==0.1.3.Validation on
a920151with the releasedspacexai-subscription-client==0.1.3: all 68 SpaceXSI tests, scoped Ruff and mypy, hassfest, translations, and requirements generation passed locally. GitHub Actions also passed, including prek, mypy, pylint, hassfest, and all ten full-suite test shards.Type of change
Additional information
This PR fixes or closes issue: Not applicable; new integration.
This PR is related to issue: Not applicable.
Link to documentation pull request: Document the SpaceXSI conversation integration home-assistant.io#48027
Link to contributors documentation pull request: Not applicable.
Link to frontend pull request: Not applicable.
Brands pull request: Add SpaceXSI integration branding brands#11129
New dependency: spacexai-subscription-client 0.1.3. Release notes and changes since 0.1.2.
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: