@omercnet/paseo-omp 5.6.1-next.452.1 → 5.6.1-next.454.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Release Please keeps this bundle-safe constant aligned with package.json. */
|
|
2
|
-
export const PASEO_OMP_PACKAGE_VERSION = "5.6.1-next.
|
|
2
|
+
export const PASEO_OMP_PACKAGE_VERSION = "5.6.1-next.454.1"; // x-release-please-version
|
|
@@ -10,6 +10,7 @@ import type { OmpRuntime, OmpRuntimeSession } from "./omp-rpc";
|
|
|
10
10
|
import type { OmpModel } from "./omp-rpc-protocol";
|
|
11
11
|
import {
|
|
12
12
|
configuredOutputRedactionValues,
|
|
13
|
+
isOmpCleanupFailure,
|
|
13
14
|
OmpCleanupFailure,
|
|
14
15
|
OmpPublicDataSerializer,
|
|
15
16
|
OmpPublicError,
|
|
@@ -141,8 +142,13 @@ async function closeCatalogSession(session: OmpRuntimeSession): Promise<void> {
|
|
|
141
142
|
const cleanup = session.close();
|
|
142
143
|
try {
|
|
143
144
|
await cleanup;
|
|
144
|
-
} catch {
|
|
145
|
-
|
|
145
|
+
} catch (error) {
|
|
146
|
+
// The RPC transport already carries a reverify promise that keeps retrying tree cleanup;
|
|
147
|
+
// wrapping that rejection with `cleanup` (an already-rejected promise) would discard it.
|
|
148
|
+
if (isOmpCleanupFailure(error)) throw error;
|
|
149
|
+
// The close rejection has already been reported by the caller; the gate only has to stay
|
|
150
|
+
// closed on the same settled promise, without counting the failure twice.
|
|
151
|
+
throw new OmpCleanupFailure("OMP catalog cleanup failed", cleanup, undefined, true);
|
|
146
152
|
}
|
|
147
153
|
}
|
|
148
154
|
|
|
@@ -710,6 +710,37 @@ export class OmpNativeSessionReservations {
|
|
|
710
710
|
}
|
|
711
711
|
}
|
|
712
712
|
|
|
713
|
+
/**
|
|
714
|
+
* Catalog cleanups that are still unverified. Every failed discovery contributes its own cleanup,
|
|
715
|
+
* so two discoveries that fail concurrently cannot overwrite each other: a fulfilled cleanup leaves
|
|
716
|
+
* the set, a rejected cleanup stays in it, and a non-empty set keeps later discoveries from starting
|
|
717
|
+
* a new OMP process over a process tree that was not confirmed gone.
|
|
718
|
+
*/
|
|
719
|
+
class OmpCatalogCleanupRegistry {
|
|
720
|
+
private readonly pending = new Set<Promise<void>>();
|
|
721
|
+
|
|
722
|
+
get size(): number {
|
|
723
|
+
return this.pending.size;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
track(cleanup: Promise<void>, onCleanupRejected: () => void): void {
|
|
727
|
+
this.pending.add(cleanup);
|
|
728
|
+
void cleanup.then(
|
|
729
|
+
() => this.pending.delete(cleanup),
|
|
730
|
+
// A rejected cleanup stays tracked: the tree was never confirmed gone.
|
|
731
|
+
onCleanupRejected,
|
|
732
|
+
);
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
values(): IterableIterator<Promise<void>> {
|
|
736
|
+
return this.pending.values();
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
clear(): void {
|
|
740
|
+
this.pending.clear();
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
|
|
713
744
|
export function createOmpConnection(
|
|
714
745
|
runtime: OmpRuntime,
|
|
715
746
|
capabilities: readonly string[],
|
|
@@ -779,7 +810,7 @@ export function createOmpConnection(
|
|
|
779
810
|
return new Set([...sessions.keys(), ...opening.keys(), ...failedCleanup.keys()]).size;
|
|
780
811
|
});
|
|
781
812
|
const shutdown = new AbortController();
|
|
782
|
-
|
|
813
|
+
const catalogCleanups = new OmpCatalogCleanupRegistry();
|
|
783
814
|
const activeOperations = new Set<Promise<void>>();
|
|
784
815
|
let closing = false;
|
|
785
816
|
let closed = false;
|
|
@@ -830,7 +861,7 @@ export function createOmpConnection(
|
|
|
830
861
|
const dispatch = async (input: ProviderInput): Promise<void> => {
|
|
831
862
|
switch (input.type) {
|
|
832
863
|
case "catalog":
|
|
833
|
-
if (
|
|
864
|
+
if (catalogCleanups.size > 0) {
|
|
834
865
|
requestFailure(input.requestId, new OmpPublicError("OMP catalog cleanup is incomplete"));
|
|
835
866
|
return;
|
|
836
867
|
}
|
|
@@ -867,7 +898,15 @@ export function createOmpConnection(
|
|
|
867
898
|
if (!closing) {
|
|
868
899
|
recordOperationalFailure({ category: "session-open", stage: "catalog" });
|
|
869
900
|
}
|
|
870
|
-
if (isOmpCleanupFailure(error))
|
|
901
|
+
if (isOmpCleanupFailure(error)) {
|
|
902
|
+
catalogCleanups.track(error.cleanup, () => {
|
|
903
|
+
// A cleanup that had already rejected is the failure reported above; counting its
|
|
904
|
+
// rejection again would report one close failure twice.
|
|
905
|
+
if (!closing && !error.cleanupAlreadyRejected) {
|
|
906
|
+
recordOperationalFailure({ category: "session-open", stage: "catalog" });
|
|
907
|
+
}
|
|
908
|
+
});
|
|
909
|
+
}
|
|
871
910
|
if (!closing) requestFailure(input.requestId, error, "OMP catalog discovery failed");
|
|
872
911
|
}
|
|
873
912
|
return;
|
|
@@ -1250,9 +1289,10 @@ export function createOmpConnection(
|
|
|
1250
1289
|
seenCleanups.add(cleanup);
|
|
1251
1290
|
cleanupBatch.push(cleanup);
|
|
1252
1291
|
}
|
|
1253
|
-
|
|
1254
|
-
seenCleanups.
|
|
1255
|
-
|
|
1292
|
+
for (const cleanup of catalogCleanups.values()) {
|
|
1293
|
+
if (seenCleanups.has(cleanup)) continue;
|
|
1294
|
+
seenCleanups.add(cleanup);
|
|
1295
|
+
cleanupBatch.push(cleanup);
|
|
1256
1296
|
}
|
|
1257
1297
|
const results = await Promise.allSettled(cleanupBatch);
|
|
1258
1298
|
for (const result of results) {
|
|
@@ -1266,7 +1306,7 @@ export function createOmpConnection(
|
|
|
1266
1306
|
sessions.clear();
|
|
1267
1307
|
opening.clear();
|
|
1268
1308
|
failedCleanup.clear();
|
|
1269
|
-
|
|
1309
|
+
catalogCleanups.clear();
|
|
1270
1310
|
};
|
|
1271
1311
|
return {
|
|
1272
1312
|
version: 1,
|
|
@@ -68,7 +68,7 @@ import {
|
|
|
68
68
|
validateBoundedText,
|
|
69
69
|
} from "./omp-rpc-values";
|
|
70
70
|
import { buildOmpPromptRequest } from "./prompt-payload";
|
|
71
|
-
import { OmpCleanupFailure, OmpPublicError } from "./security";
|
|
71
|
+
import { isOmpCleanupFailure, OmpCleanupFailure, OmpPublicError } from "./security";
|
|
72
72
|
import {
|
|
73
73
|
listOmpSessionDescriptors,
|
|
74
74
|
type OmpSessionDescriptor,
|
|
@@ -695,8 +695,12 @@ export class OmpRpcRuntime implements OmpRuntime {
|
|
|
695
695
|
const cleanup = process.close();
|
|
696
696
|
try {
|
|
697
697
|
await cleanup;
|
|
698
|
-
} catch {
|
|
699
|
-
|
|
698
|
+
} catch (cleanupError) {
|
|
699
|
+
// The RPC transport carries a reverify promise that keeps retrying tree cleanup. Wrapping
|
|
700
|
+
// its rejection with `cleanup` (an already-rejected promise) would discard that promise, so
|
|
701
|
+
// a startup cleanup failure could never reopen the catalog gate.
|
|
702
|
+
if (isOmpCleanupFailure(cleanupError)) throw cleanupError;
|
|
703
|
+
throw new OmpCleanupFailure("OMP runtime startup cleanup failed", cleanup, undefined, true);
|
|
700
704
|
}
|
|
701
705
|
throw error;
|
|
702
706
|
}
|
|
@@ -201,6 +201,12 @@ export class OmpCleanupFailure extends Error {
|
|
|
201
201
|
message: string,
|
|
202
202
|
readonly cleanup: Promise<void>,
|
|
203
203
|
readonly nativeSessionId?: string,
|
|
204
|
+
/**
|
|
205
|
+
* True when `cleanup` is the rejection that already produced this failure, such as an
|
|
206
|
+
* already-rejected `session.close()`. Callers that reported the failure once use it to avoid
|
|
207
|
+
* reporting the same rejection a second time when the cleanup settles.
|
|
208
|
+
*/
|
|
209
|
+
readonly cleanupAlreadyRejected = false,
|
|
204
210
|
) {
|
|
205
211
|
void cleanup.catch(() => undefined);
|
|
206
212
|
super(message);
|
package/server/turn-rows.ts
CHANGED
|
@@ -19,18 +19,18 @@ export type OmpTurnRowReader = (
|
|
|
19
19
|
* turn of such an agent, every reader may append one timeline row built from that file.
|
|
20
20
|
*/
|
|
21
21
|
export function registerOmpTurnRows(
|
|
22
|
-
server: Pick<PluginServerContext, "
|
|
22
|
+
server: Pick<PluginServerContext, "on">,
|
|
23
23
|
readers: readonly OmpTurnRowReader[],
|
|
24
24
|
): () => void {
|
|
25
25
|
// One Paseo turn can report several native turn starts; keep the earliest. Hooks run
|
|
26
26
|
// concurrently, so state is read and cleared before the first await.
|
|
27
27
|
const turnStarts = new Map<string, number>();
|
|
28
28
|
const turnKey = (agentId: string, turnId: string | null) => `${agentId}\0${turnId ?? ""}`;
|
|
29
|
-
const removeBefore = server.
|
|
29
|
+
const removeBefore = server.on("agent.turn_started", async ({ agent, turnId }) => {
|
|
30
30
|
const key = turnKey(agent.id, turnId);
|
|
31
31
|
if (agent.provider === "omp" && !turnStarts.has(key)) turnStarts.set(key, Date.now());
|
|
32
32
|
});
|
|
33
|
-
const removeAfter = server.
|
|
33
|
+
const removeAfter = server.on("agent.turn_ended", async ({ agent, turnId }, { paseo }) => {
|
|
34
34
|
const key = turnKey(agent.id, turnId);
|
|
35
35
|
const since = turnStarts.get(key);
|
|
36
36
|
const until = Date.now();
|