Skip to content

fix(grok): probe health with initialize and allow in-session model changes - #214

Merged
leoisadev1 merged 4 commits into
mainfrom
leoisadev1/t3-port-grok
Sep 13, 2026
Merged

leoisadev1 merged 4 commits into
mainfrom
leoisadev1/t3-port-grok

Conversation

@leoisadev1

Copy link
Copy Markdown
Member

Problem

Grok health checks opened a full ACP session. authenticate can launch a browser login, and session/new boots every configured MCP server, so background probes hung, timed out, and persisted error over a working install. They also never reported auth state.

The snapshot also advertised requiresNewThreadForModelChange, so the server rejected in-session model changes even though Grok ACP already supports session/set_model. Selecting the built-in grok-build slug sent that product name as a model id, which the real CLI rejects.

Changes

checkGrokProviderStatus now runs grok --version, then grok models for login state and slugs, then a single ACP initialize and reads models from _meta.modelState. No authenticate, no session/new. A failed initialize degrades to warning with the CLI model list instead of error. XAI_API_KEY counts as authenticated.

AcpSessionRuntime.initialize() is additive. Cursor and OpenCode still use start(). applyGrokAcpModelSelection treats grok-build as "keep the session's current model" and never sends it in session/set_model. Grok snapshots no longer set requiresNewThreadForModelChange.

Live UI is unchanged: BotRosterSidebar, BotThreadLanding, GroupThreadLanding, and BotPromptComposer still consume the provider snapshot. Settings Providers reads the same snapshot for status, auth, and models.

Upstream

Adapted from pingdotgg/t3code#9154 and pingdotgg/t3code#8392. Not a cherry-pick. Preserves Akeru naming, subscription auth, MCP headers, and the five-provider split. Codex/Kimi/OpenCode Go stay on Mastra.

Scope

This PR is Grok discovery/health probe and in-session model selection only.

Assigned Grok ports for this handoff:

Follow-up PRs will cover runtime cancel/steer and skills. Shared ACP notification encoding is not in this PR.

Verification

  • Focused tests: GrokProvider, GrokAcpSupport, AcpRuntimeModel, GrokAdapter, GrokTextGeneration, CursorAdapter, AcpJsonRpcConnection, ProviderCommandReactor. 167 passing.
  • Targeted lint and format on changed files. Server typecheck passed with only pre-existing Effect suggestions.
  • Live Grok CLI 1.0.24 (~/.grok/bin/grok): initialize advertised models without opening a session (220ms). checkGrokProviderStatus reported ready, authenticated, no grok-build slug, and requiresNewThreadForModelChange unset (575ms).
  • Isolated mock-agent probes cover logged-in ready, unauthenticated without session/new, initialize failure fallback, and XAI_API_KEY override.
  • Native mobile not applicable. No Settings component changes; the Providers page will render the existing snapshot fields. Browser Settings pass is still pending on this PR if reviewers want a screenshot of the live snapshot.

Limitations

Made by Grok 4.6 High in Grok Build via Orca.

…anges

Grok health checks opened a full ACP session, so background probes could hang
on authenticate or boot every configured MCP server. They also never reported
login state, and the snapshot locked model changes to a new thread even though
session/set_model already works.

The check now runs grok --version, grok models, then a single ACP initialize
and reads models from _meta.modelState. Failed initialize degrades to warning.
grok-build is never sent as a model id.

Adapted from pingdotgg#9154 and pingdotgg#8392.

Made by Grok 4.6 High in Grok Build via Orca.
@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
akeru-bot-landing Ready Ready Preview Sep 10, 2026 5:38pm UTC

Request Review

@github-actions github-actions Bot added size:L type:provider Agent provider contribution. vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Sep 10, 2026
@greptile-apps

greptile-apps Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Greptile Summary

Summary

  • Grok provider health checks now probe CLI availability and authentication without starting a full ACP session.
  • Model discovery uses the ACP initialization response with a CLI fallback, and supported models can be changed within an existing session.
  • Focused coverage was added for probing, authentication, model parsing, fallbacks, and model selection.

Confidence Score: 5/5

Safe to merge; there are no blocking issues.

There are no outstanding findings.

Reviews (4): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

Keep the Grok probe PR current with main.
@leoisadev1

Copy link
Copy Markdown
Member Author

This is Leo's agent.

Current GitHub state is CONFLICTING/DIRTY for 49d3f08. A read-only git merge-tree against current main finds one textual conflict in docs/internals/providers.md: main's OpenCode discovery paragraph and this PR's Grok health-check section were added at the same location.

Preserve both sections. They describe different providers and are not alternatives. Re-run the focused provider/ACP tests and Greptile review/fix loop after updating the branch. Existing populated-provider/model-change integration verification remains required; resolving this documentation conflict alone is not independent acceptance.

No branch or worktree files were modified. Orca delivery remains blocked by the missing selected executable, so this comment is a repair specification, not confirmed worker delivery or execution.

# Conflicts:
#	docs/internals/providers.md
@leoisadev1
leoisadev1 merged commit 1a47e92 into main Sep 13, 2026
11 checks passed
@leoisadev1
leoisadev1 deleted the leoisadev1/t3-port-grok branch September 13, 2026 21:50
This was referenced Sep 13, 2026

This branch was successfully deployed

1 active deployment
Preview — e4b09c56 Deployed Sep 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L type:provider Agent provider contribution. vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant