Skip to content

The agent that grows with you

fix(gateway): first-contact note only in DMs, offer flag saved in the routed profile (#127818)

Siddharth Balyanbc7f58f3b027
diff --git a/gateway/run_turn.py b/gateway/run_turn.py
index c980663fbf7..75f26676a14 100644
--- a/gateway/run_turn.py
+++ b/gateway/run_turn.py
@@ -1409,22 +1409,23 @@ class GatewayTurnMixin:
"""First-ever-message onboarding note + one-time 'no home channel' prompt (both only when
the session has no history). Delivered on the user message (sidecar), NOT the ephemeral
system prompt: present-on-turn-1/absent-on-turn-2 was a guaranteed prompt diff + rebuild."""
- from gateway.run import _hermes_home, _home_target_env_var, _load_gateway_config
+ from gateway.run import _gateway_config_home, _home_target_env_var, _load_gateway_config
if history:
return
- if not await self.async_session_store.has_any_sessions():
+ human_platform = bool(source.platform) and source.platform not in (Platform.LOCAL, Platform.WEBHOOK)
+ if human_platform and source.chat_type == "dm" and not await self.async_session_store.has_any_sessions():
# Same branch logic as the TUI (profile-build offer once when "ask", else plain intro);
# first_contact_turn_note already falls back to the plain intro on error.
from agent.onboarding import first_contact_turn_note
note = first_contact_turn_note(
- _load_gateway_config(), _hermes_home / "config.yaml",
+ _load_gateway_config(), _gateway_config_home() / "config.yaml",
session_history_empty=True, install_has_prior_sessions=False,
)
if note:
turn_sidecar_notes.append(note)
# One-time prompt if no home channel is set (webhooks deliver to configured targets instead).
- if not source.platform or source.platform in (Platform.LOCAL, Platform.WEBHOOK):
+ if not human_platform:
return
platform_name = source.platform.value
env_key = _home_target_env_var(platform_name)
diff --git a/website/docs/user-guide/configuration.md b/website/docs/user-guide/configuration.md
index 8ff1e0b6d15..977f052c497 100644
--- a/website/docs/user-guide/configuration.md
+++ b/website/docs/user-guide/configuration.md
@@ -3051,7 +3051,7 @@ onboarding:
seen: {} # internal latch — leave empty
```
-- `profile_build` — controls the profile-build path offered on the very first gateway message ever. `"ask"` (default) offers to build a user profile; the offer is **opt-in and consent-gated** — the agent asks before any lookup and never reads connected accounts silently. `"off"` shows a plain intro only. The offer fires at most once.
+- `profile_build` — controls the profile-build path offered on a profile's first direct message through the gateway (never in a group chat). `"ask"` (default) offers to build a user profile; the offer is **opt-in and consent-gated** — the agent asks before any lookup and never reads connected accounts silently. `"off"` shows a plain intro only. The offer fires at most once per profile.
- `seen` — internal state. Hermes latches each shown hint here so it never fires again; the profile-build offer is also recorded here once shown. Don't hand-edit it — wipe the whole `onboarding` section if you want to re-see all hints.
## Dashboard