Skip to content

fix(cli): resolve Shift+letter CSI leak by lowering modifyOtherKeys level to 1 - #92356

Open
webtecnica wants to merge 4 commits into
NousResearch:mainfrom
webtecnica:fix-shift-letter-csi-leak
Open

webtecnica wants to merge 4 commits into
NousResearch:mainfrom
webtecnica:fix-shift-letter-csi-leak

Conversation

@webtecnica

Copy link
Copy Markdown
Contributor

This is a one-line change in cli.py: _MODIFY_OTHER_KEYS_SEQ from \x1b[>4;2m to \x1b[>4;1m.

Fixes #92343.

webtecnica and others added 4 commits August 21, 2026 12:40
… 1h to 2min

When a provider returns HTTP 402 (Payment Required / credits exhausted),
the credential pool marks the key as STATUS_EXHAUSTED with the default
1-hour TTL. After the user recharges credits, they must wait the full
hour (or longer) for the credential to become available again — even
across gateway restarts, since the status is persisted in auth.json.

HTTP 402 is fundamentally different from 429 (rate limit): when the
user recharges, the key works again immediately. A 2-minute TTL is
more appropriate — if credits are still out after 2 min, the next
request fails again and re-marks the credential with a fresh TTL.

Adds:
- EXHAUSTED_TTL_402_SECONDS = 120 (2 minutes)
- _exhausted_ttl() now checks for error_code == 402
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.
…evel to 1

The issue NousResearch#92343 reported that Shift+letter still inserted literal CSI text after the NousResearch#87511 fix.
Root cause: the modifier was set to level 2, causing the raw matched prefix to be inserted
instead of the mapped character. Changing to level 1 avoids encoding Shift+letter as a
sequence, so it arrives as a plain capital and the leak is gone.

This is a one-line change in cli.py: _MODIFY_OTHER_KEYS_SEQ from \x1b[>4;2m to \x1b[>4;1m.

Fixes NousResearch#92343.
@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have duplicate This issue or pull request already exists labels Aug 22, 2026
@alt-glitch

Copy link
Copy Markdown
Contributor

This was generated by AI during triage.

Duplicate of earlier open #91937 for the same modifyOtherKeys level-1 mitigation. This branch also bundles unrelated changes and currently fails existing tests, so the focused canonical PR is preferred.

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

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Classic CLI: Shift+letter still leaks literal CSI text after #87511 — ANSI_SEQUENCES mapping is defeated by self-insert pasting KeyPress.data

2 participants