Note
Grok responding on behalf of Julius.
Thanks, confirmed on main (3143335). This is a docs-only mismatch: the relay keeps held webhooks per managed link (endpoint key), not per environment.
What the doc says (docs/internals/t3-connect.md#L13-L30):
- L16-17: the relay stores the request "in a Durable Object for that environment".
- L20-21: requests are deleted "once the environment answers, after 24 hours, or when no user has the environment linked".
- L28-30: held requests "need per-environment order, caps, and retry timing".
What the code does:
- Inbox is keyed by endpoint key:
worker.ts#L248-L252opens everyhold,wakeandclearcall withhookInboxes.getByName(endpointKey).HookInbox.ts#L17-L21says "Each managed endpoint's requests live in its ownHookInboxObject, named by endpoint key", andHookInboxObject.ts#L27says "One per managed endpoint, addressed by endpoint key." - One endpoint key per link: the key is the hash suffix of the managed tunnel name. That hash is SHA-256 of
${stage}:${userId}:${environmentId}(ManagedEndpointProvider.ts#L998-L1022,deploymentConfig.ts#L88-L94).deploymentConfig.ts#L128-L132says "one key names exactly one link, unlike the environment id, which any account can claim." - Unlink clears only that link's inbox:
Api.ts#L539-L558says "Requests held for this link's endpoint go with it", then callsinbox.clear({ endpointKey })for the unlinked link's tunnel. The clear is best effort; on failure it logs a warning. - Turning holding off clears what's already held: in
HeldHooks.ts#L118-L126,setHoldWhileOfflinecallsinbox.clear({ endpointKey })for each of the caller's own endpoint keys whenholdWebhooksWhileOfflineis false. Per#L95-L98, those are the "endpoint keys of the managed links the calling environment key proved". The current doc doesn't mention this.
Suggested doc changes (L16-30):
- L16-17: store the request "in a Durable Object for that link's managed endpoint (named by its endpoint key)".
- L20-21: requests are deleted "once the environment answers, after 24 hours, when that link is unlinked, or when the environment turns
hold_webhooks_while_offlineoff". - L28-30: "per-endpoint (per-link) order, caps, and retry timing" and "hold one endpoint's requests back".
Optional comment cleanup: some comments use the same per-environment wording: HookInboxStore.ts#L11-L21 ("one environment's held webhook requests", "the environment's HookInboxObject", and the per-environment caps) and HookInbox.ts#L25 ("the environment's inbox").
Only docs and comments are affected; no runtime change is needed. #16988 covers the wrong :environmentId path segment on L8 of the same doc, so both fixes could land in one docs PR.