Skip to content

fix: stamp last_used_at on E2E connect - #110

Merged
blaspat merged 1 commit into
mainfrom
fix/e2e-last-used-at
Aug 13, 2026
Merged

fix: stamp last_used_at on E2E connect#110
blaspat merged 1 commit into
mainfrom
fix/e2e-last-used-at

Conversation

@blaspat

@blaspat blaspat commented Aug 13, 2026

Copy link
Copy Markdown
Owner

What

hermes node list showed LAST_USED as - for E2E-authenticated nodes (e.g. workmac), even while connected.

Root cause

last_used_at was only ever written in one place: TokenStore.validate(). But E2E nodes authenticate via proof and explicitly skip validate() (is_valid = True # proof verified — skip token store check). So their records never got stamped.

Fix

  • tokens.py — new TokenStore.touch_last_used(name) that stamps last_used_at directly (no token check — proof was already verified by the caller). Skips revoked records, no-ops on unknown names, best-effort write (same swallow-on-failure contract as validate()).
  • wsserver/server.py — in the E2E branch, right after proof verification, call touch_last_used via asyncio.to_thread (same offload pattern as the legacy validate() path).
  • tests/test_auth.py — 3 regression tests: stamps existing record, skips revoked, no-ops on unknown.

Notes

  • No functional change to auth — the stamp is audit-only and best-effort.
  • Takes effect on next server restart (plugin is in-memory); workmac's next reconnect will populate the field.

Test

  • pytest — 52 passed (3 new)
  • ruff check — clean

E2E nodes authenticate via proof and skip token_store.validate(), the
only place that updated last_used_at. As a result `hermes node list`
showed "-" forever for E2E nodes like workmac.

Add TokenStore.touch_last_used(name) to stamp the record directly, and
call it from the E2E branch after the proof is verified (offloaded to a
thread, best-effort like the legacy path).

- tokens.py: new touch_last_used() — skips revoked, no-ops unknown names
- wsserver/server.py: stamp on E2E connect
- tests/test_auth.py: 3 regression tests

Signed-off-by: Blasius Patrick <blasius.patrick@gmail.com>
@blaspat
blaspat merged commit 699d2a8 into main Aug 13, 2026
2 checks passed
@blaspat
blaspat deleted the fix/e2e-last-used-at branch August 13, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant