mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-04 22:01:15 +00:00
fix: avoid locally caught ACP session init exception (#55136) (thanks @doguabaris)
This commit is contained in:
@@ -357,19 +357,15 @@ export class AcpSessionManager {
|
||||
state: "idle",
|
||||
lastActivityAt: Date.now(),
|
||||
};
|
||||
|
||||
let persisted: SessionEntry | null = null;
|
||||
try {
|
||||
const persisted = await this.writeSessionMeta({
|
||||
persisted = await this.writeSessionMeta({
|
||||
cfg: input.cfg,
|
||||
sessionKey,
|
||||
mutate: () => meta,
|
||||
failOnError: true,
|
||||
});
|
||||
if (!persisted?.acp) {
|
||||
throw new AcpRuntimeError(
|
||||
"ACP_SESSION_INIT_FAILED",
|
||||
`Could not persist ACP metadata for ${sessionKey}.`,
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
await runtime
|
||||
.close({
|
||||
@@ -383,6 +379,24 @@ export class AcpSessionManager {
|
||||
});
|
||||
throw error;
|
||||
}
|
||||
|
||||
if (!persisted?.acp) {
|
||||
await runtime
|
||||
.close({
|
||||
handle,
|
||||
reason: "init-meta-failed",
|
||||
})
|
||||
.catch((closeError) => {
|
||||
logVerbose(
|
||||
`acp-manager: cleanup close failed after metadata write error for ${sessionKey}: ${String(closeError)}`,
|
||||
);
|
||||
});
|
||||
|
||||
throw new AcpRuntimeError(
|
||||
"ACP_SESSION_INIT_FAILED",
|
||||
`Could not persist ACP metadata for ${sessionKey}.`,
|
||||
);
|
||||
}
|
||||
this.setCachedRuntimeState(sessionKey, {
|
||||
runtime,
|
||||
handle,
|
||||
|
||||
Reference in New Issue
Block a user