You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: cleanup sweep revokes a just-minted agent MCP key while the container is still starting #4259
The cleanup sweep revokes an agent's MCP key when the sweep runs between the key being minted and the agent's container becoming live, leaving a healthy agent without platform access.
Context
An agent was created and its MCP key minted; one second later the cleanup cycle logged [Cleanup] Deactivated 1 MCP key(s) belonging to agents that are no longer live (#1745); the container became ready seven seconds after that. The agent's first MCP call failed with 401 (chat_with_agent unavailable), and nothing repairs it afterwards. A second agent created minutes earlier, with no cleanup tick inside its start-up window, kept its key. On an instance that creates agents from a hook (onboarding), this is a coin flip per person.
Acceptance Criteria
A key whose agent row exists and is not soft-deleted is never treated as orphaned, whatever the container state (creating, starting, stopped).
Keys younger than a grace window (e.g. 10 minutes) are skipped by the sweep.
The sweep's log line names the agents whose keys it revoked, so an operator can see what happened.
A regression test creates an agent, runs the sweep during the start-up window, and asserts the key stays active.
Existing instances: a one-off check reactivates keys revoked while their agent row was live, or the release notes say how to find them.
Technical Notes
services.cleanup_service orphaned-key sweep (orphaned_agent_keys_revoked, #1745) versus services.agent_service.crud create path (key created before lifecycle reports the agent ready). Observed on a 1.0.0 dev build, 2026-11-04.
Activity
merge-train: the note quotes the real log line, and the ten-minute gr…
fix(cleanup): the orphaned-key sweep skips a just-minted agent key an…