Repository navigation
Body limit fix, token revocation, header-matched faults, MCP seed hint - #61
Merged
Merged
Conversation
A body within the 32 MiB limit could still fail. Input of many messages (a few hundred thousand) answered 500 "Maximum call stack size exceeded" and recorded no usage, because the token count passed every message as a separate argument. And the count built an array with one element per character, which for a long input could exhaust the instance's memory. - Token counts walk the text without an argument spread or a character array. - Rule matching looks in each text instead of joining them into a second copy. - The body is decoded as it arrives, not held as bytes and text at once. Every shape at exactly 33,554,432 bytes now answers 200 with its usage record: one string, many input messages, many chat messages, many content parts, escaped and raw non-ASCII text.
The "User not found" page and the sign-in footer told the reader to POST
{"github":{"users":[...]}} to /__seed. On the MCP service that key seeds
nothing, and /__seed replaces the whole instance, including the client that
is signing in, so the retry failed either way. The hint now names
POST /_emulate/seed with {"users":[...]}, which adds a user on both the MCP
service and GitHub's MCP surface.
Revoking: POST /_emulate/tokens/revoke { token } revokes one token, after
which requests with it get the provider's own 401 and every other token keeps
working. It covers the shared token map and, through a new
ServicePlugin.revokeToken hook, the tokens X, Zapier, PlanetScale and Miro
keep, OpenAI API keys, and WorkOS API keys and refresh tokens. A revoked token
is refused even where unknown tokens fall back to a default user, and the
revocation is kept with the store, so it survives a hosted unload.
GitHub also gains its own route, DELETE /applications/:client_id/token (Basic
client auth, 204), and answers a token it does not accept with
401 {"message":"Bad credentials"} on REST routes, as api.github.com does,
instead of treating the request as anonymous.
Faults: a fault can also match request headers by exact value
(match.headers, names case-insensitive), so a fault meant for one caller's
Authorization leaves every other caller alone.
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.
Four gaps in the hosted emulators, one commit each (the token and fault changes share a commit with their docs).
1. The OpenAI emulator failed on bodies within its stated 32 MiB limit.
2. Revoking one token.
POST /_emulate/tokens/revokewith{ "token": "..." }. Requests with that token then get the provider's own 401, and every other token keeps working./_emulate/credentialstokens). Through a newServicePlugin.revokeTokenhook, it also covers the tokens X, Zapier, PlanetScale and Miro keep, OpenAI API keys, and WorkOS API keys and refresh tokens.DELETE /applications/:client_id/token(Basic client auth,{ "access_token" }, 204, 404 or 422 as GitHub documents).401 {"message":"Bad credentials"}on REST routes, as api.github.com does, instead of treating the request as anonymous.3. A fault can match a header.
match.headersmatches request headers by exact value, with header names case-insensitive. So a fault meant for one caller'sAuthorizationleaves every other caller alone, and only that caller spends its count.4. The MCP sign-in pages' seed hint. It said to POST
{"github":{"users":[…]}}to/__seed. On the MCP service that key seeds nothing, and/__seedreplaces the whole instance, including the client that is signing in. It now namesPOST /_emulate/seedwith{"users":[…]}, which works on the MCP service and on GitHub's MCP surface.Docs: README, docs pages (control routes, ledger and faults, GitHub) and skills.
Tests: