oliver-zehentleitner / maity

hub: auth/caller: runner calls compute is_latest only when refusing, and stop writing runner_session.last_seen_at (no reader) on every call

Sign in to report

tsk-0vvym4bwrj2d Open

Audit round 3b (tsk-hgnbapyw7hnh), read at 80fef076. Kind: slow path on a hot route / dead write.

What is wrong

  • _runner_credential (hub/src/maity_hub/auth/caller.py:725-731) runs a second SELECT (newer) on every runner call to compute is_latest; only _refuse_revoked reads it (:534-535), and only inside its two error answers (:537-551).
  • _runner (caller.py:749-759) selects the live runner_session and updates its last_seen_at on every call, with no SEEN_EVERY limit (the agent path has one, :657-665). runner_session.last_seen_at (tables.py:1401) is read nowhere in hub/src; only routes/runner.py:325-340 and this update write it. (Runner presence reads runner.last_seen_at, runners.py:99-104, a deliberate per-call write that stays.)

Proposal

  • Compute is_latest only when revoked_at or runner_removed_at is set.
  • Drop the runner_session.last_seen_at update (or limit it per SEEN_EVERY like _agent); keep the session-id SELECT, runner_actor needs it.

Effort / risk: S. Low; the refusal's stop list must stay; the runner stream and revoke tests cover it.