The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(onboarding): the setup profile pins its own tool limits; guide readers wait for the state read
alt-glitche194c25a0626
diff --git a/apps/desktop/src/components/onboarding-chat/gate.tsx b/apps/desktop/src/components/onboarding-chat/gate.tsxindex 64b01a3b96e..6899e2ba451 100644--- a/apps/desktop/src/components/onboarding-chat/gate.tsx+++ b/apps/desktop/src/components/onboarding-chat/gate.tsx@@ -12,6 +12,7 @@ import {abandonGuide,beginOnboardingFlow,type GuideKickoffResult,+ markOnboardingStateRead,runGuideKickoff} from '@/store/onboarding-gate'@@ -32,16 +33,18 @@ export function OnboardingChatGate({ enabled, onKickoff, requestGateway }: Onboareturn}- void requestGateway<OnboardingStateResult>('onboarding.state').then(- state => {- beginOnboardingFlow(state, $desktopOnboarding.get().firstRunSkipped)+ void requestGateway<OnboardingStateResult>('onboarding.state')+ .then(+ state => {+ beginOnboardingFlow(state, $desktopOnboarding.get().firstRunSkipped)- if ($onboardingGate.get().guideQueued) {- takeGuideShape()- }- },- error => console.warn('[onboarding] state could not be read', error)- )+ if ($onboardingGate.get().guideQueued) {+ takeGuideShape()+ }+ },+ error => console.warn('[onboarding] state could not be read', error)+ )+ .finally(markOnboardingStateRead)}, [enabled, requestGateway])useEffect(() => {diff --git a/apps/desktop/src/store/onboarding-gate.ts b/apps/desktop/src/store/onboarding-gate.tsindex f22ff933389..378e795cd5d 100644--- a/apps/desktop/src/store/onboarding-gate.ts+++ b/apps/desktop/src/store/onboarding-gate.ts@@ -23,6 +23,8 @@ type GuideKickoff =export const $onboardingGate = atom<OnboardingGateState>({ phase: 'idle', guideQueued: false, guideKickoff: 'idle' })+const $onboardingStateRead = atom(false)+let guideKickoff: GuideKickoff = { status: 'idle' }export const $guideOpening = computed($onboardingGate,@@ -52,6 +54,23 @@ export function guidedOnboardingActive(): boolean {return isOnboardingEnabled() && (phase === 'pending' || phase === 'guided' || phase === 'handoff')}+export function markOnboardingStateRead(): void {+ $onboardingStateRead.set(true)+}++export function afterOnboardingStateRead(run: () => void): void {+ if (!isOnboardingEnabled() || $onboardingStateRead.get()) {+ run()++ return+ }++ const stop = $onboardingStateRead.listen(() => {+ stop()+ run()+ })+}+export function beginOnboardingFlow(state: OnboardingStateResult, firstRunSkipped: boolean): void {if (!isOnboardingEnabled() ||diff --git a/apps/desktop/src/store/onboarding.ts b/apps/desktop/src/store/onboarding.tsindex 7fa387c5367..58625eb5827 100644--- a/apps/desktop/src/store/onboarding.ts+++ b/apps/desktop/src/store/onboarding.ts@@ -20,7 +20,7 @@ import { ackFreeTierNotice, freeTierReadyPending, refreshFreeTierStatus, setFreeimport { $gatewayBootGeneration } from '@/store/live-sync'import { setMainModelAssignment } from '@/store/model-assignment'import { dismissNotification, notify, notifyError } from '@/store/notifications'-import { guidedOnboardingActive } from '@/store/onboarding-gate'+import { afterOnboardingStateRead, guidedOnboardingActive } from '@/store/onboarding-gate'import { captureOnboardingScope, type OnboardingScope } from '@/store/onboarding-scope'import type { OAuthProvider, OAuthStartResponse } from '@/types/hermes'@@ -561,11 +561,13 @@ export function requestDesktopOnboarding(reason = DEFAULT_ONBOARDING_REASON) {// refresh, a setup-profile session before its runtime settles) would drop// the provider picker over the guide the user is in the middle of. Sign-in// is offered where the guide chooses to, on its own ready screen.- if (guidedOnboardingActive()) {- return- }+ afterOnboardingStateRead(() => {+ if (guidedOnboardingActive()) {+ return+ }- patch({ reason: reason.trim() || DEFAULT_ONBOARDING_REASON, requested: true })+ patch({ reason: reason.trim() || DEFAULT_ONBOARDING_REASON, requested: true })+ })}/** Credential warning delivered passively (session create/activate/resume@@ -845,13 +847,15 @@ async function applyFreeTierIntro(ctx: OnboardingContext, runtime: RuntimeReadin// window) covered the guide mid-conversation, and dismissing it remounted// the card the user had just answered. The guide acks the notice itself// when it hands off.- if (guidedOnboardingActive()) {- return- }+ afterOnboardingStateRead(() => {+ if (guidedOnboardingActive()) {+ return+ }- if (freeTierReadyPending(status, runtime.freeTier ?? null)) {- patch({ freeTierReady: true })- }+ if (freeTierReadyPending(status, runtime.freeTier ?? null)) {+ patch({ freeTierReady: true })+ }+ })}/** "Begin" / "Sign in instead" / "Other providers" all consume the notice — thediff --git a/apps/shared/src/gateway-contract.generated.ts b/apps/shared/src/gateway-contract.generated.tsindex 6ee2c2c9a83..9d47dcd8cf9 100644--- a/apps/shared/src/gateway-contract.generated.ts+++ b/apps/shared/src/gateway-contract.generated.ts@@ -2100,11 +2100,6 @@ export interface OnboardingEnsureSetupProfileResult {path: stringcreated: boolean}-export interface OnboardingEnsureSetupSessionResult {- profile: string- session_id: string- empty: boolean-}export interface OnboardingStateResult {eligible: booleanintro: OnboardingIntro@@ -5114,7 +5109,6 @@ export interface RpcMethods {'model.save_key': { params: ModelSaveKeyParams; result: ModelSaveKeyResult }/** Create-or-read the backend-owned setup profile; the backend picks the name. */'onboarding.ensure_setup_profile': { params: Params; result: OnboardingEnsureSetupProfileResult }- 'onboarding.ensure_setup_session': { params: Params; result: OnboardingEnsureSetupSessionResult }'onboarding.mark_seen': { params: Params; result: OnboardingStateResult }'onboarding.record_failed_start': { params: Params; result: OnboardingStateResult }/** Restore the setup profile to its created state in place (soul, memories, skills, sessions). */@@ -5514,7 +5508,6 @@ export const RPC_METHODS = ['model.options','model.save_key','onboarding.ensure_setup_profile',- 'onboarding.ensure_setup_session','onboarding.mark_seen','onboarding.record_failed_start','onboarding.reset_setup_profile',diff --git a/apps/shared/src/gateway-contract.openrpc.json b/apps/shared/src/gateway-contract.openrpc.jsonindex 8c7a5548959..0a8d6f4187d 100644--- a/apps/shared/src/gateway-contract.openrpc.json+++ b/apps/shared/src/gateway-contract.openrpc.json@@ -1968,24 +1968,6 @@}}},- {- "name": "onboarding.ensure_setup_session",- "summary": "",- "params": [- {- "name": "params",- "schema": {- "$ref": "#/components/schemas/Params"- }- }- ],- "result": {- "name": "result",- "schema": {- "$ref": "#/components/schemas/OnboardingEnsureSetupSessionResult"- }- }- },{"name": "onboarding.mark_seen","summary": "",@@ -19720,30 +19702,6 @@"title": "OnboardingEnsureSetupProfileResult","type": "object"},- "OnboardingEnsureSetupSessionResult": {- "additionalProperties": false,- "properties": {- "profile": {- "title": "Profile",- "type": "string"- },- "session_id": {- "title": "Session Id",- "type": "string"- },- "empty": {- "title": "Empty",- "type": "boolean"- }- },- "required": [- "profile",- "session_id",- "empty"- ],- "title": "OnboardingEnsureSetupSessionResult",- "type": "object"- },"OnboardingIntro": {"enum": ["unseen",diff --git a/hermes_cli/setup_profile.py b/hermes_cli/setup_profile.pyindex 51fcb46756a..3738a4936ac 100644--- a/hermes_cli/setup_profile.py+++ b/hermes_cli/setup_profile.py@@ -15,10 +15,10 @@ logger = logging.getLogger(__name__)SETUP_PROFILE_NAME = "hermes-setup"SETUP_PROFILE_DESCRIPTION = "Where Hermes met you — walks your first run, then checks in as you find your feet."-SETUP_CHAT_TITLE = "Welcome to Hermes"MAX_FAILED_STARTS = 3_FRESH_STATE = {"intro": "unseen", "failed_starts": 0}_SETUP_TOOLSETS = ["setup", "start_chat", "no_mcp"]+_SETUP_DISABLED_TOOLSETS = ["catalog"]_SETUP_DEFERRED_TOOLS = ["computer_use", "session_search", "image_generate", "todo_list", "process_manage", "cronjob_manage","drive_preview", "gui_tour", "desktop_preview", "annotate_preview", "show_tip", "desktop_project",@@ -147,12 +147,16 @@ def _write_state(path: Path, state: dict) -> None:def _write_setup_config(path: Path) -> None:+ from agent.skill_utils import parse_config_string_listfrom hermes_cli.config import atomic_config_write, read_user_config_rawconfig_path = path / "config.yaml"config = read_user_config_raw(config_path)- tools = config.get("tools") or {}+ agent = config.get("agent") or {}+ disabled = parse_config_string_list(agent.get("disabled_toolsets"))+ config["agent"] = {**agent, "coding_context": "off",+ "disabled_toolsets": list(dict.fromkeys([*disabled, *_SETUP_DISABLED_TOOLSETS]))}config["platform_toolsets"] = {**(config.get("platform_toolsets") or {}), "cli": list(_SETUP_TOOLSETS)}- config["tools"] = {**tools, "tool_search": {**(tools.get("tool_search") or {}), "defer": list(_SETUP_DEFERRED_TOOLS)}}+ config["tools"] = {**(config.get("tools") or {}), "tool_search": {"defer": list(_SETUP_DEFERRED_TOOLS)}}config["display"] = {**(config.get("display") or {}), "show_reasoning": False}atomic_config_write(config_path, config)diff --git a/tui_gateway/contracts/profiles_vault_complete_foreign_subagents.py b/tui_gateway/contracts/profiles_vault_complete_foreign_subagents.pyindex 170270ee1bc..981b64570f2 100644--- a/tui_gateway/contracts/profiles_vault_complete_foreign_subagents.py+++ b/tui_gateway/contracts/profiles_vault_complete_foreign_subagents.py@@ -393,15 +393,6 @@ method("onboarding.ensure_setup_profile", params=Params, result=OnboardingEnsuredoc="Create-or-read the backend-owned setup profile; the backend picks the name.")-class OnboardingEnsureSetupSessionResult(Result):- profile: str- session_id: str- empty: bool---method("onboarding.ensure_setup_session", params=Params, result=OnboardingEnsureSetupSessionResult)--class OnboardingIntro(WireEnum):unseen = "unseen"seen = "seen"diff --git a/tui_gateway/methods_onboarding.py b/tui_gateway/methods_onboarding.pyindex 4438f9d39f6..cd0486e764f 100644--- a/tui_gateway/methods_onboarding.py+++ b/tui_gateway/methods_onboarding.py@@ -16,27 +16,6 @@ def _(rid, params: dict) -> dict:return _ok(rid, {"name": setup.name, "path": str(setup.path), "created": setup.created})-@method("onboarding.ensure_setup_session")-def _(rid, params: dict) -> dict:- from hermes_cli.setup_profile import SETUP_CHAT_TITLE, ensure_setup_profile- from hermes_state_registry import acquire, release_or_close- try:- setup = ensure_setup_profile()- if setup.created:- _mirror_launch_credentials(setup.path, {"share_auth": True})- db = acquire(setup.path / "state.db")- try:- row = db.get_session_by_title(SETUP_CHAT_TITLE)- if row is None:- row = {"id": db.create_session(new_session_id(), "desktop"), "message_count": 0}- db.set_session_title(row["id"], SETUP_CHAT_TITLE)- finally:- release_or_close(db)- except Exception as e:- return _err(rid, 5075, str(e))- return _ok(rid, {"profile": setup.name, "session_id": row["id"], "empty": not row["message_count"]})--@method("onboarding.state")def _(rid, params: dict) -> dict:from hermes_cli.setup_profile import read_state