Repository navigation
fix(web): prompt links work for encoded thread IDs - #32959
unlockdigital wants to merge 1 commit into
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Prompt links now recognize encoded environment and thread IDs while retaining strict route matching. The change only enables draft placement, with existing replacement confirmation and no automatic prompt submission. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Note Written by Verified in a real dev environmentverified head
before, main: after, exact pr head and matching conversation: command and observed-state transcript. inspected the captures and verified uploaded video playback and seeking in t3's player. Not verifiedpackaged electron link dispatch, native ios/android, macos/windows, relay/tunnel connections, and other providers were not exercised on this linux vm. the changed helper is used by the web client; these checks prove the local web and real codex path. the first pr page load spent several minutes in vite's |



Problem
Opening an existing MCP thread's URL with
?prompt=helloleaves the composer empty and the prompt query in the URL. TanStack Router encodes an ID such asmcp:exampleasmcp%3Aexample, whileisThreadRoutePathnamecompares the pathname with the raw ID, so the prompt effect skips the matching thread.Change
Split the pathname into its two route segments and decode each once before comparing the environment and thread IDs. Extra path segments and malformed escapes return false. The regressions cover real router navigation, encoded slashes, a literal-percent ID, double encoding, and navigation away.
Scope and approval
This is a small, focused fix for an obvious bug under CONTRIBUTING.md: it restores the documented existing-thread prompt-link workflow. The route-ownership guard from #19326 still protects a thread during navigation away. The patch is limited to the helper and its existing test file. #19203 reuses the same helper for message links; this fixes the current prompt path independently.
Verification
apps/web,vp test run --project unit src/threadRoutes.test.ts: the two encoded-route regressions fail against unchanged upstreamade473018d; all 12 tests pass with the fix. The router case asserts both the encoded pathname and its decoded parameters. Failing run, passing run.vp run check:changed ade473018d32003658b7d38693e083ee2e314bd8 --concurrency 2passes formatting, lint, both Knip checks, affected typechecks, the 12 tests, and the React compiler check. Check log.?prompt=hello; after,helloin the composer and the query removed. An existing draft stays intact until Replace draft is clicked. SPA navigation places another thread's linked prompt in that destination and preserves the original draft. Reproduction and URL-state transcript.The captures compare initial upstream
20fcc6cawith that base plus this patch. Updating toade473018dchanges neither the two route files nor the prompt-link consumer; the automated red/green and changed-file checks above were rerun on the updated base.Before
After
Local check setup: upstream's existing office-font alias uses
URL.pathname, which leaves the space in this checkout path as%20and prevents the root test runner from starting. The same startup failure reproduced on unchanged upstream. The passing check used a temporary filesystem alias, removed afterward; repository configuration is unchanged. Baseline startup failure.Packaged desktop link dispatch, native mobile, and relay/tunnel connections were not exercised. The Browser recording endpoint failed, so the client evidence is raw screenshots plus the observed composer/URL states.
Implemented and verified with GPT-6.1 Sol (xhigh) through the Codex harness in T3 Code.