Skip to content

Wire the agent to Command Center's secrets instead of duplicates - #276

Merged
Sbussiso merged 1 commit into
masterfrom
agent-secret-wiring
Sep 9, 2026
Merged

Wire the agent to Command Center's secrets instead of duplicates#276
Sbussiso merged 1 commit into
masterfrom
agent-secret-wiring

Conversation

@Sbussiso

@Sbussiso Sbussiso commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

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 presented OPENSENTRY_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 /start is 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=false so it can't recur.

OLLAMA_API_KEY / OLLAMA_MODEL staged on sentinel-command, moved without their values passing through a terminal.

848 tests pass, ruff clean.

🤖 Generated with Claude Code

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>
@Sbussiso
Sbussiso merged commit 882364f into master Sep 9, 2026
12 checks passed
@Sbussiso
Sbussiso deleted the agent-secret-wiring branch September 9, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant