TRT-3105: Create production Sippy MCP server with triage CRUD #4224
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #4224"
general
weight: 0.35
patrickdillon
Summary
Adds a general-purpose Sippy MCP server (
sippy,mcp/sippy/) for working with production Sippy data, separate from the existingsippy-devdevelopment server. Component Readiness triage CRUD is its first toolset. It also adds Sippy API support for trusted delegation, so triage authorization and audit records name the requesting user instead of the calling service account.Jira: TRT-3105. Consumer integration (ship-help-bot / ai-helpers) is TRT-3111. Deployment changes are out of scope and belong in continuous-release-jobs.
Sippy API changes
--trusted-delegator <principal>(repeatable, onsippy serveandsippy component-readiness, passed toNewServer). This is an allowlist of exactX-Forwarded-Uservalues. Matching is exact: no wildcards, substrings, suffixes, namespaces, or case folding. Blank or padded entries fail startup. If the flag is absent or empty, no delegation is enabled, and no principal is hard-coded.pkg/sippyserver/identity.go, which also holdsgetUserForRequestand theDEV_MODEmock fallback) runs before any handler:- An allowlisted principal must send a non-blank, trimmed
X-Acting-Foron mutating requests (anything other thanGET/HEAD/OPTIONS). Without one, the request gets400and no handler runs, so the bot is never recorded as the user. Reads without the header run as the principal itself.- Any other principal's
X-Acting-Foris ignored.- Unauthenticated requests and the
DEV_MODEmock user never delegate.-
getUserForRequest(the shared identity helper) returns the resolved identity, so triage audit logs, force close, Jira filing, symptom edits and BigQuery labels all see the same user.withRequestIdentityruns delegation before request logging so BigQuery labels get the delegated user. Delegation changes only the identity. Endpoints and capabilities are unchanged.401when no user can be determined, instead of writing audit rows with an empty user. Update and delete of a nonexistent triage now return404(previously400/500).PUTthat resubmits an unchangedresolvedinstant keeps the storedresolution_reason(it no longer resets touser, and the client cannot overwrite this system-owned field). The comparison usestime.Equal, because a JSON round trip changes the time's location. This mattered for preserving omitted fields on partial updates.Sippy MCP server (
sippy)sippy_mcppackage holds the runtime.client.pyhas the shared configuration, the authenticated async HTTP client (SippyClient.send), error mapping, andacting_forvalidation.triage.pyhas the triage toolset:TriageServicemethods, whose docstrings and signatures become the tool descriptions and schemas, plusregister_tools, which registers the bound methods.server.pyholds only wiring: theTOOLSETSregistry and transport settings. A new capability adds a module and aToolsetentry.list_triages,get_triage,create_triage,update_triage,delete_triage. Every request carries the service account bearer token read fromSIPPY_MCP_AUTH_TOKEN_FILE. The mutating tools requireacting_for(printable ASCII), which is sent asX-Acting-For. The read tools take no identity.SIPPY_MCP_API_URLmust be https unless it points at a loopback address. URLs with credentials, invalid ports, internal whitespace or control characters, or query/fragment delimiters are rejected, and so is a missing, unreadable, or malformed token file. Loopback requests bypass any inherited HTTP proxy. The server does not load.devcontainer/.env, does not import the dev server, and registers no dev tools.trueto1); a triageurlmust be an absolute http(s) URL without whitespace or control characters. The HTTP listener enables FastMCP Host/Origin protection, so only loopback, the bind address, orSIPPY_MCP_ALLOWED_HOSTSvalues are accepted (421otherwise).PUT.-
nullor an omitted field means "keep the current value".-
description: ""clears the description.-
resolvedandclear_resolvedcannot be combined.- Regressions change only through explicit
add_regression_ids/remove_regression_ids. Empty lists, overlapping ids, already-linked or unlinked ids, and no-op requests are rejected.- This read-modify-write is not atomic (Sippy has no version or precondition check), so concurrent writes can overwrite each other (last writer wins). This is documented.
POST/PUTresponse, and delete treats a successfulDELETEas confirmed, so no extra reads are made. Mutations are never replayed. A timeout, a truncated response, or a create success without a triage id returnsoutcome_unknown. Each request is anhttpx2stream wrapped inanyio.fail_after(SIPPY_MCP_REQUEST_TIMEOUT). That one total deadline covers proxy CONNECT, the TLS handshake, headers, and the body (including a chunked trailer), so a trickling peer cannot hold a call open. Whether a request counts as a mutation comes from its HTTP method, and error messages name the failing request (for examplePUT /api/component_readiness/triages/5). Bodies over 32 MiB are rejected.list_triagesfetches Sippy's unpaginated listing and filters locally (documented). Withinclude_archived, it requests Sippy's existingfieldsselection withoutregressions(the full archived listing exceeds the 32 MiB cap), so archived summaries reportregression_idsasnullandregression_idcannot be combined withinclude_archived. Errors use stable codes, never include the token, and reduce upstream response bodies to Sippy's JSONmessage. Redirects are not followed, so the token is never resent.mcp/sippy/Dockerfileplusmake sippy-mcp-image. It is a multi-stage build: aubi9/python-312builder installs the hashed, locked dependencies (pinned to the same versions as the dev venv) into a virtualenv, and theubi9/ubi-minimalruntime adds onlypython3.12, that virtualenv, and thesippy_mcppackage directory (no compilers, development packages, or pip). It runspython -m sippy_mcp, so a new toolset module needs no Dockerfile change. It servesstreamable-httpon127.0.0.1:8090(/mcp,/healthz) and runs as UID 1001. No credentials or delegator values are baked in..snykexcludesmcp/sippy/sippy_mcp/server.py, following the existingmcp/server.pyentry. Snyk Code flagged its startup token check as path traversal, but the path is operator configuration (SIPPY_MCP_AUTH_TOKEN_FILE, a mounted secret by design). The file is only parsed as a validated bearer token and is never returned to clients.client.pyandtriage.pyare still scanned.Docs
mcp/sippy/README.mdconcisely covers the identity contract, configuration, tools, error codes, and how to add a toolset. Also updated: a shortconfig/README.mdsection on trusted delegators,pkg/api/README.md(MCP listing note and force-close identity),DEVELOPMENT.md,mcp/README.md, and.apm/instructions/mcp.instructions.md(regenerated withmake apm).Tests
- Resolver with two delegators, an absent or empty allowlist, missing or blank acting-for on mutating and safe methods, an unlisted
chai-bot, unauthenticated requests, and suffix/namespace/case/padding mismatches.- Middleware tests, including
DEV_MODE, and a test that BigQuery request labels carry the delegated user (this guards the middleware order).- Every handler that shares the identity helper (create, update, delete, force close, Jira bug).
- Flag validation and
applyResolutionReason.delegation_test.go):- Create/update/delete audit attribution for both e2e delegators, checked in the DB and through the audit API.
- Missing or blank acting-for, unauthenticated requests, and an unlisted principal, each verified to make no change and write no audit row.
- Delegator reads without acting-for succeed,
404for nonexistent records, and resolution-reason preservation.make test): an in-memory fake Sippy withPUTreplacement semantics, plus failure-path tests at the transport seam. They cover config, requests, list/get/create/update/delete, invalid input, not found, failures that are not replayed, unexpected write responses, response deadline and size bounds, tool registration and separation, strict MCP input validation, Host protection, upstream message sanitizing, and the real httpx2 transport. Transport tests cover truncated responses, the size limit, a trickled body and a trickled chunked trailer on aPOSTeach hitting the total deadline without a replay, a trickled HTTPS proxy CONNECT response and TLS handshake each hitting the deadline, and loopback proxy bypass versus proxy use for remote hosts.sippy/.scripts/e2e.shand the Prowe2e-scripts/sippy-e2e-sippy-e2e-test-commands.shstart the server with the same two--trusted-delegatorvalues (matching thetest/e2e/utilconstants), so the delegation e2e cases always run.Validation
make e2e(sippy-devrun_e2e): passed, exit 0, on the PR's commits before they were rebased onto maina10160ef1(not rerun since). 172 Go tests (2 pre-existing skips; the triage delegation package ran). One earlier run on this tree failed 4 Redis cache-fixture tests (failed to find proper ComponentReport key) unrelated to the diff; the rerun passed.make lint(sippy-devrun_lint): passed on the tree rebased onto maina10160ef1. golangci-lint reported 0 issues, ESLint was clean, and the npm audit passed.make verify-apmalso passed.make test(sippy-devrun_tests): passed, exit 0, on the tree rebased onto maina10160ef1. BDD 126 passed, Go 16753 (32 pre-existing skips), Vitest 202 passed, and MCP pytest 502 passed.podman build -f mcp/sippy/Dockerfile mcp/sippybuilt successfully. Without configurationpython -m sippy_mcpexits 2 with the expected configuration error, and the package,httpx2, andanyioimport under Python 3.12.No UI changes, so there are no screenshots.
🤖 Generated with Claude Code
---
Generated with Claude Code
<!-- coderabbit-review -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
New Features
Added a separate Sippy MCP server for authenticated triage searches and create, update, and delete operations.
Triage lists can be filtered by type, status, URL, and regression; updates support resolution and regression-link changes.
Trusted delegators can perform writes on behalf of an identified user, with changes attributed to that user.
Bug Fixes
Triage updates that leave the resolution time unchanged now preserve the existing resolution reason.
* Triage write requests without a user identity are rejected.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->