@@ -26,7 +26,7 @@ export interface ConnectionDiagnosis {
2626 readonly hops : ReadonlyArray < ConnectionDiagnosisHop > ;
2727 readonly steps : ReadonlyArray < string > ;
2828 readonly facts : ReadonlyArray < readonly [ label : string , value : string ] > ;
29- /** The troubleshooting guide section for this failure. Null for direct routes. */
29+ /** The troubleshooting guide section for this failure. Null for direct routes, except a pending T3 Connect sign-in . */
3030 readonly moreInfoUrl : string | null ;
3131}
3232
@@ -46,7 +46,15 @@ export interface ConnectionDiagnosisInput {
4646
4747interface Located {
4848 readonly hop : ConnectionHop ;
49- readonly cause : ConnectionFailureCause | "offline" | "outdated" | "released" | null ;
49+ readonly cause :
50+ | ConnectionFailureCause
51+ | "offline"
52+ | "outdated"
53+ | "released"
54+ | "session_pending"
55+ | null ;
56+ /** The failure named no hop, so the hops before this one were never probed. */
57+ readonly guessed ?: true ;
5058}
5159
5260const NOT_ANSWERING : ReadonlySet < ConnectionFailureCause > = new Set ( [
@@ -62,6 +70,9 @@ function locate(input: ConnectionDiagnosisInput): Located | null {
6270 if ( failure ?. _tag === "ConnectionBlockedError" && failure . serverUpdateRequired ) {
6371 return { hop : "server" , cause : "outdated" } ;
6472 }
73+ if ( failure ?. reason === "session-pending" ) {
74+ return { hop : "device" , cause : "session_pending" } ;
75+ }
6576 if ( failure ?. hop !== undefined ) {
6677 return { hop : failure . hop , cause : failure . failureCause ?? null } ;
6778 }
@@ -71,7 +82,11 @@ function locate(input: ConnectionDiagnosisInput): Located | null {
7182 failure . reason === "timeout" ||
7283 failure . reason === "transport" ;
7384 const via = failure . via ?? input . via ;
74- return { hop : unreachable && via === "relay" ? "tunnel" : "server" , cause : null } ;
85+ return {
86+ hop : unreachable && via === "relay" ? "tunnel" : "server" ,
87+ cause : null ,
88+ guessed : true ,
89+ } ;
7590 }
7691 const status = input . relayStatus ;
7792 if ( status ?. status !== "offline" ) return null ;
@@ -84,6 +99,8 @@ function headline(host: string, located: Located, failure: ConnectionAttemptErro
8499 switch ( located . cause ) {
85100 case "offline" :
86101 return "This device is offline" ;
102+ case "session_pending" :
103+ return "This device is still loading its T3 Connect sign-in" ;
87104 case "outdated" :
88105 return `${ host } runs an older T3 Code` ;
89106 case "clock_skew" :
@@ -141,6 +158,11 @@ function steps(host: string, located: Located, failure: ConnectionAttemptError |
141158 switch ( located . cause ) {
142159 case "offline" :
143160 return [ "Connect this device to the internet. T3 Code reconnects on its own." ] ;
161+ case "session_pending" :
162+ return [
163+ "Wait a moment. T3 Code retries on its own." ,
164+ "If it keeps waiting, reload or restart T3 Code on this device." ,
165+ ] ;
144166 case "outdated" :
145167 return [ `Update T3 Code on ${ host } .` ] ;
146168 case "clock_skew" :
@@ -220,6 +242,7 @@ function helpSection(
220242 return "the-host-runs-an-older-t3-code" ;
221243 case "clock_skew" :
222244 return "the-clock-is-off" ;
245+ case "session_pending" :
223246 case "not_linked" :
224247 case "tunnel_not_enabled" :
225248 return "sign-in-account-or-link-problems" ;
@@ -300,7 +323,12 @@ export function presentConnectionDiagnosis(
300323 const hops = order . map ( ( hop , index ) : ConnectionDiagnosisHop => ( {
301324 hop,
302325 label : hopLabel ( hop , host ) ,
303- result : index < failedIndex ? "ok" : index === failedIndex ? "failed" : "unchecked" ,
326+ result :
327+ index === failedIndex
328+ ? "failed"
329+ : index < failedIndex && located . guessed !== true
330+ ? "ok"
331+ : "unchecked" ,
304332 } ) ) ;
305333
306334 // The relay health check only explains the state when no attempt has failed yet.
@@ -329,7 +357,10 @@ export function presentConnectionDiagnosis(
329357 hops,
330358 steps : steps ( host , located , failure ) ,
331359 facts,
332- moreInfoUrl : relayPath ? t3ConnectTroubleshootingUrl ( helpSection ( located , failure ) ) : null ,
360+ moreInfoUrl :
361+ relayPath || located . cause === "session_pending"
362+ ? t3ConnectTroubleshootingUrl ( helpSection ( located , failure ) )
363+ : null ,
333364 } ;
334365}
335366
0 commit comments