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
Per-org agent instances so one tenant never waits for another (follow-up to #63) #195
#63 (PR #188) made per-org credentials safe under concurrency. Each org's keys live in a context-local view of os.environ, and an OrgGate stops one org's cached clients (GitHub, cloud SDKs, the LLM client) from being swapped while another org is using the single sharedDevOpsAgent.
The cost: work for org B waits while org A's scope is open. A Slack approval or MCP call for one tenant can wait for minutes behind another tenant's incident. org_scope_waiting is logged when this happens.
The agent also stores per-run settings on itself (self.auto_apply, self.model are set at the start of every run()/execute_tool()). That's only safe because of the gate.
Proposed solution
Keep one DevOpsAgent (and EscalationService) per credential fingerprint: a hash of the org's resolved credentials, so orgs without their own keys share the platform instance. Use an LRU cache (e.g. 32 entries), build each instance inside the org's credential scope, and rebuild it when the fingerprint changes (a key was rotated, see [SECURITY] Credential lifecycle: validation, rotation audit trail, and secure deletion #62).
Route the queue worker, /slack/action, the MCP handlers and execute_approved_action to the org's instance. Once nothing shares an instance across orgs, remove the gate.
Pass auto_apply and model per run instead of mutating the agent.
Tests: two orgs' long-running scopes overlap without waiting; rotating a key yields a fresh instance; memory stays bounded.
Activity