Skip to content

session_search: honor session_search.protected profile config flag - #61947

Open
MrB0req wants to merge 2 commits into
NousResearch:mainfrom
MrB0req:session-search-protected
Open

MrB0req wants to merge 2 commits into
NousResearch:mainfrom
MrB0req:session-search-protected

Conversation

@MrB0req

@MrB0req MrB0req commented Jul 10, 2026

Copy link
Copy Markdown

What

A profile can now opt out of being visible to other profiles' session_search by declaring in its own config.yaml:

session_search:
  protected: true
  • _resolve_profile_db rejects direct reads of a protected profile by any other profile (same error channel as "profile does not exist").
  • _locate_session_db skips protected profiles when scanning for a bare session id.
  • The restriction hangs on the target, not the caller: the protected profile itself can still search everyone as before (one-way glass).
  • A broken or missing target config counts as unprotected, so someone else's malformed YAML can never break your search (logged at debug level).

Why

In multi-profile deployments some profiles hold conversations of a fundamentally different sensitivity class (e.g. a personal/mental-health assistant next to infra bots). Today every profile can read every other profile's state.db through session_search — there is no permission layer at all. This adds a minimal, config-driven one.

Tests

New tests next to the existing session_search suite (tmp profiles-root + monkeypatched HERMES_HOME): caller→protected target rejected, target reads itself fine, protected caller reads others fine, locate-scan skips protected profiles, broken config treated as unprotected. Full file: 59 passed.

🤖 Generated with Claude Code

A profile with session_search.protected: true in its config.yaml is
invisible to other profiles' session_search (direct reads rejected,
profile scan skips it); the protected profile itself reads everyone
as before. Broken/missing target config counts as unprotected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/tools Tool registry, model_tools, toolsets area/config Config system, migrations, profiles sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Jul 10, 2026
@teknium1

Copy link
Copy Markdown
Collaborator

Thanks for covering both the explicit-profile and bare-ID lookup paths; current main does expose cross-profile sessions through tools/session_search_tool.py:144-208.

Problems

  • The normal agent dispatchers omit profile before calling session_search: agent/tool_executor.py:1193-1202 (sequential) and agent/agent_runtime_helpers.py:2226-2235 (concurrent). The schema advertises this argument at tools/session_search_tool.py:885-892, so the new direct-call tests do not prove the stated explicit-profile behavior for model tool calls.
  • The added tests call session_search() directly with monkeypatched profile helpers. Add execution-path coverage with a real temporary profile root/HERMES_HOME so this integration boundary is exercised.

Suggested changes

  • Forward profile=next_args.get("profile") in both inline dispatchers and add protected/unprotected regression coverage through both dispatch paths.
  • Document that this controls session_search visibility only; profiles are not filesystem sandboxes (website/docs/user-guide/profiles.md:125-133).

This is an automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 11, 2026
…E tests

Three fixes from hermes-sweeper review:

1. agent/tool_executor.py: forward profile=next_args.get("profile")
   in the sequential inline dispatcher for session_search.

2. agent/agent_runtime_helpers.py: same fix in the concurrent
   (agent-runtime) inline dispatcher.

3. website/docs/user-guide/profiles.md: document that
   session_search.protected controls session_search visibility only,
   not filesystem/memory/tool access.

Tests: add TestProtectedProfileWithRealHome — exercises profile
resolution through real HERMES_HOME filesystem layout with real
config.yaml and SessionDB files, covering explicit profile= reads,
bare _locate_session_db protection, and own-profile access.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles area/profiles Multi-profile isolation, HERMES_HOME scoping area/sessions Session lifecycle, resume, persistence, history comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants