mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-01 15:35:12 +01:00
Admit supported PRP v2 idle goal recovery evidence
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
98f05fcd5b
commit
eaef0d5655
3 files changed
+77
-4
No files matched your search
@@ -10,10 +10,11 @@ const snapshot = { eventType: "session.goal.snapshot", envelope: { ...identity,
|
||||
const state = (events: unknown[]) => ({ identity, commands: [{ status: "completed" }], committedEvents: events });
|
||||
|
||||
describe("settled remote warm control evidence", () => {
|
||||
it("accepts the terminal and an authenticated idle goal-read suffix without changing its order", () => {
|
||||
const control = state([terminal, snapshot]);
|
||||
it.each(["paperclip.prp.event.v1", "paperclip.prp.event.v2"])("accepts the terminal and an authenticated %s idle goal-read suffix without changing its order", schema => {
|
||||
const suffix = { ...snapshot, envelope: { ...snapshot.envelope, payload: { ...notification, schema } } };
|
||||
const control = state([terminal, suffix]);
|
||||
expect(isSettledRemoteWarmControlState(control, identity)).toBe(true);
|
||||
expect(control.committedEvents).toEqual([terminal, snapshot]);
|
||||
expect(control.committedEvents).toEqual([terminal, suffix]);
|
||||
expect(isSettledRemoteWarmControlState(state([terminal]), identity)).toBe(true);
|
||||
});
|
||||
|
||||
@@ -21,6 +22,7 @@ describe("settled remote warm control evidence", () => {
|
||||
["active goal", { ...snapshot, envelope: { ...snapshot.envelope, payload: { ...notification, payload: { ...goal, goal: { status: "active" } } } } }],
|
||||
["provider work", { ...snapshot, envelope: { ...snapshot.envelope, payload: { ...notification, payload: { ...goal, workingNow: true } } } }],
|
||||
["unknown event", { ...snapshot, eventType: "unknown" }],
|
||||
["unknown protocol version", { ...snapshot, envelope: { ...snapshot.envelope, payload: { ...notification, schema: "paperclip.prp.event.v3" } } }],
|
||||
["new turn", { ...snapshot, eventType: "turn.started" }],
|
||||
["foreign run", { ...snapshot, envelope: { ...snapshot.envelope, runId: "other" } }],
|
||||
["foreign session", { ...snapshot, envelope: { ...snapshot.envelope, normalizedSessionId: "other" } }],
|
||||
|
||||
@@ -36,7 +36,8 @@ export function isSettledRemoteWarmControlState(control: Record<string, unknown>
|
||||
const payload = record(notification.payload);
|
||||
return record(event).eventType === "session.goal.snapshot" && matchesSession(event) &&
|
||||
Object.entries(identity).every(([key, value]) => envelope[key] === value) &&
|
||||
notification.schema === "paperclip.prp.event.v1" && notification.eventType === "session.goal.snapshot" &&
|
||||
(notification.schema === "paperclip.prp.event.v1" || notification.schema === "paperclip.prp.event.v2") &&
|
||||
notification.eventType === "session.goal.snapshot" &&
|
||||
notification.sourceInstanceId === identity.runnerInstanceId && notification.sourceKind === "runner" &&
|
||||
notification.runId === identity.runId && notification.normalizedSessionId === identity.normalizedSessionId &&
|
||||
payload.schema === "paperclip.session_goal.snapshot.v1" && payload.goal === null && payload.workingNow === false;
|
||||
|
||||
Reference in new issue
Block a user