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 start file holds no signing value, so these fetched keys are the keys. The name-keyed ones are used only when the slug srv served them for is exactly this process’s AGENTMUX_AGENT_ID (a spawn writes the definition’s slug there, so the two agree; an agent that still signs under a name its row doesn’t have signs with the env keys of a file an older version wrote, if any). 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).
REJECTED_SIGNATURE 🔒
The answer srv gives a request whose identity signature does not verify: the key this process holds is not the one srv has (it was replaced while this process ran).
RETRY_AFTER 🔒

Statics§

CACHE 🔒
FETCH 🔒
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 🔒
fetch_in_progress 🔒
Whether the keys are still on their way: a fetch was tried a moment ago and nothing is held yet. The first signed call of a process made by hand lands in this window (the fetch runs beside startup), and its answer should say to try again, not that the agent needs a respawn (#47532).
fetch_pending 🔒
fetch_in_progress on its inputs: whether a copy is held, and how long ago the last fetch was started.
forget_fetched 🔒
Drop the held copy and the retry gate, so the next refresh_if_stale asks srv again at once.
in_container 🔒
Whether this process runs in a container agent’s container, by the hint srv puts in its environment. Only a hint for this client (srv never reads it): it makes the MCP skip signing material it holds none of, and srv attributes the request by the container’s token.
is_container_hint 🔒
is_rejected_signature 🔒
Whether a tool’s error is srv rejecting this agent’s signature.
jekt_key 🔒
The host jekt HMAC key: the fetched one when it is ours, else the env’s (set only by a file an older version wrote).
lan_key 🔒
The LAN (and cross-channel) private key: fetched when ours, else the env’s (set only by a file an older version wrote).
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 five minutes (a key replaced while this process ran is picked up then; srv serves the same one until it is replaced). Errors leave the old copy (or none) in place: signing then falls back to the env keys, exactly as before M4d-3.
run_healing_a_rejected_signature 🔒
run, and once more after srv rejects its signature: the key held is not the one srv has (it was replaced while this process ran), so the keys are asked for again first. A rejected call did nothing, so repeating it is safe.
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.