← Back to Pull requests

fix: three bug fixes for MCP tools and background embedding generation #219

Closed
unknown closed this pull request without merging on Mar 28, 2026 10:40 UTC
View on GitHub
unknown unknown commented on Feb 25, 2026 21:17 UTC
Author

/kind fix

Description

Three bug fixes found while integrating AgentRegistry into a production Kubernetes platform.

1. auth.WithSystemContext for background embedding goroutines — bare context.Background() lacks the system auth session, causing embedding updates to fail silently. Matches the pattern already used in embeddings_sse.go and embeddings.go.

2. Nil Config map initialization — get_deployment and list_deployments MCP tools return null for Config when the map is nil, breaking downstream JSON consumers. Also adds case-insensitive resource_type filtering.

3. Default port 3000 for stdio transport — the kagent translator leaves Deployment.Port at 0 for stdio servers, which is invalid. Defaults to 3000 to match the KMCP CLI.

Fixes #217

Changes

| File | Change |
|------|--------|
| internal/registry/service/registry_service.go | context.Background() → auth.WithSystemContext(context.Background()) in 2 goroutines |
| internal/mcp/registryserver/server.go | Init nil Config maps, strings.EqualFold for resource type filter |
| internal/runtime/translation/kagent/kagent_translator.go | Default port 3000 for stdio transport |

Test plan

  • Publish a server with EMBEDDINGS_ENABLED=true → verify embedding column is populated (not NULL)

  • Call get_deployment for a deployment with no config → verify Config is {} not null

  • Call list_deployments with resource_type=server (lowercase) → verify results returned

  • Deploy a stdio MCP server via kagent translator → verify port is 3000
  • ``release-note
    Fix background embedding generation silently failing due to missing auth context, nil Config map in deployment MCP tool responses, and missing default port for stdio transport in kagent translator.
    ``

    Diff: 229 lines (+171 / -58) across 2 files Reviewer: inFocus7 Review duration: 44002m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 229 lines diff across 2 files
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.325
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #219"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 37.0% (MEDIUM) · Higher = larger blast radius
    37.0%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 14.6% · Safe to merge
    14.6%