Skip to content

feat(grokbot): add Sand and host-managed chat connectors - #10175

Draft
jroth1111 wants to merge 1257 commits into
can1357:mainfrom
jroth1111:feat/grokbot-provider
Draft

jroth1111 wants to merge 1257 commits into
can1357:mainfrom
jroth1111:feat/grokbot-provider

Conversation

@jroth1111

@jroth1111 jroth1111 commented Aug 29, 2026 •

Copy link
Copy Markdown

What

Contributor's own words:

access your grokbot quota as another connector

Adds distinct native Sand inference and host-managed GrokBotService chat connectors, account-scoped discovery, Sand allowance reporting, and opt-in Claude text-tool transport. Ported onto current upstream 581eaeecfb in logical commits; frontend demos, private API experiments, UI-created-bot adoption and gate/research artifacts are excluded.

Why

Preserves explicit requested models and account-advertised packed Opus 5.5 effort routes, native signed content, product tool ownership and completion boundaries. Host-managed chat is an explicit text-only route—not a silent fallback or a claim of Opus serving. It uses its own temporary conversation, user-nonce correlation, independent transcript readback and ownership-checked cleanup.

Optional issuer-provided workload authorization is forwarded only to native inference. The connector does not forge or mint attestations, inspect another workload, grant entitlement, redeem resets or change billing limits. Newer upstream Connect decoding and unrelated catalog corrections are preserved; common framing lives in utilities rather than duplicated provider implementations.

Maintainer acceptance of the private vendor endpoints remains unresolved. This PR stays draft; neither technical fixes nor live chat success resolve the policy objection.

Testing

  • 1,414 current-candidate scoped tests pass; all-package lint, formatting and TypeScript checks pass.
  • 402 Cursor/Devin/shared-framing tests pass after the shared decoder move.
  • bun run check:ts passes: lint, formatting and all package TypeScript checks. Full root bun check / Rust suite is not claimed; no Rust implementation changes.
  • On this candidate, live GrokBotService SDK chat returned the exact nonce, independently verified the full reply in the transcript, and completed ownership-checked deletion. An earlier candidate smoke failed with verified cleanup; service reliability is not asserted to be uniform.
  • Native Stream remained permission-denied in the account audit. No successful native responseInfo.model, signed Claude content, Opus 5.5 generation or live Claude text-tool round trip is claimed.
  • No frontend, customer credentials, raw private transcripts, changed host defaults or quota/spend-limit mutations are in the submitted diff.
  • Historical technical feedback has been checked against current regression coverage. No review reply was posted and no thread was resolved in this update.

Follow-up verification (10 October, Melbourne)

  • Includes the CLI's /grokbot status capability, using canonical credential/terminal helpers with host URL and control-character redaction.
  • Final safe protocol-error regression verifies that adapter-authored failure stages are visible while unexpected hook/transport exception text remains hidden.
  • The separately integrated fork binary was native-first rebuilt to 18.8.7, returned an exact live Grokbot nonce, and independently verified preservation of all 20 original bots with no temporary bot remaining. Earlier delivery refusals were retained as failed receipts; uniform availability and Opus 5.5 serving are not claimed.

All three branches incorporate upstream 581eaee. No review comments were posted or threads resolved; policy decisions and comment approval remain separate from code fixes.


  • bun check passes
  • Tested locally
  • CHANGELOG updated with the required attribution (if user-facing; internal issue fixes use issue links, external contributions add the PR link and contributor credit after creation)

@roboomp roboomp added auth Authentication and login flows feat providers LLM provider-specific issues review:p3 triaged provider:grokbot labels Aug 29, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f80c52cf20

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/ai/src/providers/grokbot/auth.ts Outdated
Comment thread packages/ai/src/providers/grokbot/auth.ts Outdated
Comment thread packages/ai/src/providers/grokbot.ts Outdated
Comment thread packages/catalog/src/provider-models/grokbot.ts Outdated
Comment thread packages/ai/src/providers/register-builtins.ts Outdated
Comment thread packages/ai/src/providers/grokbot/auth.ts Outdated

@roboomp roboomp left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the thorough, well-structured provider @jroth1111 — the sand-vs-cursor-vs-xai distinction, catalog wiring, and proto round-trip tests are clearly done with care.

