mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 21:00:44 +00:00
fix: guard terminal handler tracking cleanup
This commit is contained in:
@@ -489,7 +489,7 @@ describe("plugin run context lifecycle", () => {
|
||||
});
|
||||
await vi.advanceTimersByTimeAsync(0);
|
||||
expect(cleanup).toHaveBeenCalledTimes(1);
|
||||
await vi.advanceTimersByTimeAsync(5_000);
|
||||
await vi.advanceTimersByTimeAsync(PLUGIN_HOST_CLEANUP_TIMEOUT_MS);
|
||||
await expect(resultPromise).resolves.toMatchObject({
|
||||
failures: [
|
||||
{
|
||||
|
||||
@@ -98,7 +98,10 @@ function trackAgentEventHandler(runId: string, pending: Promise<void>): void {
|
||||
state.pendingAgentEventHandlersByRunId.set(runId, handlers);
|
||||
void pending.finally(() => {
|
||||
handlers.delete(pending);
|
||||
if (handlers.size === 0) {
|
||||
if (
|
||||
handlers.size === 0 &&
|
||||
getPluginHostRuntimeState().pendingAgentEventHandlersByRunId.get(runId) === handlers
|
||||
) {
|
||||
state.pendingAgentEventHandlersByRunId.delete(runId);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user