Skip to main content

Module self_keys

Module self_keys 

Source
Expand description

Identity M4d-3: this agent’s signing keys, fetched from srv (GET /agentmux/agents/self/keys) rather than only read from .mcp.json (SPEC_AGENT_IDENTITY_CARRIED_NOT_DERIVED_2026_09_23.md §6.5.10).

The env copy goes stale: srv rotates the host jekt key after 24 h, and an agent running longer keeps signing with the key it was launched with, so every jekt it sends fails srv’s check. Fetched at startup and again once the fetched key reaches the expiry srv served with it: srv rotates a key only after that, so until then nothing newer exists, and the fetch that follows it is what rotates it. Checked before every tool call, so a UI automation proof is signed with a live key too.

The fetched name-keyed keys are used only when the slug srv served them for is exactly this process’s AGENTMUX_AGENT_ID: an agent signing under a name its row doesn’t have (a collision-suffixed backfill, a #3573 stub) keeps its env keys, which are the ones filed under the name it signs as. The UID-keyed keys are held for M4d-6’s v2 signatures. Nothing here is logged.

Structs§

Cached 🔒
Wire 🔒

Constants§

FETCH_TIMEOUT 🔒
Short, so a slow srv delays a tool call by this at most.
REFRESH_AFTER 🔒
Re-fetch a copy this old even with no expiry to go by (an older srv).
RETRY_AFTER 🔒

Statics§

CACHE 🔒
LAST_ATTEMPT 🔒
When a fetch was last tried. With no usable copy (an srv without the endpoint, an unreachable one), every tool call would otherwise retry and wait out the request; this spaces the retries.

Functions§

env_key 🔒
jekt_key 🔒
The host jekt HMAC key: the fetched one when it is ours, else the env’s.
lan_key 🔒
The LAN (and cross-channel) private key: fetched when ours, else the env’s.
name_key 🔒
A fetched name-keyed key, decoded, when srv served it for exactly the name this process signs as.
refresh_if_stale 🔒
Fetch the keys if there is no copy yet, or it is older than 20 h. Errors leave the old copy (or none) in place: signing then falls back to the env keys, exactly as before M4d-3.
still_good 🔒
Whether a cached copy needs no re-fetch at now (unix seconds).
uid_signer 🔒
This agent’s UID and its UID-keyed LAN private key, for the v2 signature (identity M4d-6). Only ever the fetched key, never an env one: the v2 signature claims the UID, so it must come from srv’s own record of it.
wan_key 🔒
The WAN private key: fetched when ours, else the env’s.