fix(tui): release active-session lease immediately on session detach, not after orphan-reap delay (#68920) - #68947
Conversation
Previously _count_skills() only counted SKILL.md files inside the profile's own skills/ directory, making the WebUI profile card show a misleading low count (e.g. 0 for 'default', 30 for 'webtecnica') even though the profile loaded 150+ skills from global + external dirs. Now it scans three sources: 1. Profile-specific skills/ dir (as before) 2. Global ~/.hermes/skills/ dir (via get_default_hermes_root) 3. External dirs from skills.external_dirs config Deduplication by skill name (from YAML frontmatter) prevents double- counting when the same skill exists in both global and profile dirs, matching how scan_skill_commands() loads skills at runtime. The cache is updated to key on all scanned directories and track their combined mtime signatures.
34b35dd to
79d94a5
Compare
|
Thanks for isolating the lease release to the disconnect lifecycle. Problems
Suggested changes
Automated hermes-sweeper review. |
SummaryTwo PRs address #68920 at different lifecycle points: #68947 releases leases on WebSocket detach, while #68949 reclaims same-process, owner-tagged leases after their sessions disappear from the live registry. The reported zombie-lease mechanism is now implemented on main by Related pull requests
Duplicates#68947 and #68949 are complementary, not strict duplicates: #68947 releases on clean WebSocket detach, whereas #68949 reclaims leases when release never ran; the current main implementation follows the live-registry reconciliation approach represented by #68949. Suggested consolidationKeep #68947 open with a salvage path, consistent with its automated keep-open review: rebase it onto current main, split out the unrelated Complex graphflowchart LR
classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
classDef best stroke-width:3px,stroke:#b45309
classDef target stroke-width:3px,stroke:#4338ca
I68920(["issue #68920 (closed)"])
P68947["PR #68947 (open)"]
P68947 -->|best fix| I68920
class I68920 closed
class P68947 open
class P68947 best
class P68947 target
click I68920 "https://github.com/NousResearch/hermes-agent/issues/68920"
click P68947 "https://github.com/NousResearch/hermes-agent/pull/68947"
Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed (state tag in the node label). Cross-PR triage: Reviewed 2 pull requests and 1 issue in this complex. Each diff was read against this issue; Assessment working set: 25 kB of PR diffs, 7 kB of issue/PR text, 4 kB of discussion (7 comments), 5 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch. |
|
Closing: this was fixed differently on main by e35c2f6 ('claim the cap slot on first turn, not on open') — lease acquisition moved to the first real turn, so parked tabs and rapid /new no longer hold slots at all and the 20s-window leak this PR targeted can no longer occur (#68920 was closed on the same basis). The branch also picked up unrelated hermes_cli/profiles.py changes. Thanks for the analysis @webtecnica — the diagnosis of the lease window was correct. |
Closes #68920
Problem
Desktop/TUI sessions leak active-session leases. When user does /new, the old session is detached with a 20s orphan-reap delay, but the lease stays active during that window. Multiple rapid /new commands exhaust max_concurrent_sessions.
Fix
Release the lease immediately on session detach, before the orphan-reap timer starts. _release_active_session_slot is idempotent.