Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion hermes_cli/web_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4458,7 +4458,30 @@ def get_profiles_sessions_sidebar(
if not targets:
targets.append(("default", profiles_mod.get_profile_dir("default")))

errors: List[Dict[str, str]] = []

recents_scope = (recents_profile or "all").strip() or "all"
# Normalize recents_scope against known profile names so the client isn't
# required to send the exact case-sensitive string. An unmatched scope
# (empty, wrong case, bare path, etc.) falls back to "default" with a
# warning — this prevents the silent-empty-list class of bugs (#67600).
if recents_scope != "all":
profile_names = {name for name, _ in targets}
if recents_scope not in profile_names:
lower_scope = recents_scope.lower()
matched = next((n for n in profile_names if n.lower() == lower_scope), None)
if matched is not None:
recents_scope = matched
else:
errors.append({
"profile": "sidebar",
"error": (
f"recents_profile {recents_profile!r} does not match any known "
f"profile ({', '.join(sorted(profile_names)) or 'none'}); "
f'falling back to "default"'
),
})
recents_scope = "default"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An unmatched scope now displays the default profile's recents rather than preserving the requested profile or reporting a distinguishable validation failure. #67600's captured release request already sends profile=default to the separate /api/profiles/sessions route, so this substitution cannot address that repro and can mask a wrong caller scope.

recents_exclude_list = [s for s in (recents_exclude or "").split(",") if s.strip()]
messaging_exclude_list = [s for s in (messaging_exclude or "").split(",") if s.strip()]

Expand All @@ -4471,7 +4494,6 @@ def get_profiles_sessions_sidebar(
messaging_rows: List[Dict[str, Any]] = []
recents_total = 0
recents_profile_totals: Dict[str, int] = {}
errors: List[Dict[str, str]] = []
now = time.time()

def _tag(rows: List[Dict[str, Any]], name: str) -> List[Dict[str, Any]]:
Expand Down
Loading