From 43a670f095b342aa4a41e9300deffa343e6f9029 Mon Sep 17 00:00:00 2001 From: zeroaltitude Date: Sat, 28 Feb 2026 22:22:13 -0700 Subject: [PATCH] fix(browser): preserve handler-supplied URLs and Chrome tab titles Address two review findings on the browser URL enrichment: 1. withRouteTabContext now only fills in url when the handler didn't already set one (record.url === undefined). This prevents clobbering post-navigation URLs returned by /navigate and similar handlers. 2. Chrome extension tabs.onUpdated listener now falls back to chrome.tabs.get() for the current title when changeInfo.title is undefined (URL-only changes), preventing relay cache title wipes. --- src/browser/routes/agent.shared.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/browser/routes/agent.shared.ts b/src/browser/routes/agent.shared.ts index 97d77f1dbb9..abf2b566c60 100644 --- a/src/browser/routes/agent.shared.ts +++ b/src/browser/routes/agent.shared.ts @@ -150,9 +150,10 @@ export async function withRouteTabContext( if (record.targetId === undefined) { record.targetId = tab.targetId; } - if (resolvedUrl) { - // Always override url with live value — the route may have used a - // stale tab.url from the relay cache. + if (record.url === undefined && resolvedUrl) { + // Only fill in url when the handler didn't already set one. + // Handlers like /navigate return the post-navigation URL which + // should not be clobbered with the pre-run tab URL. record.url = resolvedUrl; } }