@@ -37,7 +37,7 @@ import { usePulse } from "../pulse"
3737import { MailRow } from "../components/mail-row"
3838import { MailSubscriptions } from "../components/mail-subscriptions"
3939import { mailCauses , mailLocation , mailRows , mailSourceID } from "../mail-timeline"
40- import { handoffChain , handoffNext , successorFor } from "../handoffs"
40+ import { handoffChain , handoffNext , pendingHandoffFor , successorFor } from "../handoffs"
4141import { ComposerImages } from "../components/composer-images"
4242import { ActivityBriefView } from "../components/activity-brief"
4343import { FindExcerpt , TranscriptFind } from "../components/transcript-find"
@@ -157,7 +157,8 @@ export function SessionView(props: { sessionID: string; directory: string; embed
157157 let inspecting = false
158158
159159 const { activity, sessionsError, editspaces, mailRevision, editspace, state, handoffs, handoffsError,
160- laneOwners, lineage, lineageOwners, refetch, refetchHandoffs, transferPin } = useDashboard ( )
160+ laneOwners, lineage, lineageOwners, pendingHandoffs, refetch, refetchHandoffs, transferPin } = useDashboard ( )
161+ const pendingTransfer = ( ) => pendingHandoffFor ( sessionID , pendingHandoffs ( ) )
161162 const currentEditspace = ( ) => editspace ( ) ?? editspaces ( ) ?. default ?? state ( ) ?. editspace
162163 const ownedLane = ( ) => laneOwners ( ) . find ( ( lane ) => lane . owner === sessionID )
163164 const predecessor = ( ) => {
@@ -885,6 +886,7 @@ export function SessionView(props: { sessionID: string; directory: string; embed
885886 }
886887 }
887888 const recoveryTarget = ( ) => {
889+ if ( pendingTransfer ( ) ) return
888890 const tip = successor ( )
889891 if ( tip ) return tip . successor
890892 // A tagged rejection can supply a missing edge, but cannot override a
@@ -1503,6 +1505,17 @@ export function SessionView(props: { sessionID: string; directory: string; embed
15031505 < Show when = { predecessor ( ) } > { ( edge ) => < div class = "banner handoff-history" aria-label = "Previous session" >
15041506 Previous session: < A href = { sessionHref ( edge ( ) . predecessor , activity . session ( edge ( ) . predecessor ) ?. directory ) } > < bdi dir = "auto" > { activity . session ( edge ( ) . predecessor ) ?. title ?? edge ( ) . predecessor } </ bdi > </ A >
15051507 { " · " } < bdi dir = "ltr" > { edge ( ) . predecessor } </ bdi >
1508+ < Show when = { edge ( ) . reason } > { ( reason ) => < > · < bdi dir = "auto" > { reason ( ) } </ bdi > </ > } </ Show >
1509+ < Show when = { edge ( ) . kickoff === "skipped" && edge ( ) . context } > { ( context ) => < >
1510+ { " · " } Handoff brief not sent because this session was already in use: < bdi dir = "ltr" > { context ( ) } </ bdi >
1511+ </ > } </ Show >
1512+ </ div > } </ Show >
1513+ < Show when = { pendingTransfer ( ) } > { ( transfer ) => < div class = "banner handoff-progress" role = "status" aria-label = "Handoff progress" >
1514+ { transfer ( ) . error ? "Handoff paused. Your draft is saved." : transfer ( ) . successor === sessionID
1515+ ? "Loading handoff context. This session is not ready yet."
1516+ : transfer ( ) . status === "submitting" ? "Starting the next session. Your draft is saved here."
1517+ : "Preparing the next session. Your draft is saved here." }
1518+ < Show when = { transfer ( ) . reason } > { ( reason ) => < > < bdi dir = "auto" > { reason ( ) } </ bdi > .</ > } </ Show >
15061519 </ div > } </ Show >
15071520 < Show when = { live . hasOlder ( ) } >
15081521 < button class = "transcript-older" disabled = { live . loadingOlder ( ) } onClick = { loadEarlier } >
@@ -1572,7 +1585,9 @@ export function SessionView(props: { sessionID: string; directory: string; embed
15721585 < div dir = "auto" > { composer . state . admission ?. payload . text } </ div >
15731586 < button disabled = { composer . state . inputLoading || ! connected ( ) } onClick = { ( ) => composer . refreshInputs ( ) } > Check admission</ button >
15741587 </ div > </ Show >
1575- < Show when = { ! composer . state . admission ?. fence && recoveryTarget ( ) } fallback = { < p > Waiting for a confirmed successor or admission outcome. No message will be resent automatically.</ p > } > { ( next ) =>
1588+ < Show when = { ! composer . state . admission ?. fence && recoveryTarget ( ) } fallback = { < p > { pendingTransfer ( )
1589+ && ! composer . state . admission ?. fence ? "Handoff is still preparing; your message has not been sent."
1590+ : "Waiting for a confirmed successor or admission outcome. No message will be resent automatically." } </ p > } > { ( next ) =>
15761591 < A href = { sessionHref ( next ( ) , activity . session ( next ( ) ) ?. directory ?? directory ) } aria-disabled = { recovering ( ) } onClick = { ( event ) => {
15771592 event . preventDefault ( )
15781593 void followSuccessor ( next ( ) )
0 commit comments