Filter hidden runtimes from welcome readiness

Signed-off-by: kenny lopez <klopez4212@gmail.com>
This commit is contained in:
kenny lopez
2026-07-27 13:30:06 +01:00
parent 6e81545168
commit 64cd41500b
2 changed files with 53 additions and 3 deletions
@@ -9,6 +9,7 @@ import {
classifyWelcomeKickoffResolution,
createWelcomeKickoffCoordinator,
mergeKickoffEvents,
resolveWelcomeAgentReadiness,
resolveWelcomeAgentSet,
selectWelcomeKickoffIntroTeammates,
waitForWelcomeKickoffBeat,
@@ -33,6 +34,28 @@ const fizz = agent("Fizz", "builtin:fizz", "f".repeat(64));
const honey = agent("Honey", "builtin:honey", "h".repeat(64));
const bumble = agent("Bumble", "builtin:bumble", "b".repeat(64));
test("welcome readiness ignores a hidden logged-in runtime", () => {
const runtimes = [
{
id: "claude",
label: "Claude",
availability: "available",
authStatus: { status: "logged_in" },
},
];
const globalConfig = {
env_vars: {},
provider: null,
model: null,
preferred_runtime: null,
};
assert.deepEqual(
resolveWelcomeAgentReadiness(runtimes, globalConfig, ["claude"]),
{ ready: false },
);
});
test("resolveWelcomeAgentSet orders agents by stable persona identity", () => {
assert.deepEqual(resolveWelcomeAgentSet([bumble, fizz, honey]), {
lead: fizz,
@@ -5,6 +5,10 @@ import {
useAcpRuntimesQuery,
useManagedAgentsQuery,
} from "@/features/agents/hooks";
import {
filterEnabledAcpRuntimes,
useDisabledAcpRuntimeIds,
} from "@/features/agents/lib/runtimeVisibilityPreference";
import { clearActiveTurnsForAgentOnStop } from "@/features/agents/managedAgentRuntimeHooks";
import { useImplicitGlobalAgentConfig } from "@/features/agents/useGlobalAgentConfig";
import { useCommunities } from "@/features/communities/useCommunities";
@@ -27,7 +31,13 @@ import { hasManagedAgentChannelMessageMarker } from "@/shared/api/tauriManagedAg
import { sendManagedAgentChannelMessage } from "@/shared/api/tauriManagedAgentMessages";
import { getPresence, listManagedAgents } from "@/shared/api/tauri";
import { getProfile } from "@/shared/api/tauriProfiles";
import type { Channel, ManagedAgent, RelayEvent } from "@/shared/api/types";
import type {
AcpRuntimeCatalogEntry,
Channel,
GlobalAgentConfig,
ManagedAgent,
RelayEvent,
} from "@/shared/api/types";
import { normalizePubkey } from "@/shared/lib/pubkey";
import { useQueryClient } from "@tanstack/react-query";
@@ -46,6 +56,17 @@ export const WELCOME_KICKOFF_PROVIDER_MESSAGE =
const WELCOME_KICKOFF_CTA =
"What can we help you build? Bring us something you're working on, or give us a quick challenge to see how we work together.";
export function resolveWelcomeAgentReadiness(
runtimes: readonly AcpRuntimeCatalogEntry[],
globalConfig: GlobalAgentConfig,
disabledRuntimeIds: readonly string[],
) {
return resolveAgentReadiness(
filterEnabledAcpRuntimes(runtimes, disabledRuntimeIds),
globalConfig,
);
}
function formatAgentNames(agents: readonly ManagedAgent[]) {
if (agents.length === 0) return "";
if (agents.length === 1) return agents[0]?.name ?? "";
@@ -496,6 +517,7 @@ export function useWelcomeKickoff(
const { activeCommunity } = useCommunities();
const runtimesQuery = useAcpRuntimesQuery();
const managedAgentsQuery = useManagedAgentsQuery();
const disabledRuntimeIds = useDisabledAcpRuntimeIds();
const { globalConfig, isLoading: configLoading } =
useImplicitGlobalAgentConfig();
const channelId = activeChannel?.id ?? null;
@@ -549,8 +571,13 @@ export function useWelcomeKickoff(
[activeCommunity?.relayUrl, managedAgentsQuery.data],
);
const readiness = React.useMemo(
() => resolveAgentReadiness(runtimesQuery.data ?? [], globalConfig),
[globalConfig, runtimesQuery.data],
() =>
resolveWelcomeAgentReadiness(
runtimesQuery.data ?? [],
globalConfig,
disabledRuntimeIds,
),
[disabledRuntimeIds, globalConfig, runtimesQuery.data],
);
React.useEffect(() => {
if (