Relationships
#4758 Let a revoked worker token's name be reused (or delete revoked token records)
Opened by ehazlett · 11/14/2026
Problem
A worker's name is its enrollment token's name, and a token name can never be minted again: swamp worker token revoke leaves the record behind in state revoked, and swamp worker token create <name> then refuses that name for good. There is no command to delete a revoked token record, and swamp worker connect has no option to connect under a name other than the token's.
So a name is used up by any token that never served a worker. A common way to hit this:
swamp worker token create web-01to bootstrap a new machine.- Delivering the token fails before the machine ever connects (a mistyped address, an unreachable host, a failed install).
- The token is revoked, as it should be, rather than left live and unwatched.
swamp worker token create web-01is now refused permanently, and the machine can only join the pool under a different name (web-01-2, …) that does not match its hostname.
A token that was revoked with zero bindings (it never enrolled a worker) has no history worth protecting under that name, yet it blocks the name exactly as a token that served a long-lived worker would.
Proposed solution
Any one of these would solve it:
- Delete a revoked token record:
swamp worker token delete <name>(orrevoke --purge), allowed only once a token is revoked or expired, after which the name can be minted again. - Release names of never-used tokens: let
createreuse the name of a token that isrevokedwithbindingCount: 0, or have the worker GC reap such records. - Decouple the worker name from the token name: e.g.
swamp worker token create <token-name> --worker-name <name>, orswamp worker connect --name <name>, so a fresh token can enroll a machine under its usual name.
Alternatives considered
- Minting under a suffixed name and mapping it back to the hostname in tooling. It works, but the pool, run history, and
worker listthen show a name that does not match the machine, and every consumer has to know the mapping. - Waiting for the revoked record to expire. Its expiry is the token's full original lifetime (months), and it is not documented whether the name becomes reusable then.
- Editing the datastore by hand, which goes around swamp and is not something an operator should do.
Closed
No activity in this phase yet.
ehazlett commented 11/16/2026, 12:11:25 PM
Retested on 20261112.171308.0 and 20261114.210101.0, with tokens created both locally and through swamp serve --auth-mode token (worker token create --server). A worker token revoked before it was ever used, and one revoked after a worker had connected with it, can both be created again under the same name, and a worker connects under that name. The refusal I reported came from a check in my own tooling, not from swamp. Closing as not reproducible.
ehazlett commented 11/16/2026, 12:11:55 PM
Closing per the retest above: not reproducible on current builds.
Sign in to post a ripple.