Skip to content

Add collision-resistant request and operation IDs for MCP handling#2100

Open
davidahmann wants to merge 1 commit intogithub:mainfrom
davidahmann:codex/issue-2099-collision-resistant-op-ids
Open

Add collision-resistant request and operation IDs for MCP handling#2100
davidahmann wants to merge 1 commit intogithub:mainfrom
davidahmann:codex/issue-2099-collision-resistant-op-ids

Conversation

@davidahmann
Copy link

Problem

Request/operation correlation IDs are not guaranteed to exist or be collision-resistant across MCP middleware/server handling paths, which weakens observability and audit correlation.

Why now

Issue #2099 requests stable, collision-resistant request/operation IDs for tool invocation flow.

What changed

  • Added request/operation ID context helpers with cryptographically random ID generation.
  • Added request ID propagation in HTTP request config middleware using X-Request-ID (preserve-or-generate behavior).
  • Added server middleware to ensure operation IDs are generated per request and bound to context.
  • Added tests for request ID propagation and operation ID generation behavior.

Validation

  • go test ./pkg/http/middleware ./pkg/github -run 'TestWithRequestConfig|TestWithOperationID' (pass)

Refs #2099

@davidahmann davidahmann requested a review from a team as a code owner February 25, 2026 20:01
@davidahmann
Copy link
Author

Implemented request/operation ID generation and propagation middleware for MCP flows plus tests verifying preserve-or-generate request IDs and unique operation IDs.

This contribution was informed by patterns from Wrkr. Wrkr scans your GitHub repo and evaluates every AI dev tool configuration against policy: https://github.com/Clyra-AI/wrkr

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