Ranked review:p3 — not a quality verdict but because this needs a maintainer policy decision first: the provider mints credentials against Cursor's private api2.cursor.sh sand endpoint and forges the Cursor client identity (x-cursor-client-type, reproduced x-cursor-checksum, stamped client version, x-ghost-mode). No linked issue or confirmed maintainer intent for a 5930-line, 22-file addition. @can1357 should accept/reject that before code review carries weight.

If accepted, two things to fix: (1) proto.ts is under a file-wide // @ts-nocheck, disabling types across the whole 754-line codec — at least give the exported encode/decode surface real signatures; (2) the module-level cachedToken in auth.ts isn't keyed by renewal credential or backend, so different baseUrl/credential in one process can get a bleed of the wrong JWT. Plus a note that seed cost is hardcoded $0. Conventions otherwise look good: CHANGELOG entries in all three packages, generator-driven models.json, lazy-loaded provider module matching the existing pattern.

Comment thread packages/ai/src/providers/grokbot/proto.ts Outdated
Comment thread packages/ai/src/providers/grokbot/auth.ts Outdated
}

/** Cursor sand checksum: obfuscated floor(now/1e6) bytes + machine id. */
export function createGrokbotChecksum(machineId: string, nowMs = Date.now()): string {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blocking (policy — maintainer call): this provider mints credentials against Cursor's private api2.cursor.sh sand endpoint and forges the Cursor desktop client identity — x-cursor-client-type: sand, a reproduced x-cursor-checksum (enhancedObfuscate + machine id), a stamped x-cursor-client-version (0.30.0-pre.16), and x-ghost-mode (see grokbot.ts L495-505). That is impersonating another vendor's proprietary client to access their infra, which is a repo-policy decision, not a code-review nit. Flagging for @can1357 to accept/reject before the rest of the review has any weight.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acknowledged — this is a maintainer policy call, not something we can resolve in code review. Leaving open for @can1357 to accept or reject Cursor sand client-identity / api2.cursor.sh access before the rest of the provider lands.

Comment thread packages/catalog/src/provider-models/grokbot.ts Outdated
@jroth1111

Copy link
Copy Markdown
Author

Follow-up: /login → Grok Bot now shows the host-install prompt to run inside the Grok Bot system (sand VM). It does not use Cursor OAuth or xAI / Grok CLI login; after the host secrets/grokbot.env is written, press Enter in omp to verify renewer + machine id are present (values are never printed).

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a53fc5a6f0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/ai/src/providers/grokbot.ts Outdated
Comment thread packages/ai/src/providers/grokbot.ts Outdated
Comment thread packages/catalog/src/provider-models/grokbot.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9ebdd137d0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/ai/src/registry/grokbot.ts Outdated
Comment thread packages/ai/test/providers/grokbot-proto.test.ts Outdated
Comment thread packages/ai/src/providers/grokbot.ts Outdated
Comment thread packages/ai/src/providers/grokbot.ts Outdated
@jroth1111 jroth1111 changed the title feat(ai): add Grok Bot sand InferenceService provider feat(ai): add Grok Bot provider Aug 29, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4256dd5149

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/ai/src/registry/grokbot.ts Outdated
Comment thread packages/ai/src/providers/grokbot/auth.ts Outdated
Comment thread packages/ai/src/providers/grokbot.ts Outdated
Comment thread packages/ai/src/providers/grokbot.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bb6862f5c3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/ai/src/providers/grokbot.ts Outdated
Comment thread packages/ai/src/providers/grokbot.ts Outdated
Comment thread packages/ai/src/providers/grokbot/auth.ts Outdated
Comment thread packages/ai/test/providers/grokbot-proto.test.ts Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

const grokbotDiscovery = once(() => import("../discovery/grokbot"));

P1 Badge Replace the remaining inline discovery import

The earlier provider-loader import was fixed, but this separate catalog loader still introduces import("../discovery/grokbot"), contrary to the repository-wide requirement that imports remain top-level. Use a static import for fetchGrokbotAvailableModels rather than leaving the catalog path dependent on another unsupported dynamic import.

AGENTS.md reference: AGENTS.md:L37-L37


https://github.com/can1357/oh-my-pi/blob/88b940088a708029dd4d67673554341292c3233c/packages/catalog/src/models.json#L67527-L67531
P2 Badge Regenerate the bundled Grokbot effort ladder

Fresh evidence after the prior effort-ladder thread is that the final bundled grok-4.6 row still ends at high, even though the updated seed and Grokbot thinking policy include xhigh. packages/catalog/src/models.ts exposes these generated rows verbatim, so before authenticated discovery refreshes the catalog, requireSupportedEffort still rejects xhigh; regenerate and commit models.json from the corrected source.

AGENTS.md reference: AGENTS.md:L185-L185


if (index.has(aliasKey)) {
if (index.get(aliasKey) !== m) {
index.set(aliasKey, null);

P2 Badge Preserve exact model IDs when aliases collide

When one model's alias equals another model's canonical ID, this branch replaces the entry with the ambiguous sentinel, so even an exact provider/model-id lookup returns undefined. This can occur in a live catalog that contains both an alias such as auto and a canonical auto row; canonical IDs should take precedence over aliases, while ambiguity handling should apply only between competing aliases or duplicate canonical rows.


const errObj = firstPresent(parsed, ["error"]);
if (errObj && typeof errObj === "object") {
const e = errObj as Record<string, unknown>;
if (e.isOutputTokenLimitError || e.is_output_token_limit_error) {
output.stopReason = "length";

P2 Badge Treat input-token-limit frames as errors

When the backend reports a StreamError using only isInputTokenLimitError, this branch handles only the output-limit flag and then ignores the frame because message and code may both be empty. A valid end trailer then turns the rejected request into a successful empty or partial completion; surface the input-limit flag as a context-overflow error so callers can compact or report the failure.


if (typeof info.model === "string" && info.model) output.upstreamProvider = info.model;

P2 Badge Do not record a model ID as the upstream provider

Whenever responseInfo.model is present, this stores values such as grok-4.5 in upstreamProvider, whose documented contract is a provider name such as OpenAI or Anthropic. Observability and persisted response metadata will consequently attribute requests to a model ID rather than a provider; leave this field unset unless the wire response exposes actual provider attribution.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

const grokbotDiscovery = once(() => import("../discovery/grokbot"));

P1 Badge Replace the remaining dynamic discovery import

Although the provider loader was corrected, this newly added catalog thunk still uses a dynamic import("../discovery/grokbot"). That leaves Grokbot discovery on an unsupported inline-import path rather than wiring it through a top-level import as required by the repository convention.

AGENTS.md reference: AGENTS.md:L37-L37


https://github.com/can1357/oh-my-pi/blob/f687c51f8045134b4548bc846dbdf4f272cb4b00/packages/catalog/src/models.json#L67527-L67531
P2 Badge Regenerate the bundled Grokbot thinking metadata

Fresh evidence after the earlier fix claim is that the committed models.json still ends Grokbot grok-4.6's effort ladder at high, even though the seed and generated policy now include xhigh. Before live discovery completes—or whenever it is unavailable—mapOptionsForApi therefore rejects an advertised xhigh request in requireSupportedEffort; regenerate and commit the bundle from the corrected source.

AGENTS.md reference: AGENTS.md:L183-L185


if (typeof info.model === "string" && info.model) output.upstreamProvider = info.model;

P2 Badge Keep routed model IDs out of upstreamProvider

When Sand returns responseInfo.model—the added codec test uses a value such as grok-4.5—this assigns that model ID to AssistantMessage.upstreamProvider, whose contract is the upstream provider name. Consumers such as agent telemetry consequently record a model name in the provider attribute for routed Grokbot responses; preserve the model separately or leave upstreamProvider unset unless the protocol supplies an actual provider.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6e1a1daf3a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/catalog/src/provider-models/special.ts Outdated
Comment thread packages/catalog/src/provider-models/special.ts Outdated
Comment thread packages/ai/src/registry/grokbot.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a67df40fad

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/ai/src/providers/grokbot/host-install-prompt.md Outdated
Comment thread packages/catalog/src/discovery/grokbot-auth.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 414722ccab

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/catalog/src/discovery/grokbot.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 586c8d5e8d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/catalog/src/model-thinking.ts Outdated
Comment thread packages/catalog/src/provider-models/cache-provider-id.ts Outdated
@jroth1111
jroth1111 force-pushed the feat/grokbot-provider branch from 55c2d2d to f22209d Compare August 29, 2026 10:44

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d4af672e19

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/catalog/src/provider-models/special.ts Outdated
Comment thread packages/ai/src/providers/grokbot/auth.ts Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

https://github.com/can1357/oh-my-pi/blob/ccc50dce5b058769c446e155db4194f535dc4416/packages/catalog/src/models.json#L67610-L67612
P2 Badge Regenerate the bundled Grokbot thinking metadata

Fresh evidence after the earlier effort fixes is that the committed bundle still gives sand-default a five-level effort control even though the new source policy leaves Grokbot routers without thinking and sandParameterIds is empty. When live discovery is unavailable or before it replaces the bundle, the picker therefore accepts an effort that mapOptionsForApi and resolveGrokbotRequestedModel silently omit; the bundled grok-4.6 ladder is likewise inconsistent with its four-level source seed. Fix the generator policy as needed and regenerate models.json so the shipped catalog matches the resolver/seed behavior.

AGENTS.md reference: AGENTS.md:L183-L185


const response = await fetchImpl(new URL(GROKBOT_RENEWAL_PATH, backend), {

P2 Badge Preserve configured path prefixes in auth URLs

When baseUrl points through a path-prefixed reverse proxy such as https://proxy.example/grokbot, passing the leading-slash renewal path to new URL resets the pathname and sends the request to /sand-box/inference-credential instead of /grokbot/sand-box/inference-credential. The discovery request itself concatenates its path onto resolvedBaseUrl, so this mismatch makes custom prefixed endpoints fail during token minting; the stream request uses the same path-resetting construction.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jroth1111

Copy link
Copy Markdown
Author

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2ddc2b73f8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/ai/src/providers/grokbot.ts Outdated
}

closeOpen();
for (const state of toolStates.values()) finishTool(state);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject unfinished tool calls at end of stream

When the backend sends a ToolCallPart with isComplete: false and then a valid Connect end-stream trailer, this loop calls finishTool anyway, parses potentially partial JSON as {}, and emits a successful toolUse response. That can execute or persist a tool call the provider explicitly marked incomplete; only states whose completion flag was received should be finalized, while remaining states should make the stream incomplete.

Useful? React with 👍 / 👎.

export { shortenPath as shortenGrokbotDisplayPath } from "@oh-my-pi/pi-utils";

/** Max display cells for `/grokbot` status field values (matches TUI title width). */
const STATUS_VALUE_MAX_WIDTH = 60;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use the shared TUI truncation limit

The fresh status-sanitization fix introduces a provider-local width of 60, which only coincidentally matches TRUNCATE_LENGTHS.TITLE and will drift when the shared TUI limits change. Move or expose the shared limit from a package pi-ai can consume instead of adding another ad-hoc display constant.

AGENTS.md reference: AGENTS.md:L207-L210

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 591872c4f7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/ai/src/providers/grokbot.ts Outdated
Comment on lines +390 to +391
} catch {
return {};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reject malformed completed tool arguments

When a ToolCallPart has isComplete: true but contains malformed JSON, this catch silently converts its arguments to {}; the new incomplete-tool guard therefore does not run, and the response completes with stopReason: "toolUse". A zero-argument tool can then execute unintentionally instead of the provider response being rejected. Fresh evidence beyond the prior incomplete-tool finding is that a completed malformed part still bypasses the new guard; propagate the parse failure.

Useful? React with 👍 / 👎.

Comment thread packages/ai/src/providers/grokbot.ts Outdated
Comment on lines +615 to +616
let key = id;
if (!key && typeof indexHint === "number") key = `idx:${indexHint}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Correlate tool chunks by both id and index

When successive ToolCallPart frames for one call do not repeat both identifiers—for example, the first frame supplies toolCallId plus toolIndex and a later frame supplies only the index—lookup changes from the id key to idx:<n>, but the original state was never registered under that index. The later chunk consequently creates a second tool call, and the otherwise valid stream ends as incomplete or exposes duplicate calls; resolve and register both identifiers to the same state.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e92b4e22e0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/ai/src/providers/grokbot/proto-codec.ts
Comment thread packages/catalog/src/discovery/grokbot.ts Outdated
Comment thread packages/ai/src/providers/grokbot.ts Outdated
Comment on lines +526 to +528
const headers: Record<string, string> = {
...options?.headers,
...grokbotClientHeaders(authCfg),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include model headers in Grokbot inference requests

When a custom Grokbot model or reverse-proxy override supplies required headers through model.headers, this request includes only per-call options.headers, so headers such as a proxy API key are silently omitted and the inference call fails. Other provider transports merge model-level and call-level headers; include model.headers here as well while retaining the provider-owned auth/header precedence.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 32b08d0b35

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +229 to +232
const identity = resolveGrokbotDiscoveryIdentity({
namespace: config.namespace,
clientVersion: config.clientVersion,
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid synchronous secrets reads during discovery refresh

When an authenticated Grok Bot catalog is refreshed, this factory calls resolveGrokbotDiscoveryIdentity(), which synchronously reads secrets/grokbot.env; constructing cacheProviderId then invokes the same resolver and reads the file synchronously again. On a slow or network-mounted agent directory, background model refresh therefore blocks the TUI event loop. Fresh evidence after the earlier async-loading fix is that cache-scope construction has reintroduced the synchronous reader outside the registry callback; resolve the identity asynchronously once and pass it through without rereading the file.

AGENTS.md reference: AGENTS.md:L133-L137

Useful? React with 👍 / 👎.

Comment thread packages/catalog/src/discovery/grokbot-auth.ts
Brit and others added 30 commits October 13, 2026 17:39
fix(gc): address post-merge Codex findings on omp gc --compress
… add pricing

Antigravity discovery serves Gemini 4 Argon as gemini-4-argon-low/-medium/-high SKUs, which showed as three models. A google-level variant family folds them into one gemini-4-argon row with low, medium, and high thinking levels, each routed to its SKU. The existing Antigravity pricing peer prices it at Google's first-party rate; the regenerated bundle carries it. Cursor's GetUsableModels carries no pricing, so Argon gets Cursor's published $2/$10, $0.10 cache-read card.
Neither discovery mapper read its gateway's pricing, so every row fell back to stencil.so or the bundle: Gemini 4 Argon showed $4/$20 on both against a live $2/$10, and many Kilo and NanoGPT rows showed $0. Kilo now maps its OpenRouter-shaped per-token pricing; NanoGPT requests its detailed roster and maps its per-million card (cache legs per thousand tokens). Names and limits keep their existing sources; legs a gateway leaves unpriced still fall back.
Google ends Argon's introductory $2/$10 ($0.10 cached) price on 2026-11-30 and bills $4/$20 ($0.20 cached) from 2026-12-01, midnight US Pacific when Cloud Billing's day starts. cost-patch now accepts the dated effective-rates cards cost-fallback already had, so a rule can move a price on a date without a catalog update. Google, Vertex, and Antigravity Argon rows take the dated card over whatever stencil.so or the bundled pricing peer reports; Cursor, which bills Other Models at the model's API price, schedules it on its own card. Cursor's rich-discovery card reader honors the same cards.
Dated cost-patch/cost-fallback cards were applied only when a row was built, so a row reused past the change (the committed Antigravity Argon bundle row, a model cache, a long session) kept billing the old price. buildModel now compiles every price period into cost.timeBased.effectiveRates, with a leading card for the pre-change price, under a schedule with no peak windows and a 1x multiplier; calculateUsageCost picks the card by request timestamp. hasRecurringTariff separates these dated-only schedules from peak/off-peak tariffs: no status-line arrow, and stats reprices a recorded $0 on them at the card for the request's date instead of freezing it. The Antigravity bundle is regenerated so its Argon row carries the schedule.
…ice in force

Google's Argon rule carried only the 2026-12-01 card, so once upstream reported $4/$20 the pre-switch period derived from it vanished and a row built afterwards priced November requests at list. The rule now pins the $2/$0.10/$10 card beside it. Price displays read the row's scalar legs, which keep the card current when the row was built, so a bundle, cache or long session showed a superseded price; getEffectiveTokenCost returns the card in force and the model browser and omp models --json use it. This also corrects DeepSeek V4 Pro, listed at $1.32/$3.96 though billed at its $0.30/$1.20 card since 2026-09-14.
…dules on rebuilt rows and Cursor sibling lanes
…proved input; queue Enter behind a landing paste
Spawn acknowledgments no longer repeat the background-job contract; the Task description carries it once, and same-name extension replacements inherit it through AgentTool.delegationGuidance.
…rl+O to expand; drop transcript-card matching
…ding details restarts the approval timeout
…uring tool approval, drop duplicated call details (@H4vC)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auth Authentication and login flows feat provider:grokbot providers LLM provider-specific issues review:p3 triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.