mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-02 02:30:43 +01:00
Avoid duplicate diagnostics for immediate native session close failure
This commit is contained in:
1 parent
a93abeb160
commit
a5ed24f7ee
2 files changed
+25
-1
No files matched your search
@@ -519,6 +519,8 @@ export async function closeWarmNativeSession(entry: WarmNativeSession, reason: s
|
||||
? "native_session_close_unrecoverable" : nativeSessionFailureSourceCode(error) });
|
||||
} catch { /* Diagnostics never own retirement or alter its result. */ }
|
||||
};
|
||||
const isReportedCloseFailure = (error: unknown) =>
|
||||
phase === "session_close" && closeState === "failed" && error === closeFailure;
|
||||
const close = async () => {
|
||||
closeState = "pending";
|
||||
try { await entry.session.close({ reason }); closeCompleted = true; closeState = "completed"; }
|
||||
@@ -562,7 +564,9 @@ export async function closeWarmNativeSession(entry: WarmNativeSession, reason: s
|
||||
catch (error) { phase = "access_cleanup"; throw error; }
|
||||
}
|
||||
} catch (error) {
|
||||
report(error);
|
||||
// The close callback already reports its own rejection, including one
|
||||
// arriving after the retirement deadline. Preserve distinct cleanup failures.
|
||||
if (!isReportedCloseFailure(error)) report(error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user