Repository navigation
CTX7-3712: A/B test the server instructions on the hosted MCP server - #3733
Open
fahreddinozcan wants to merge 5 commits into
Open
fahreddinozcan wants to merge 5 commits into
fahreddinozcan wants to merge 5 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
…e app can recompute arms
…the unit and share to the API
enesgules
approved these changes
Nov 10, 2026
enesgules
left a comment
Collaborator
There was a problem hiding this comment.
Approved. The test is off by default and stdio gets an empty env. The arm comes from a salted hash of a stable identity, so a stateless server gives the same arm on each request. req.ip is correct here because trust proxy is set. The list cache hints are private while the test runs, so one arm cannot get the cached tool list of the other. Client labels on the new counter are capped at 50.
Notes, none is a blocker:
- Set
CONTEXT7_INSTRUCTIONS_EXPERIMENT_SALTin production. The default salt is in this public repository, so for anonymous callers theX-Context7-Instructions-Unitvalue is a hash of the IP that can be computed again by anyone who has the salt. The header goes only to our API, which already gets the IP, so the risk is small. - The control arm changes two things together (old text and no
alwaysLoad). The result shows the effect of #3665 as a whole, not of each part. That agrees with the goal in the description. - A caller that moves from anonymous to an API key can change arm. The admin page (upstash/context7app#1682) must count by unit, not by user.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an off-by-default A/B test of the server instructions to the hosted MCP server, so #3665's text can be measured in production.
CONTEXT7_INSTRUCTIONS_CONTROL_PERCENT(0-100) sends that share of callers the previous instructions withoutalwaysLoad; the rest get CTX7-3596: Make the MCP server instructions direct so agents call Context7 more often #3665's text withalwaysLoad. 0 (default) is off; stdio is never part of it.lib/instructions-experiment.tsowns the test behind one object (assign,sessionConfig,observeRequest);index.tscalls it once in the HTTP middleware and once increateMcpServer.sha256("<salt>:<identity>")mod 100. Identity iskey:<sha256 hex of the ctx7sk key>(the hash context7app stores),user:<JWT sub>,token:<hash>, orip:<client IP>.tools/listandserver/discoveruse the private cache hint. API calls sendX-Context7-Instructions-Variant,-Unit(salted caller hash, the randomization unit) and-Control-Percent, for the admin page in context7app (CTX7-3724).context7.mcp.instructions_experiment.instruction_requestsby arm and client; tool calls carrycontext7.mcp.instructions.variantonmcp.server.operation.duration(all tools, research preview included).Stacked on #3665. Closes CTX7-3712