The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
Revert "fix(desktop): a send honors the live route, not the render-time copy"
teknium16c609346e7a3
diff --git a/apps/desktop/src/app/contrib/wiring.tsx b/apps/desktop/src/app/contrib/wiring.tsxindex 8350c46e1cd..ba05caff1c9 100644--- a/apps/desktop/src/app/contrib/wiring.tsx+++ b/apps/desktop/src/app/contrib/wiring.tsx@@ -87,7 +87,6 @@ import {setBusy,setMessages} from '@/store/session'-import { liveRoutedSessionId } from '@/store/session-states'import { $archivedSessions } from '@/store/sidebar-archive'import { $titlebarAppActionsSide, titlebarAppActionsClusterCounts } from '@/store/titlebar-app-actions'import { armWakeWord, stopClientCapture } from '@/store/wake-word'@@ -302,7 +301,7 @@ export function ContribWiring({ children }: { children: ReactNode }) {routeTokenRef.current = routeTokenconst getRouteToken = useCallback(() => routeTokenRef.current, [])- const getRoutedStoredSessionId = useCallback(() => liveRoutedSessionId(routedSessionIdRef.current), [])+ const getRoutedStoredSessionId = useCallback(() => routedSessionIdRef.current, [])const clearRoutedSessionIntent = useCallback(() => {routedSessionIdRef.current = nulldiff --git a/apps/desktop/src/store/session-states-live-route.test.ts b/apps/desktop/src/store/session-states-live-route.test.tsdeleted file mode 100644index 74c9d7ef979..00000000000--- a/apps/desktop/src/store/session-states-live-route.test.ts+++ /dev/null@@ -1,31 +0,0 @@-import { afterEach, describe, expect, it } from 'vitest'--import { liveRoutedSessionId } from './session-states'--// Branch → immediate Enter: navigate() had already rewritten location.hash to-// the branch, but the render-time route copy still named the parent, so the-// send's route/selection guard saw nothing to reconcile and U5 landed in the-// parent (lineage-sidebar.spec.ts "U5 landed in a NEW session", ~1 in 28 runs-// on a 2-core box). The send must honor the live hash over the stale copy.-describe('liveRoutedSessionId', () => {- afterEach(() => {- window.history.replaceState(null, '', window.location.pathname)- })-- it('prefers the live hash route over a stale render-time copy', () => {- window.location.hash = '#/local-branch'-- expect(liveRoutedSessionId('local-parent')).toBe('local-branch')- })-- it('treats a new-chat hash as authoritative even when the copy still names a session', () => {- window.location.hash = '#/'-- expect(liveRoutedSessionId('local-parent')).toBeNull()- })-- it('falls back to the render-time copy when there is no hash at all', () => {- expect(window.location.hash).toBe('')- expect(liveRoutedSessionId('local-parent')).toBe('local-parent')- })-})diff --git a/apps/desktop/src/store/session-states.ts b/apps/desktop/src/store/session-states.tsindex a1c35d93645..0bd969c6fd2 100644--- a/apps/desktop/src/store/session-states.ts+++ b/apps/desktop/src/store/session-states.ts@@ -539,17 +539,6 @@ function windowRouteSessionId(): string | null {return routeSessionId(window.location.hash.replace(/^#/, ''))}-/** The routed stored session a send should honor RIGHT NOW. navigate()- * rewrites location.hash synchronously, but a render-time copy of the route- * only catches up on the next render; a send inside that gap (branch, then- * an immediate Enter on a slow machine) would trust the stale copy and- * deliver into the previous chat. Any hash is authoritative (including a- * new-chat hash, which names no session); with no hash at all (unit tests,- * first paint) the render-time copy is all there is. */-export function liveRoutedSessionId(renderTimeRoute: string | null): string | null {- return typeof window !== 'undefined' && window.location.hash ? windowRouteSessionId() : renderTimeRoute-}-/** Whether the user is still focused on a session that belongs to the same* durable lineage as the given stored id. Used to decide whether a* backgrounded session's delayed id-rotation may follow the route/selection