What happens#
When an environment is reached through the T3 Connect relay, opening a subagent (delegated-task) thread fails with 401. The server logs ServerAuthInvalidCredentialError with environment.dpop.failure_code: url_mismatch. Ordinary threads with UUID IDs load normally.
Observed on 0.0.46-nightly.20261003.2632, with a Mac browser connected to a Linux server through *.t3coderelay.com. All 28 relay GET /api/orchestration/threads/:threadId/bounded requests for delegated-task thread IDs returned 401, for example:
https://prod-….t3coderelay.com/api/orchestration/threads/thread%3Adelegated-task%3Acommand%253Amcp%253A<uuid>%253Adelegate-task%253A<request-id>/bounded
Cause#
The client signs a different URL from the one it requests:
packages/client-runtime/src/state/boundedThreadSnapshotHttp.ts:38 builds the URL that gets signed by interpolating the raw ID: `/api/orchestration/threads/${input.threadId}/bounded`.
- The request itself,
client.threadBoundedSnapshot({ params: { threadId } }), percent-encodes the path parameter.
For a UUID the two strings are identical. A delegated-task ID such as thread:delegated-task:command%3Amcp%3A… contains : and %. In the signed URL, new URL() leaves : and the existing %3A alone. On the wire the path carries thread%3A…command%253Amcp…. normalizeDpopHtu on the server then compares two different strings, and verification fails with url_mismatch.
The same pattern appears in threadSnapshotHttp.ts:69 and threadHistoryHttp.ts:31.
Suggested fix#
Encode the ID in the signed URL the same way the request path is encoded, for example `/api/orchestration/threads/${encodeURIComponent(input.threadId)}/bounded`. Apply it at all three call sites. A better fix is to derive the signed URL from the request the HTTP client actually builds, so the two can't diverge again.
How to reproduce#
- Connect to an environment through the T3 Connect relay.
- In a thread, run
delegate_task so a subagent child thread exists.
- Open the child thread. The bounded snapshot request returns 401
url_mismatch. Opening a normal thread works.
Note
Grok responding on behalf of Julius.
Triage#
Thanks for tracking this down so precisely, @itsjeremyjohnson! The example URL and the call-site pointers made it quick to confirm.
What I found#
Confirmed on
main(4ee6bfd50e).Why the URLs don't match
The DPoP proof URL and the request URL are built separately.
fetchEnvironmentBoundedThreadSnapshot,fetchEnvironmentThreadSnapshot, andfetchEnvironmentThreadHistoryPageput the raw thread id into the path given toenvironmentEndpointUrl. Assigning it toURL.pathnameleaves:and any existing%3Auntouched.HttpApiClientpath compiler) sendsencodeURIComponent(threadId).verifyDpopProofcompares the two after stripping only the query and fragment, so any thread id containing:or%fails withurl_mismatch.Who's affected
thread:<uuid>fromIdAllocatorV2and provider child threads (thread:provider:…) can hit this too, not only delegated-task threads.What happens on a failure
environmentHttpAuth.test.tsonly usesthread-v2, which has no reserved characters, so tests stay green.Likely fix area#
Some options:
encodeURIComponentin the three signed paths so they match what the client requests.makeEnvironmentHttpApiUrlBuilder, the same builder the request uses, so the two can't drift apart again.:and%.A maintainer will decide on the fix direction.