Skip to content

fix(pairing): stop labeling hash fingerprint as 'Code' in list output - #66761

Closed
lhridley wants to merge 1 commit into
NousResearch:mainfrom
lhridley:fix/telegram-pairing-fingerprint
Closed

lhridley wants to merge 1 commit into
NousResearch:mainfrom
lhridley:fix/telegram-pairing-fingerprint

Conversation

@lhridley

Copy link
Copy Markdown

Problem

hermes pairing list displayed hash_val[:8] (the first 8 hex chars of the
pairing code's SHA-256 hash) under a column labeled "Code". Operators
reasonably copied that value and ran hermes pairing approve <platform> <code>,
which always failed with "Code '…' not found or expired" — the fingerprint is
never an approvable code. The real code is only delivered via the bot's DM.
This produced an endless approval loop (verified symptom: the same user
generated a fresh pending code on every DM, each showing a different
non-approvable fingerprint).

Fix

  • list: relabel the column to "Request ID" and add a note pointing the
    operator to the DM-sent code.
  • approve: reject an 8-hex fingerprint input explicitly with guidance instead
    of the cryptic "not found" error.

Verification

Local import + stubbed gateway.pairing: an 8-hex fingerprint input is
rejected without calling approve_code, and prints the corrective message.
Syntax + static checks pass. No token/secret touched.

Note

The fix only affects CLI ergonomics for authorizing new users; existing
approved users are unaffected.

The 'list' command displayed hash_val[:8] (first 8 hex chars of the
code's SHA-256 hash) under a 'Code' column. Operators copied that
value and ran 'hermes pairing approve', which always failed with
'not found' because the fingerprint is not the approvable code. The
real code is delivered via the bot's DM.

- relabel the column to 'Request ID' and add a note pointing to the
  DM-sent code
- make approve reject an 8-hex fingerprint input with a clear message
  instead of a cryptic 'not found'

Reported symptom: pairing approval looped endlessly because the only
code visible via CLI was a non-approvable hash.
@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists labels Jul 18, 2026
@alt-glitch

Copy link
Copy Markdown
Contributor

This was generated by AI during triage.

Related to #46584: this PR prevents the misleading hash-prefix workflow in the CLI, while #46584 makes a listed server-side request ID actually approvable across CLI and dashboard. The approaches overlap but are not redundant.

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review Summary

Verdict: Approved

Straightforward UX fix that correctly renames the "Code" column to "Request ID" in hermes pairing list output, since the displayed value is the SHA-256 hash prefix — not the actual approvable code (which comes from the bot's DM). Also adds a helpful note explaining this distinction and includes a regex guard to reject the 8-char hex hash input and guide the operator to the correct code source. The test in the diff validates the rejection of hash-prefix input.


Reviewed by Hermes Agent

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Reviewed by Hermes Agent

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Reviewed by Hermes Agent

@teknium1 teknium1 left a comment

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.

Thanks for addressing a real CLI mismatch: current main labels a hash prefix as a code even though the DM contains the actual approvable value (hermes_cli/pairing.py:42-47, gateway/pairing.py:542-565).

Problems

  • hermes_cli/pairing.py:82 rejects any eight-character hexadecimal input. That can be a valid generated code: gateway/pairing.py:43-44 uses an eight-character alphabet containing A-F and 2-9, so a value such as ABCDEF23 is possible and should reach approve_code().
  • The new Request ID heading is not exact. The displayed field is a truncated hash prefix; the actual stored entry ID is generated separately (gateway/pairing.py:453-458, gateway/pairing.py:561-565).

Suggested changes

  • Detect a displayed fingerprint by comparing against pending entries for the platform, not by matching its character shape; add a regression test that an all-hex valid code remains approvable.
  • Rename the column to Fingerprint/Hash prefix, or expose a real request ID if that is the intended contract.

Automated hermes-sweeper review.

Comment thread hermes_cli/pairing.py
# 8 hex chars of the code's SHA-256 hash, NOT the approvable code. Reject
# hash-prefix input explicitly so operators don't chase a "wrong code"
# rabbit hole (the real code comes from the bot's DM).
if re.fullmatch(r"[0-9a-fA-F]{8}", code):

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.

This guard also rejects legitimate pairing codes. gateway/pairing.py generates eight-character codes from an alphabet containing A-F and 2-9, so ABCDEF23 is valid and must reach approve_code(). Identify an input as a displayed fingerprint by comparing it with pending fingerprints, not by its shape.

Comment thread hermes_cli/pairing.py
print(f"\n Pending Pairing Requests ({len(pending)}):")
print(f" {'Platform':<12} {'Code':<10} {'User ID':<20} {'Name':<20} {'Age'}")
print(f" {'--------':<12} {'----':<10} {'-------':<20} {'----':<20} {'---'}")
print(f" {'Platform':<12} {'Request ID':<10} {'User ID':<20} {'Name':<20} {'Age'}")

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.

The displayed value is a truncated SHA-256 hash prefix, not the stored request entry ID (gateway/pairing.py:453-458, gateway/pairing.py:561-565). Fingerprint or Hash prefix would be accurate here.

@teknium1 teknium1 added sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 18, 2026
@OutThisLife

Copy link
Copy Markdown
Contributor

Your diagnosis was right: the value under "Code" is a hash fingerprint that can never be approved, and operators were looping on it. #74427 fixes it structurally rather than by relabeling — pending entries now carry a real request_id that hermes pairing approve accepts, so there's no longer a non-approvable value on screen to guard against. Thanks for the writeup; the reproduction made the root cause obvious.

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 P2 Medium — degraded but workaround exists sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants