Wire the agent to Command Center's secrets instead of duplicates - #276
Merged
Conversation
Two problems the first deploy of the agent process group exposed. 1. The agent would have failed every tool call. Command Center's MCP server authenticates the agent against SENTINEL_AGENT_MCP_KEY, while the agent presented OPENSENTRY_MCP_AGENT_KEY. Different names, and the first-party deployment deliberately uses two DIFFERENT shared secrets for the run-queue and the MCP surface. So with no explicit value set, the existing self-hosted fallback would have handed the MCP surface the run-queue key — an agent that fetches work and then fails every tool call, which is precisely the failure that fallback exists to prevent for self-hosters. Now that the agent runs in the sentinel-command app it shares that app's environment, so it reads Command Center's own variable via an AliasChoices: OPENSENTRY_MCP_AGENT_KEY first, then SENTINEL_AGENT_MCP_KEY, then the self-hosted fallback. No duplicated secret. Precedence verified in all three directions, including that the self-hosted path still resolves to the agent key. 2. Fly provisioned TWO agent machines. That is its default for a newly-declared process group, and for this group it is actively wrong: two workers drain the same queue, and POST /start is idempotent rather than exclusive, so both would claim the same run and we would pay for the LLM call twice. Scaled back to one, and the deploy now passes --ha=false so it cannot recur. OLLAMA_API_KEY and OLLAMA_MODEL are staged on sentinel-command, moved from the old app without their values passing through a terminal. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #274, from what the first agent-group deploy actually exposed.
The agent would have failed every tool call. Command Center's MCP server checks
SENTINEL_AGENT_MCP_KEY; the agent presentedOPENSENTRY_MCP_AGENT_KEY. The first-party deployment uses two genuinely different secrets for the run-queue and MCP surfaces, so with neither set the existing self-hosted fallback would have handed the MCP surface the run-queue key — an agent that fetches work then fails every tool call, exactly the failure that fallback was written to prevent.Since the agent now shares the app's environment, it reads CC's own variable through
AliasChoices. No duplicated secret. Precedence verified three ways, including that the self-hosted fallback still resolves correctly.Fly provisioned two agent machines — its default for a new process group, and wrong here: two workers drain one queue and
POST /startis idempotent rather than exclusive, so both claim the same run and the LLM call gets paid for twice. Scaled to one; deploy now passes--ha=falseso it can't recur.OLLAMA_API_KEY/OLLAMA_MODELstaged onsentinel-command, moved without their values passing through a terminal.848 tests pass, ruff clean.
🤖 Generated with Claude Code