Fix/project scoped provider skills #6661
ClosedGenKerensky(GitHub profile, opens in a new tab)wants to merge 11 commits into
main fromrefs/pull/6661/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
- apps/server/src/orchestration/Services/ProjectionSnapshotQuery.ts lines 61 to 68Resolvedby GenKerensky(GitHub profile, opens in a new tab)@@ -58,3 +58,11 @@5858 * ProjectionSnapshotQueryShape - Service API for read-model snapshots.5959 */6060 export interface ProjectionSnapshotQueryShape {61+ /**62+ * Read only active project roots and thread worktrees for infrastructure63+ * that needs workspace-aware behavior without hydrating the shell.64+ */65+ readonly getActiveWorkspaceCwds?: () => Effect.Effect<66+ ReadonlyArray<string>,67+ ProjectionRepositoryError68+ >;
- apps/server/src/orchestration/Services/ProjectionSnapshotQuery.ts lines 61 to 68Resolvedby GenKerensky(GitHub profile, opens in a new tab)@@ -58,3 +58,11 @@5858 * ProjectionSnapshotQueryShape - Service API for read-model snapshots.5959 */6060 export interface ProjectionSnapshotQueryShape {61+ /**62+ * Read only active project roots and thread worktrees for infrastructure63+ * that needs workspace-aware behavior without hydrating the shell.64+ */65+ readonly getActiveWorkspaceCwds?: () => Effect.Effect<66+ ReadonlyArray<string>,67+ ProjectionRepositoryError68+ >;
- packages/shared/src/providerSkills.ts lines 33 to 34OutdatedResolvedby GenKerensky(GitHub profile, opens in a new tab)@@ -0,0 +14,21 @@14+ *15+ * Assumes paths are already absolute in practice (T3 workspace roots are).16+ * Relative inputs are still collapsed so comparison stays deterministic;17+ * they are not resolved against a process cwd (clients have no server cwd).18+ */19+export function normalizeProviderSkillWorkspacePath(cwd: string): string {20+ const trimmed = cwd.trim();21+ if (trimmed.length === 0) {22+ return "";23+ }24+25+ if (isWindowsAbsolutePath(trimmed) || isUncPath(trimmed) || isWindowsDrivePath(trimmed)) {26+ return normalizeWindowsSkillWorkspacePath(trimmed);27+ }28+29+ return normalizePosixSkillWorkspacePath(trimmed);30+}31+32+function normalizePosixSkillWorkspacePath(value: string): string {33+ // Treat backslash as separator so mixed forms from Codex / cross-host paths match.34+ const withForward = value.replaceAll("\\", "/");packages/shared/src/providerSkills.ts lines 77 to 79OutdatedResolvedby GenKerensky(GitHub profile, opens in a new tab)@@ -0,0 +59,21 @@59+ // Collapse `.` / `..` with backslash separators, then apply the shared60+ // Windows comparison normalizer (case + trailing separators).61+ const withBackslash = value.replaceAll("/", "\\");62+ const unc = isUncPath(withBackslash);63+ const segments = withBackslash.split("\\");64+ const stack: string[] = [];65+66+ for (let index = 0; index < segments.length; index += 1) {67+ const segment = segments[index] ?? "";68+ // Preserve leading empty segments for UNC (`\\server\share`).69+ if (segment === "" && unc && stack.length < 2) {70+ stack.push(segment);71+ continue;72+ }73+ if (segment === "" || segment === ".") {74+ continue;75+ }76+ if (segment === "..") {77+ if (stack.length > 0 && stack[stack.length - 1] !== "") {78+ stack.pop();79+ }apps/server/src/provider/Drivers/ClaudeSkills.ts line 73OutdatedResolvedby GenKerensky(GitHub profile, opens in a new tab)@@ -89,14 +61,13 @@89- * skipped so a broken skill never degrades the provider snapshot. On name90- * collisions the project-scoped skill wins, matching Claude Code's91- * most-specific-wins resolution.61+ * Enumerate Claude Code skills from the user config dir and project62+ * `.claude/skills` dirs for each workspace cwd (git root → cwd). Discovery is63+ * best-effort. Later roots win on name collision.9264 */9365 export const discoverClaudeSkills = Effect.fn("discoverClaudeSkills")(function* (9466 config: Pick<ClaudeSettings, "homePath">,95- cwd?: string,67+ cwd?: string | ReadonlyArray<string>,9668 environment?: NodeJS.ProcessEnv,9769 ): Effect.fn.Return<ReadonlyArray<ServerProviderSkill>, never, FileSystem.FileSystem | Path.Path> {98- const fileSystem = yield* FileSystem.FileSystem;9970 const path = yield* Path.Path;100- const configDirPath = yield* resolveClaudeConfigDirPath(config, environment ?? process.env, cwd);101-102- const roots: ReadonlyArray<{ directory: string; scope: ClaudeSkillScope }> = [71+ const resolvedEnvironment = environment ?? process.env;72+ const projectCwds = normalizeSkillWorkspaceCwds(path, cwd);73+ const configDirPath = yield* resolveClaudeConfigDirPath(
- apps/server/src/provider/Layers/ProviderRegistry.test.ts lines 58 to 64OutdatedResolvedby GenKerensky(GitHub profile, opens in a new tab)@@ -45,9 +45,20 @@4545 selectProvidersByKind,4646 } from "./ProviderRegistry.ts";4747 import * as ServerConfig from "../../config.ts";48+import { ProjectionSnapshotQuery } from "../../orchestration/Services/ProjectionSnapshotQuery.ts";4849 import * as ServerSettingsModule from "../../serverSettings.ts";4950 import { readProviderStatusCache, resolveProviderStatusCachePath } from "../providerStatusCache.ts";5051 import type { ProviderInstance } from "../ProviderDriver.ts";5152 import * as ProviderInstanceRegistry from "../Services/ProviderInstanceRegistry.ts";5253 import * as ProviderRegistry from "../Services/ProviderRegistry.ts";5354 import { makeManualOnlyProviderMaintenanceCapabilities } from "../providerMaintenance.ts";55+56+/** Empty shell for skill workspace resolution during driver health checks. */57+const emptySkillProjectionLayer = Layer.succeed(ProjectionSnapshotQuery, {58+ getShellSnapshot: () =>59+ Effect.succeed({60+ snapshotSequence: 0,61+ projects: [],62+ threads: [],63+ updatedAt: "1970-01-01T00:00:00.000Z",64+ }),apps/server/src/provider/Layers/ProviderInstanceRegistryLive.test.ts lines 139 to 145OutdatedResolvedby GenKerensky(GitHub profile, opens in a new tab)@@ -133,3 +134,12 @@133134 ...overrides,134135 });135136137+/** Empty shell for skill workspace resolution during driver health checks. */138+const emptySkillProjectionLayer = Layer.succeed(ProjectionSnapshotQuery, {139+ getShellSnapshot: () =>140+ Effect.succeed({141+ snapshotSequence: 0,142+ projects: [],143+ threads: [],144+ updatedAt: "1970-01-01T00:00:00.000Z",145+ }),
- apps/server/src/provider/Drivers/ClaudeSkills.ts line 92OutdatedResolvedby GenKerensky(GitHub profile, opens in a new tab)@@ -141,10 +81,12 @@81+ // so every workspace can contribute a distinct user root. Absolute values82+ // (the common case) collapse to a single root here.83+ const configSkillDirs = new Set<string>();84+ for (const configCwd of projectCwds.length > 0 ? projectCwds : [undefined]) {85+ const configDirPath = yield* resolveClaudeConfigDirPath(config, resolvedEnvironment, configCwd);86+ configSkillDirs.add(path.join(configDirPath, "skills"));87+ }14188142- skillsByName.set(name, {143- name,144- path: skillPath,145- enabled: true,146- scope: root.scope,147- ...(frontmatter.kind === "parsed" && frontmatter.description148- ? { description: frontmatter.description }149- : {}),150- });89+ const roots: SkillDiscoveryRoot[] = [...configSkillDirs].map((directory) => ({90+ directory,91+ scope: "user",92+ }));
- apps/server/src/provider/acp/AcpSessionRuntime.ts line 388OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -369,3 +377,12 @@369377370378 yield* acp.handleSessionUpdate((notification) =>371379 Effect.gen(function* () {380+ if (notification.update.sessionUpdate === "available_commands_update") {381+ const startState = yield* Ref.get(startStateRef);382+ // Capture during startup (Grok advertises before session/new returns)383+ // and from the live session; ignore child/foreign session updates.384+ if (385+ startState._tag !== "Started" ||386+ notification.sessionId === startState.result.sessionId387+ ) {388+ yield* Ref.set(availableCommandsRef, notification.update.availableCommands);apps/server/src/provider/Drivers/GrokSkills.ts lines 312 to 315OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +295,21 @@295+/**296+ * Inspect is the skill authority when the harness returned a report. When297+ * inspect is missing, union filesystem skills with any ACP-advertised skills298+ * so a single-cwd ACP probe cannot wipe other worktrees. ACP slash commands299+ * win when the session advertised a menu.300+ */301+export function resolveGrokPickerCatalog(input: {302+ readonly filesystemSkills: ReadonlyArray<ServerProviderSkill>;303+ readonly inspectCatalog?: GrokHarnessCatalog;304+ readonly acpCatalog?: GrokHarnessCatalog;305+}): GrokHarnessCatalog {306+ const skills = input.inspectCatalog307+ ? input.inspectCatalog.skills308+ : mergeGrokHarnessCatalogs([309+ { skills: input.filesystemSkills, slashCommands: [] },310+ input.acpCatalog ?? { skills: [], slashCommands: [] },311+ ]).skills;312+ const slashCommands =313+ input.acpCatalog && input.acpCatalog.slashCommands.length > 0314+ ? input.acpCatalog.slashCommands315+ : (input.inspectCatalog?.slashCommands ?? []);apps/server/src/provider/Drivers/GrokSkills.ts line 135OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +115,21 @@115+}116+117+function skillInventoryKey(name: string, sourceCwd: string | undefined): string {118+ return sourceCwd === undefined ? `user:${name}` : `cwd:${sourceCwd}\0${name}`;119+}120+121+function sortGrokSkills(skills: Iterable<ServerProviderSkill>): ServerProviderSkill[] {122+ return [...skills].sort((left, right) => {123+ const byName = left.name.localeCompare(right.name);124+ if (byName !== 0) {125+ return byName;126+ }127+ return (left.sourceCwd ?? "").localeCompare(right.sourceCwd ?? "");128+ });129+}130+131+function parseInspectJsonObject(text: string): unknown {132+ try {133+ return JSON.parse(text);134+ } catch {135+ const start = text.indexOf("{");apps/server/src/provider/acp/AcpSessionRuntime.ts lines 385 to 388OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -369,3 +377,12 @@369377370378 yield* acp.handleSessionUpdate((notification) =>371379 Effect.gen(function* () {380+ if (notification.update.sessionUpdate === "available_commands_update") {381+ const startState = yield* Ref.get(startStateRef);382+ // Capture during startup (Grok advertises before session/new returns)383+ // and from the live session; ignore child/foreign session updates.384+ if (385+ startState._tag !== "Started" ||386+ notification.sessionId === startState.result.sessionId387+ ) {388+ yield* Ref.set(availableCommandsRef, notification.update.availableCommands);apps/server/src/provider/Drivers/GrokSkills.ts line 189OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +169,21 @@169+170+ const projectScoped = isGrokProjectSkillSource(skill.source.type);171+ const skillSourceCwd = projectScoped ? normalizedSourceCwd : undefined;172+ const scope = nonEmptyTrimmed(skill.source.type);173+ const description = nonEmptyTrimmed(skill.description);174+175+ skillsByKey.set(skillInventoryKey(name, skillSourceCwd), {176+ name,177+ path: skillPath,178+ enabled: true,179+ ...(scope ? { scope } : {}),180+ ...(skillSourceCwd ? { sourceCwd: skillSourceCwd } : {}),181+ ...(description ? { description } : {}),182+ });183+184+ if (skill.userInvocable === false) {185+ continue;186+ }187+188+ const slashName = nonEmptyTrimmed(skill.invocableAs) ?? name;189+ slashCommandsByName.set(slashName.toLowerCase(), {
- apps/server/src/provider/Drivers/GrokSkills.ts line 316OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -0,0 +296,21 @@296+ * Inspect is the skill authority when the harness returned a report. When297+ * inspect is missing, union filesystem skills with any ACP-advertised skills298+ * so a single-cwd ACP probe cannot wipe other worktrees. ACP slash commands299+ * win when the session advertised a menu.300+ */301+export function resolveGrokPickerCatalog(input: {302+ readonly filesystemSkills: ReadonlyArray<ServerProviderSkill>;303+ readonly inspectCatalog?: GrokHarnessCatalog;304+ readonly acpCatalog?: GrokHarnessCatalog;305+}): GrokHarnessCatalog {306+ const skills = input.inspectCatalog307+ ? input.inspectCatalog.skills308+ : mergeGrokHarnessCatalogs([309+ { skills: input.filesystemSkills, slashCommands: [] },310+ input.acpCatalog ?? { skills: [], slashCommands: [] },311+ ]).skills;312+ const slashCommands =313+ input.acpCatalog && input.acpCatalog.slashCommands.length > 0314+ ? input.acpCatalog.slashCommands315+ : (input.inspectCatalog?.slashCommands ?? []);316+ return { skills, slashCommands };
- apps/server/src/provider/Layers/OpenCodeAdapter.ts line 253OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -223,0 +233,21 @@233+function parseOpenCodeSlashCommandInvocation(234+ text: string,235+): { readonly name: string; readonly arguments: string } | undefined {236+ const match = OPENCODE_SLASH_COMMAND_PATTERN.exec(text);237+ const name = match?.[1];238+ if (!match || name === undefined || name.trim().length === 0) {239+ return undefined;240+ }241+ return { name, arguments: match[2]?.trim() ?? "" };242+}243+244+/** See `OpenCodeSessionContext.sessionCommandNames` for the caching rule. */245+const resolveOpenCodeSessionCommandNames = Effect.fn("resolveOpenCodeSessionCommandNames")(246+ function* (context: OpenCodeSessionContext) {247+ if (context.sessionCommandNames !== undefined) {248+ return context.sessionCommandNames;249+ }250+ const listed = yield* runOpenCodeSdk("command.list", () =>251+ context.client.command.list({ directory: context.directory }),252+ ).pipe(253+ Effect.map((result) => new Set((result.data ?? []).map((command) => command.name))),apps/server/src/provider/Drivers/OpenCodeCommands.ts line 157OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +137,21 @@137+138+ for (const { cwd, commands } of lists) {139+ const normalizedCwd = normalizeProviderSkillWorkspacePath(cwd);140+ for (const command of commands) {141+ const key = command.name.toLowerCase();142+ const seen = seenByName.get(key);143+ if (seen) {144+ seen.cwds.add(normalizedCwd);145+ } else {146+ seenByName.set(key, { command, cwds: new Set([normalizedCwd]) });147+ }148+ }149+ }150+151+ const merged = new Map<string, ServerProviderSlashCommand>();152+ for (const builtIn of OPENCODE_BUILT_IN_SLASH_COMMANDS) {153+ merged.set(`global\0${builtIn.name.toLowerCase()}`, builtIn);154+ }155+ for (const { command, cwds } of seenByName.values()) {156+ const key = command.name.toLowerCase();157+ if (queriedCwds.size > 0 && cwds.size === queriedCwds.size) {apps/server/src/provider/Layers/OpenCodeAdapter.ts lines 1605 to 1606OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1545,0 +1586,21 @@1586+ slashInvocation !== undefined && steeringTurnId === undefined1587+ ? yield* resolveOpenCodeSessionCommandNames(context).pipe(1588+ Effect.map((names) =>1589+ names.has(slashInvocation.name) ? slashInvocation.name : undefined,1590+ ),1591+ )1592+ : undefined;1593+1594+ if (slashCommandName !== undefined && slashInvocation !== undefined) {1595+ // Native command execution. session.command blocks until the command1596+ // turn completes, so it runs in a session-scoped fiber; progress1597+ // streams through the event pump like any prompt. The recovery guard1598+ // skips turns that already transitioned (interrupt, session.error).1599+ yield* runOpenCodeSdk("session.command", () =>1600+ context.client.session.command({1601+ sessionID: context.openCodeSessionId,1602+ command: slashCommandName,1603+ arguments: slashInvocation.arguments,1604+ model: `${parsedModel.providerID}/${parsedModel.modelID}`,1605+ ...(context.activeAgent ? { agent: context.activeAgent } : {}),1606+ ...(context.activeVariant ? { variant: context.activeVariant } : {}),
- apps/web/src/components/chat/ChatComposer.tsx line 1152OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1108,13 +1142,11 @@11081142 ] satisfies ReadonlyArray<Extract<ComposerCommandItem, { type: "slash-command" }>>;1109- const providerSlashCommandItems = (selectedProviderStatus?.slashCommands ?? []).map(1110- (command) => ({1111- id: `provider-slash-command:${selectedProvider}:${command.name}`,1112- type: "provider-slash-command" as const,1113- provider: selectedProvider,1114- command,1115- label: `/${command.name}`,1116- description: command.description ?? command.input?.hint ?? "Run provider command",1117- }),1118- );1143+ const providerSlashCommandItems = selectedProviderSlashCommands.map((command) => ({1144+ id: `provider-slash-command:${selectedProvider}:${command.name}`,1145+ type: "provider-slash-command" as const,1146+ provider: selectedProvider,1147+ command,1148+ label: `/${command.name}`,1149+ description: command.description ?? command.input?.hint ?? "Run provider command",1150+ }));11191151 const query = composerTrigger.query.trim().toLowerCase();11201152 const skillItems = (selectedProviderStatus?.skills ?? [])apps/server/src/provider/Drivers/GrokSkills.ts lines 295 to 317Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +244,21 @@244+ const hint = nonEmptyTrimmed(command.input?.hint);245+ slashCommandsByName.set(name.toLowerCase(), {246+ name,247+ ...(description ? { description } : {}),248+ ...(hint ? { input: { hint } } : {}),249+ });250+251+ const skillMeta = grokAvailableCommandSkillMeta(command);252+ if (!skillMeta) {253+ continue;254+ }255+ const skillName = skillMeta.bareName ?? name;256+ const projectScoped = skillMeta.scope ? isGrokProjectSkillSource(skillMeta.scope) : false;257+ const skillSourceCwd = projectScoped ? normalizedSourceCwd : undefined;258+ skillsByKey.set(skillInventoryKey(skillName, skillSourceCwd), {259+ name: skillName,260+ path: skillMeta.path,261+ enabled: true,262+ ...(skillMeta.scope ? { scope: skillMeta.scope } : {}),263+ ...(skillSourceCwd ? { sourceCwd: skillSourceCwd } : {}),264+ ...(description ? { description } : {}),apps/server/src/provider/Drivers/GrokSkills.ts line 46Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +21,21 @@21+import * as Effect from "effect/Effect";22+import * as Exit from "effect/Exit";23+import * as FileSystem from "effect/FileSystem";24+import * as Option from "effect/Option";25+import * as Path from "effect/Path";26+import * as Schema from "effect/Schema";27+import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";28+import type * as EffectAcpSchema from "effect-acp/schema";29+30+import { spawnAndCollect } from "../providerSnapshot.ts";31+import {32+ discoverSkillsFromRoots,33+ listAncestorPaths,34+ normalizeSkillWorkspaceCwds,35+ resolveGitRootPath,36+ type SkillDiscoveryRoot,37+} from "./SkillDiscovery.ts";38+39+const GROK_USER_SKILL_DIR_NAMES = [".claude", ".agents", ".grok"] as const;40+const GROK_PROJECT_SKILL_DIR_NAMES = [".claude", ".grok"] as const;41+apps/mobile/src/features/threads/new-task-flow-provider.tsx lines 449 to 449OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -444,5 +445,5 @@444445 option.selection.instanceId === selectedModel.instanceId &&445446 option.selection.model === selectedModel.model,446447 ) ?? null;447- const selectedProviderSkills = useMemo(448- () =>448+ const skillProjectRoot = selectedProject?.workspaceRoot ?? null;449+ const skillWorkspaceCwd = selectedWorktreePath ?? skillProjectRoot;
- apps/server/src/provider/Drivers/GrokSkills.ts lines 413 to 423Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +338,21 @@338+ readonly environment?: NodeJS.ProcessEnv;339+}) {340+ const environment = input.environment ?? process.env;341+ const spawnCommand = yield* resolveSpawnCommand(input.binaryPath, ["inspect", "--json"], {342+ env: environment,343+ });344+ const result = yield* spawnAndCollect(345+ input.binaryPath,346+ ChildProcess.make(spawnCommand.command, spawnCommand.args, {347+ env: environment,348+ shell: spawnCommand.shell,349+ cwd: input.cwd,350+ }),351+ );352+ if (result.code !== 0) {353+ return yield* Effect.fail(new Error("Grok inspect exited with a non-zero status."));354+ }355+ const raw = yield* Effect.try({356+ try: () => parseInspectJsonObject(result.stdout),357+ catch: (cause) => (cause instanceof Error ? cause : new Error(String(cause))),358+ });
- apps/server/src/provider/Layers/OpenCodeAdapter.ts line 1613Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1545,0 +1593,21 @@1593+ slashInvocation !== undefined && steeringTurnId === undefined1594+ ? yield* resolveOpenCodeSessionCommandNames(context).pipe(1595+ Effect.map((names) =>1596+ names.has(slashInvocation.name) ? slashInvocation.name : undefined,1597+ ),1598+ )1599+ : undefined;1600+1601+ if (slashCommandName !== undefined && slashInvocation !== undefined) {1602+ // Native command execution. session.command blocks until the command1603+ // turn completes, so it runs in a session-scoped fiber; progress1604+ // streams through the event pump like any prompt. The recovery guard1605+ // skips turns that already transitioned (interrupt, session.error).1606+ yield* runOpenCodeSdk("session.command", () =>1607+ context.client.session.command({1608+ sessionID: context.openCodeSessionId,1609+ command: slashCommandName,1610+ arguments: slashInvocation.arguments,1611+ model: `${parsedModel.providerID}/${parsedModel.modelID}`,1612+ ...(agent ? { agent } : {}),1613+ ...(variant ? { variant } : {}),
- apps/server/src/provider/Layers/GrokProvider.ts line 373Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -291,4 +352,12 @@291352 },292353 });293354 }294- const discoveredModels = discoveryExit.value.value;355+ const discovery = discoveryExit.value.value;356+ const picker = resolveGrokPickerCatalog({357+ filesystemSkills,358+ ...(inspectCatalog ? { inspectCatalog } : {}),359+ acpCatalog: {360+ skills: discovery.skills,361+ slashCommands: discovery.slashCommands,362+ },363+ });
- @@ -365,3 +380,6 @@365380 }),366381 ).pipe(Effect.provideService(Scope.Scope, runtimeScope));367382383+ const adoptPendingAvailableCommands = (sessionId: string) =>384+ Effect.gen(function* () {385+ const pending = yield* Ref.getAndSet(pendingAvailableCommandsRef, new Map());
- @@ -371,0 +399,21 @@399+ const startState = yield* Ref.get(startStateRef);400+ if (startState._tag === "Started") {401+ // Live session menu; child/foreign session updates are ignored.402+ if (notification.sessionId === startState.result.sessionId) {403+ yield* Ref.set(availableCommandsRef, commands);404+ }405+ } else if (406+ options.resumeSessionId !== undefined &&407+ notification.sessionId === options.resumeSessionId408+ ) {409+ // Resuming: the target session id is known up front.410+ yield* Ref.set(availableCommandsRef, commands);411+ } else if (options.resumeSessionId === undefined) {412+ // Fresh startup: Grok advertises before session/new returns, but413+ // the runtime's session id is not knowable yet. Buffer per414+ // advertised id; start() adopts the matching entry.415+ yield* Ref.update(pendingAvailableCommandsRef, (pending) => {416+ const next = new Map(pending);417+ next.set(notification.sessionId, commands);418+ return next;419+ });
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.


Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
68c342b9-9201-41c1-b4e5-0334b1654663You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share