Skip to content

perf(profiles): allow lightweight profile listing - #52433

Closed
0disoft wants to merge 1 commit into
NousResearch:mainfrom
0disoft:task/profile-list-lightweight
Closed

perf(profiles): allow lightweight profile listing#52433
0disoft wants to merge 1 commit into
NousResearch:mainfrom
0disoft:task/profile-list-lightweight

Conversation

@0disoft

@0disoft 0disoft commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds opt-in lightweight profile listing so callers that only need profile names and directories do not pay every per-profile detail cost.

list_profiles() still returns the same full ProfileInfo data by default. New keyword-only flags let hot paths skip specific expensive details:

  • include_model skips config.yaml parsing
  • include_distribution skips distribution.yaml parsing
  • include_description skips profile.yaml parsing
  • include_gateway_status skips gateway PID/runtime-state checks
  • include_skill_count skips recursive skills/**/SKILL.md counting
  • include_alias skips wrapper alias scanning
  • include_env skips .env existence checks

This keeps detailed surfaces such as hermes profile list and /api/profiles unchanged, while cheaper routing/sync paths use minimal profile records.

Related Issue

N/A. I searched open issues/PRs for profile list skills count performance and did not find a direct duplicate.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • hermes_cli/profiles.py
    • Adds keyword-only include flags to list_profiles() with all defaults preserving current behavior.
    • Skips optional I/O and recursive scans when callers request lightweight profile records.
  • Updated lightweight call sites that only need name/path or a narrow subset of fields:
    • update bundled-skill sync
    • session search cross-profile lookup
    • dashboard profile-session aggregation
    • gateway process discovery and gateway list
    • doctor profile checks
    • uninstall named-profile discovery
    • kanban decomposition profile roster
    • profile description listing
    • Honcho profile sync/status helpers
    • kanban dashboard profile roster
  • Tests:
    • Adds a list_profiles() test proving expensive helpers are not called when detail flags are disabled.
    • Updates a session-search test double to accept the new keyword-only call shape.

How to Test

  1. Focused profile listing tests:

    uv run --with pytest --with pytest-timeout --with pytest-xdist python -m pytest tests/hermes_cli/test_profiles.py::TestListProfiles -q

    Result: 5 passed

  2. Distribution metadata compatibility:

    uv run --with pytest --with pytest-timeout --with pytest-xdist python -m pytest tests/hermes_cli/test_profile_distribution.py -q

    Result: 69 passed

  3. Kanban roster behavior:

    uv run --with pytest --with pytest-timeout --with pytest-xdist python -m pytest tests/hermes_cli/test_kanban_decompose.py -q

    Result: 9 passed

  4. Dashboard profile/session paths:

    uv run --with pytest --with pytest-timeout --with pytest-xdist python -m pytest tests/hermes_cli/test_web_server.py -k "profiles_sessions or profiles_list" -q

    Result: 4 passed, 311 deselected

  5. Session search:

    uv run --with pytest --with pytest-timeout --with pytest-xdist python -m pytest tests/tools/test_session_search.py -q

    Result: 47 passed

  6. Update profile skill sync:

    uv run --with pytest --with pytest-timeout --with pytest-xdist python -m pytest tests/hermes_cli/test_cmd_update.py::TestCmdUpdateProfileSkillSync -q

    Result: 2 passed

  7. Syntax and whitespace checks:

    python -m py_compile hermes_cli/profiles.py hermes_cli/main.py hermes_cli/gateway.py hermes_cli/doctor.py hermes_cli/uninstall.py hermes_cli/kanban_decompose.py hermes_cli/profile_describer.py hermes_cli/web_server.py tools/session_search_tool.py plugins/memory/honcho/cli.py plugins/kanban/dashboard/plugin_api.py tests/hermes_cli/test_profiles.py tests/tools/test_session_search.py
    git diff --check

    Result: passed.

I also tried a broader direct pytest run for tests/hermes_cli/test_profiles.py tests/hermes_cli/test_profile_distribution.py tests/hermes_cli/test_kanban_decompose.py; the new/related tests passed, but 5 existing profile tests failed on this Windows direct-pytest environment because of existing cp949 default decoding and Windows chmod mode behavior. I did not change those unrelated tests in this PR.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Windows 11

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — N/A, internal API behavior documented in code
  • I've updated cli-config.yaml.example if I added/changed config keys — N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide
  • I've updated tool descriptions/schemas if I changed tool behavior — N/A

For New Skills

N/A.

Screenshots / Logs

N/A. This is an internal profile-listing performance path change.

AI assistance: this PR was prepared with Codex assistance; I reviewed the diff and ran the verification listed above.

@alt-glitch alt-glitch added type/perf Performance improvement or optimization comp/cli CLI entry point, hermes_cli/, setup wizard comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have labels Jun 25, 2026
@0disoft
0disoft marked this pull request as ready for review June 26, 2026 02:43
@0disoft 0disoft changed the title [codex] perf(profiles): allow lightweight profile listing perf(profiles): allow lightweight profile listing Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have type/perf Performance improvement or optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants