Skip to content

Commit fd3d79a

Browse files
Merge remote-tracking branch 'github/main' into takeover/23972
2 parents 2f06f7a + 2ed9261 commit fd3d79a

14 files changed

Lines changed: 1058 additions & 64 deletions

File tree

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ apps/mobile/.generated/
3636
apps/mobile/.android-cache/
3737
/.generated/
3838
artifacts/app-store/screenshots/
39+
artifacts/mobile-e2e/
3940
.github/pr-assets/
4041
native/**/target/
4142
node_modules/

‎apps/server/scripts/acp-mock-agent.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const emitGrokMonitorPostTurnPoll = process.env.T3_ACP_EMIT_GROK_MONITOR_POST_TU
5252
const emitGrokBackgroundTaskStarted = process.env.T3_ACP_EMIT_GROK_BACKGROUND_TASK_STARTED === "1";
5353
const emitGrokBackgroundTaskPoll = process.env.T3_ACP_GROK_BACKGROUND_TASK_COMPLETION === "poll";
5454
const emitForeignSessionUpdates = process.env.T3_ACP_EMIT_FOREIGN_SESSION_UPDATES === "1";
55+
const omitInitializeModelState = process.env.T3_ACP_OMIT_INITIALIZE_MODEL_STATE === "1";
5556
const waitForResumeRelease = process.env.T3_ACP_WAIT_FOR_RESUME_RELEASE === "1";
5657
const completeFirstPromptOnCancel = process.env.T3_ACP_COMPLETE_FIRST_PROMPT_ON_CANCEL === "1";
5758
const floodStderr = process.env.T3_ACP_FLOOD_STDERR === "1";
@@ -575,7 +576,7 @@ const program = Effect.gen(function* () {
575576
return {
576577
protocolVersion: 2,
577578
info: { name: "t3-acp-mock-agent", version: "0.0.0" },
578-
_meta: { modelState: modelState() },
579+
...(omitInitializeModelState ? {} : { _meta: { modelState: modelState() } }),
579580
capabilities: {
580581
session: {
581582
...(supportsSessionLifecycle ? { fork: {}, additionalDirectories: {} } : {}),

‎apps/server/src/provider/GrokProvider.test.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,27 @@ it.layer(NodeServices.layer)("checkGrokProviderStatus", (it) => {
352352
}),
353353
);
354354

355+
it.effect("warns instead of reporting ready when no models are discovered", () =>
356+
Effect.gen(function* () {
357+
const snapshot = yield* Effect.scoped(
358+
Effect.gen(function* () {
359+
const grokPath = yield* writeFakeGrokCli({
360+
modelsOutput: "You are logged in with grok.com.\n",
361+
acp: true,
362+
});
363+
return yield* checkGrokProviderStatus(
364+
decodeGrokSettings({ enabled: true, binaryPath: grokPath }),
365+
{ ...process.env, XAI_API_KEY: "", T3_ACP_OMIT_INITIALIZE_MODEL_STATE: "1" },
366+
);
367+
}),
368+
);
369+
370+
expect(snapshot.status).toBe("warning");
371+
expect(snapshot.message).toContain("did not list any models");
372+
expect(snapshot.models.map((model) => model.slug)).toEqual(["grok-build"]);
373+
}),
374+
);
375+
355376
it.effect("treats XAI_API_KEY as authenticated regardless of CLI login state", () =>
356377
Effect.gen(function* () {
357378
const snapshot = yield* Effect.scoped(

‎apps/server/src/provider/ProviderRegistry.test.ts‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,44 @@ it.layer(
693693
);
694694
});
695695

696+
it("drops Grok models a completed probe no longer advertises", () => {
697+
const previousProvider = {
698+
instanceId: ProviderInstanceId.make("grok"),
699+
driver: ProviderDriverKind.make("grok"),
700+
status: "ready",
701+
enabled: true,
702+
installed: true,
703+
auth: { status: "authenticated" },
704+
checkedAt: "2026-09-30T00:00:00.000Z",
705+
version: "1.0.44",
706+
models: [
707+
{ slug: "grok-4.7", name: "Grok 4.7", isCustom: false, capabilities: null },
708+
{ slug: "codexhub-removed", name: "Removed", isCustom: false, capabilities: null },
709+
],
710+
slashCommands: [],
711+
skills: [],
712+
} as const satisfies ServerProvider;
713+
const refreshedProvider = {
714+
...previousProvider,
715+
checkedAt: "2026-09-30T00:01:00.000Z",
716+
models: [previousProvider.models[0]],
717+
} satisfies ServerProvider;
718+
const acpFailedProvider = {
719+
...refreshedProvider,
720+
status: "warning",
721+
message: "Grok CLI is installed but ACP initialize failed.",
722+
} satisfies ServerProvider;
723+
724+
assert.deepStrictEqual(
725+
ProviderRegistry.mergeProviderSnapshot(previousProvider, refreshedProvider).models,
726+
[previousProvider.models[0]],
727+
);
728+
assert.deepStrictEqual(
729+
ProviderRegistry.mergeProviderSnapshot(previousProvider, acpFailedProvider).models,
730+
[...previousProvider.models],
731+
);
732+
});
733+
696734
it("retains stale OpenCode models when a refresh fails", () => {
697735
const previousProvider = {
698736
instanceId: ProviderInstanceId.make("opencode"),

‎apps/server/src/provider/ProviderRegistry.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ const shouldRetainMissingProviderModels = (provider: ServerProvider): boolean =>
168168
);
169169
}
170170

171+
if (provider.driver === ProviderDriverKind.make("grok")) {
172+
// Grok reports ready only after it discovers a model list; the pending,
173+
// ACP-failed, empty-inventory, and logged-out probes are warning/error.
174+
return !(provider.installed && provider.status === "ready");
175+
}
176+
171177
const isAntigravity = provider.driver === ProviderDriverKind.make("antigravity");
172178
const isCodex = provider.driver === ProviderDriverKind.make("codex");
173179
if (!isAntigravity && !isCodex && provider.driver !== ProviderDriverKind.make("opencode")) {

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"knip:production": "knip --production --preprocessor ./scripts/knip-schemas.ts",
3434
"lint:mobile": "node scripts/mobile-native-static-check.ts",
3535
"mobile:install": "node scripts/mobile-native-client.ts ensure",
36+
"mobile:e2e": "node scripts/mobile-e2e.ts",
3637
"test": "vp run -r test",
3738
"test:cached": "node scripts/test-cached.ts",
3839
"test:perf:v2-wire": "vp test run apps/server/src/orchestration-v2/WireProjection.test.ts apps/server/src/orchestration-v2/threadHistoryPaging.test.ts apps/server/src/orchestration-v2/ThreadStream.test.ts apps/server/src/orchestration-v2/ThreadTransportPerformance.test.ts apps/server/src/orchestration-v2/ShellStream.test.ts apps/server/src/orchestration-v2/CommandPolicy.test.ts apps/server/src/orchestration-v2/runtimeLayer.test.ts apps/server/src/ws.test.ts packages/contracts/src/orchestrationV2.test.ts packages/client-runtime/src/operations/commands.test.ts packages/client-runtime/src/operations/commands.performance.test.ts packages/client-runtime/src/state/boundedThreadSnapshotHttp.test.ts packages/client-runtime/src/state/threadHistoryController.test.ts packages/client-runtime/src/state/threadHistoryMerge.test.ts packages/client-runtime/src/state/threads-sync.test.ts packages/client-runtime/src/state/shellReducer.test.ts",

‎packages/provider-grok/src/server/status.ts‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,12 @@ export const checkGrokProviderStatus = Effect.fn("checkGrokProviderStatus")(func
527527
discoveredModels.length > 0
528528
? grokModelsFromSettings(grokSettings.customModels, discoveredModels)
529529
: fallbackModels;
530+
// The registry replaces cached models on a ready probe, so a fallback-only list must not be ready.
531+
const incompleteMessage = acpFailed
532+
? "Grok CLI is installed but ACP initialize failed. Model options may be incomplete."
533+
: discoveredModels.length === 0
534+
? "Grok CLI did not list any models. Model options may be incomplete."
535+
: undefined;
530536

531537
if (auth.status === "unauthenticated") {
532538
return buildServerProvider({
@@ -555,14 +561,9 @@ export const checkGrokProviderStatus = Effect.fn("checkGrokProviderStatus")(func
555561
probe: {
556562
installed: true,
557563
version,
558-
status: acpFailed ? "warning" : "ready",
564+
status: incompleteMessage ? "warning" : "ready",
559565
auth,
560-
...(acpFailed
561-
? {
562-
message:
563-
"Grok CLI is installed but ACP initialize failed. Model options may be incomplete.",
564-
}
565-
: {}),
566+
...(incompleteMessage ? { message: incompleteMessage } : {}),
566567
},
567568
});
568569
});

‎pnpm-lock.yaml‎

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎scripts/install.ps1‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,19 @@ if (-not $version) {
133133
"preview" { '^v\d+\.\d+\.\d+-preview\.\d+\.\d+$' }
134134
default { Fail "T3CODE_CHANNEL must be stable, nightly, or preview" }
135135
}
136-
$releases = Invoke-RestMethod -Uri "https://api.github.com/repos/$repo/releases?per_page=100" -Headers @{ "User-Agent" = "t3-install" }
137-
$tag = ($releases | Where-Object { -not $_.draft -and $_.tag_name -match $tagPattern } | Select-Object -First 1).tag_name
136+
if ($channel -eq "stable") {
137+
# release.yml marks only plain stable releases latest. This is a github.com
138+
# page, so it is not cut off by a page of newer nightlies or the API quota.
139+
$release = Invoke-RestMethod -Uri "https://github.com/$repo/releases/latest" -Headers @{ "User-Agent" = "t3-install"; "Accept" = "application/json" }
140+
$tag = ($release | Where-Object { $_.tag_name -match $tagPattern }).tag_name
141+
} else {
142+
$tag = $null
143+
for ($page = 1; -not $tag -and $page -le 10; $page++) {
144+
$releases = Invoke-RestMethod -Uri "https://api.github.com/repos/$repo/releases?per_page=100&page=$page" -Headers @{ "User-Agent" = "t3-install" }
145+
$tag = ($releases | Where-Object { -not $_.draft -and $_.tag_name -match $tagPattern } | Select-Object -First 1).tag_name
146+
if (-not $releases) { break }
147+
}
148+
}
138149
if (-not $tag) { Fail "could not find a $channel release; set T3CODE_VERSION" }
139150
$version = $tag.Substring(1)
140151
}

‎scripts/install.sh‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ step "Finding your release..."
5353
# Exit 44 on a 404 so callers can tell "no such asset" from a network failure.
5454
fetch() {
5555
if command -v curl >/dev/null 2>&1; then
56-
status="$(curl -sSL -w '%{http_code}' "$1" -o "$2")" || return 1
56+
status="$(curl -sSL -H "Accept: ${3:-*/*}" -w '%{http_code}' "$1" -o "$2")" || return 1
5757
case "$status" in
5858
2??) return 0 ;;
5959
404) return 44 ;;
6060
*) printf 'GET %s returned HTTP %s\n' "$1" "$status" >&2; return 1 ;;
6161
esac
6262
elif command -v wget >/dev/null 2>&1; then
63-
wget -q --server-response "$1" -O "$2" 2>"$2.headers" && rm -f "$2.headers" && return 0
63+
wget -q --server-response --header="Accept: ${3:-*/*}" "$1" -O "$2" 2>"$2.headers" && rm -f "$2.headers" && return 0
6464
if grep -q ' 404 ' "$2.headers" 2>/dev/null; then rm -f "$2.headers"; return 44; fi
6565
cat "$2.headers" >&2; rm -f "$2.headers"; return 1
6666
else
@@ -151,8 +151,20 @@ if [ -z "$version" ]; then
151151
*) fail "T3CODE_CHANNEL must be stable, nightly, or preview" ;;
152152
esac
153153
tmp_index="$(mktemp)"
154-
fetch "https://api.github.com/repos/${repo}/releases?per_page=100" "$tmp_index"
155-
version="$(sed -n "s/.*\"tag_name\": *\"${tag_pattern}\".*/\1/p" "$tmp_index" | head -n 1)"
154+
if [ "$channel" = stable ]; then
155+
# release.yml marks only plain stable releases latest. This is a github.com
156+
# page, so it is not cut off by a page of newer nightlies or the API quota.
157+
fetch "https://github.com/${repo}/releases/latest" "$tmp_index" application/json
158+
version="$(sed -n "s/.*\"tag_name\": *\"${tag_pattern}\".*/\1/p" "$tmp_index" | head -n 1)"
159+
else
160+
page=1
161+
while [ -z "$version" ] && [ "$page" -le 10 ]; do
162+
fetch "https://api.github.com/repos/${repo}/releases?per_page=100&page=${page}" "$tmp_index"
163+
version="$(sed -n "s/.*\"tag_name\": *\"${tag_pattern}\".*/\1/p" "$tmp_index" | head -n 1)"
164+
grep -q '"tag_name"' "$tmp_index" || break
165+
page=$((page + 1))
166+
done
167+
fi
156168
rm -f "$tmp_index"
157169
[ -n "$version" ] || fail "could not find a ${channel} release; set T3CODE_VERSION"
158170
fi

0 commit comments

Comments
 (0)