Skip to content
This repository was archived by the owner on Aug 10, 2026. It is now read-only.
This repository was archived by the owner on Aug 10, 2026. It is now read-only.

agent-grants: grant rows orphaned when an #agent/definition note is deleted #96

Description

@unforced

Found during 4b-2 cleanup.

When an agent's #agent/definition note is deleted (or its wants: shrinks), the agent module deregisters the agent but the corresponding rows in the hub's agent-grants.json persist forever (status stays pending/approved). Observed: a deleted grant-test def left a grant-test-vault-techne-read pending row behind.

Harmless for a pending row, but an approved row keeps a live minted token (vault) or stored secret (service/mcp) for an agent that no longer exists — a credential-hygiene gap.

Fix sketch: when the agent module removes a def (or a wants: entry disappears on reload), call a hub grant-delete for the now-absent connection keys. Needs a DELETE /admin/grants/<id> (module-auth) endpoint on the hub side (today there's only operator-gated revoke); deletion should also drop the minted token from the registry. Alternatively a periodic reconcile (module lists its live defs' wanted keys, hub prunes grants not in that set per agent).

Relates to the 4a/4b lifecycle. Cross-repo (hub endpoint + agent reconcile).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions