Skip to content

feat(mcp): envector-go-sdk integration#103

Merged
couragehong merged 4 commits into
CryptoLabInc:feat/go-migrationfrom
esifea:feat/esifea/go-sdk-integration
May 7, 2026
Merged

feat(mcp): envector-go-sdk integration#103
couragehong merged 4 commits into
CryptoLabInc:feat/go-migrationfrom
esifea:feat/esifea/go-sdk-integration

Conversation

@esifea

@esifea esifea commented May 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • What changed: SDK integration added
  • Why:
  • Scope:

Validation

  • Tests run (or explain why not):
  • Docs updated (if behavior/setup changed)

Cross-Agent Invariants

  • scripts/bootstrap-mcp.sh remains the single source of truth for runtime prep (venv/deps/self-heal)
  • No agent-specific script duplicates bootstrap/setup logic
  • Agent-specific scripts remain thin adapters (registration/wiring only)
  • Codex-only commands (codex mcp ...) are clearly separated from cross-agent/common instructions
  • Claude/Gemini/OpenAI instructions do not include Codex-only commands
  • SKILL.md, commands/rune/*.toml, and AGENT_INTEGRATION.md stay consistent on boundaries

Notes for Reviewers

  • Risk areas:
  • Backward compatibility impact:
  • Follow-up work (if any):

@esifea esifea self-assigned this May 6, 2026
@esifea
esifea requested a review from couragehong May 6, 2026 09:13
@esifea
esifea force-pushed the feat/esifea/go-sdk-integration branch from b800b33 to cda52b8 Compare May 6, 2026 16:21
@couragehong

Copy link
Copy Markdown
Contributor

I reviewed this PR and almost of them are good for me. only tiny issues should be handled so I'll merge first and work on it. Thanks for the work!

@couragehong
couragehong merged commit 3935002 into CryptoLabInc:feat/go-migration May 7, 2026
1 check passed
couragehong added a commit that referenced this pull request May 7, 2026
#103 ported errors.go for envector but missed vault. The hand-rolled
grpcStatuser interface in #95's port required Code() to return int, but
real *status.Status.Code() returns codes.Code (uint32). Type assertion
silently fails for every gRPC error and every call lands in the !ok
branch as ErrVaultInternal — hiding the actual code.

Worst case: Unauthenticated (token revoked/expired) gets mis-flagged as
retryable=true, triggering infinite retry on auth failure.

Switch to status.FromError(err) and codes.* constants from
google.golang.org/grpc, mirroring the pattern in envector/errors.go
MapSDKError. Removes the hand-rolled grpcStatus struct + statusFromError
helper + 4-line code constants block.
couragehong added a commit that referenced this pull request May 7, 2026
#103 lowered MaxMessageLength from 256MB to 16MB without justification.
Python (vault_client.py:L33) and spec (vault.md §256MB) both call for
256MB.

Even with EvalKey no longer in the manifest (Vault now owns EvalKey/SecKey
server-side per the GetAgentManifest rename), the manifest_json still
carries EncKey JSON content which can be on the order of MBs depending
on FHE parameters. The 16MB cap risks ResourceExhausted on future
deployments that legitimately need more headroom; 256MB matches Python
and the spec without measurable cost.
couragehong added a commit that referenced this pull request May 7, 2026
#103 added envector unit tests but skipped vault. Adds 13 test functions
/ 18 subtests covering all 4 RPC paths and the error-mapping matrix:
  - GetAgentManifest: happy path, response.error, malformed JSON, bad DEK
    length 16 (must be 32 for AES-256)
  - ParseManifestJSON: silently drops a stray EvalKey.json field if a
    legacy Vault response includes one (forward compat)
  - DecryptScores: happy path with token/blob/top_k assertions
  - DecryptMetadata: happy path pass-through
  - HealthCheck Tier 1: SERVING / NOT_SERVING
  - MapGRPCError: 6 gRPC code → sentinel matrix (Unauthenticated /
    NotFound / Unavailable / DeadlineExceeded / Internal /
    PermissionDenied default), non-gRPC fallback, nil pass-through

Adds NewBufconnClient(*grpc.ClientConn, token) Client constructor
factored through newWithConn so NewClient and NewBufconnClient share
struct init. Useful for tests + production callers that pool conns
externally.

Test runs in ~0.6s with no real Vault dependency.
couragehong added a commit that referenced this pull request May 7, 2026
Documents the three follow-up items this PR addresses (MapGRPCError fix,
MaxMessageLength 256MB restore, bufconn unit tests + NewBufconnClient
injector) against the post-#103 contract (GetAgentManifest, EvalKey
ownership shifted to Vault).

Includes spec-parity matrix, list of acceptable divergences from Python,
and open follow-up items (RUNEVAULT_GRPC_TARGET env override, health
client caching, response.error retryable nuance, MetadataRef type
asymmetry).
couragehong added a commit that referenced this pull request May 7, 2026
 fix(vault): #103 follow-up — MapGRPCError + 256MB + tests
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.

2 participants