mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-01 18:07:00 +01:00
fix(e2e): admit streamed Pi write paths before control
Calibrate partial native arguments against the retained permission boundary, retaining strict conflicting-path rejection. Extend public npm consumer verification through the CLI Pi setup and credential-free packaged startup. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
2b3d7ff0ae
commit
03dd6ef933
7 files changed
+146
-7
No files matched your search
@@ -408,7 +408,7 @@ The explicit-only `pi-controls` suite adds `pending-permission-stop` and
|
||||
`same-turn-steering` on local and Daytona, each with one provider run, a
|
||||
120-second active-turn timeout and a 300-second attempt budget. These four
|
||||
control cases retain their behavior; the current matrix totals 26 Pi cells.
|
||||
Pi 1/profile 12 and coverage revisions intentionally change the affected suite
|
||||
Pi 1/profile 13 and coverage revisions intentionally change the affected suite
|
||||
fingerprints, so older qualification receipts cannot be reused. Catalog presence and
|
||||
deterministic calibration do not constitute paid qualification.
|
||||
|
||||
@@ -421,6 +421,12 @@ identity mapping. Pi does not emit Cursor/Copilot diagnostic notices; those
|
||||
notices are never synthesized. Earlier native reads can provide orientation;
|
||||
other native operations cannot substitute for the observed write.
|
||||
|
||||
Native tool arguments can arrive after the start event. An earlier null target
|
||||
is allowed only until the same execution first supplies the exact expected
|
||||
path. Missing targets, conflicting paths, another execution's path, or a later
|
||||
loss of the proven path fail. The original start and permission rows remain
|
||||
bound by retained hashes through control dispatch and settlement.
|
||||
|
||||
Stop awaits the pending evidence write and rereads that boundary before sending
|
||||
one caller UUID to the public cancel API. It requires the original request's
|
||||
normalized cancellation closure, a cancelled terminal, and the same-scope
|
||||
|
||||
@@ -1090,7 +1090,8 @@ export const runnerSuites: readonly RunnerSuiteFixture[] = [
|
||||
description: "Pending native-write Stop and browser-originated same-turn steering, with exact control receipts and independent retirement/no-effect evidence.",
|
||||
groups: ["native"], profiles: extendedHarnessProfiles.filter(profile => profile.qualificationCandidate === "pi"),
|
||||
environments: runnerEnvironments, tasks: piControlTasks, expectedMatrixSize: 4,
|
||||
definitionMetadata: { version: 1, qualification: "pending", scheduling: "explicit-only", profileVersion: QUALIFIED_ACPX_PROFILES.pi.agentProfileVersion,
|
||||
definitionMetadata: { version: 2, qualification: "pending", scheduling: "explicit-only", profileVersion: QUALIFIED_ACPX_PROFILES.pi.agentProfileVersion,
|
||||
nativeArguments: "streamed-until-exact-target",
|
||||
pending: "paperclip.e2e.pi-control-pending.v1", stop: "paperclip.e2e.pi-stop-settlement.v1", steering: "paperclip.e2e.pi-steering-settlement.v1",
|
||||
permissionPolicy: "approve-reads", lifecycle: "per_turn", normalCompletionProvesStop: false, nativeFollowUp: "not-covered", providerDeath: "not-covered",
|
||||
remoteObservationCoverage: "continuous-through-owned-process-retirement", filesystemAfterRemoteRetirementObserved: false },
|
||||
|
||||
@@ -16,8 +16,35 @@ function cancelled() {
|
||||
const binding = { pending, caller: piControlCaller, cancellationRequestId: piCancellationId, dispatchMonotonicNs: String(BigInt(pending.observedMonotonicNs) + 1n) };
|
||||
return { f, binding, read: () => readPiStopSettlement({ ...f.state(), ...binding }) };
|
||||
}
|
||||
function streamedWrite() {
|
||||
const f = piControlFixture();
|
||||
f.events.pop();
|
||||
event(f.events[0]!).payload = { ...f.tool, target: null, inputUpdated: false };
|
||||
f.append("tool.execution.progressed", { ...f.tool, target: null, inputUpdated: true });
|
||||
f.append("tool.execution.progressed", { ...f.tool, inputUpdated: true });
|
||||
f.append("runtime_request.created", { request: f.request });
|
||||
return f;
|
||||
}
|
||||
describe("Pi pending control identity", () => {
|
||||
it("accepts Pi native permission/start without invented provider notices", () => expect(piControlFixture().pending()).toMatchObject({ toolCallId: "pi-tool", executionId: "pi-tool", turnId: "turn" }));
|
||||
it("accepts streamed arguments only after the same execution proves its exact path", () => {
|
||||
const f = streamedWrite();
|
||||
expect(f.pending()).toMatchObject({ startedSourceSeq: 1, requestSourceSeq: 4 });
|
||||
});
|
||||
it.each([
|
||||
["no complete target", (f: ReturnType<typeof streamedWrite>) => { event(f.events[2]!).payload.target = null; }],
|
||||
["conflicting partial target", f => { event(f.events[1]!).payload.target = "other.txt"; }],
|
||||
["target lost after admission", f => { f.append("tool.execution.progressed", { ...f.tool, target: null }); }],
|
||||
["different execution supplied target", f => { event(f.events[2]!).payload.executionId = "other"; }],
|
||||
["terminal before target", f => { f.events[1]!.eventType = event(f.events[1]!).eventType = "tool.execution.completed"; event(f.events[1]!).payload.status = "failed"; }],
|
||||
] satisfies Array<[string, (f: ReturnType<typeof streamedWrite>) => void]>)("rejects streamed write with %s", (_name, mutate) => {
|
||||
const f = streamedWrite(); mutate(f); expect(() => f.pending()).toThrow();
|
||||
});
|
||||
it("retains the partial start hash through actual callback cancellation", () => {
|
||||
const f = streamedWrite(), pending = f.pending(); f.cancel();
|
||||
expect(readPiStopSettlement({ ...f.state(), pending, caller: piControlCaller, cancellationRequestId: piCancellationId,
|
||||
dispatchMonotonicNs: String(BigInt(pending.observedMonotonicNs) + 1n) })).toMatchObject({ normalCompletionAccepted: false });
|
||||
});
|
||||
it("admits permission-first ACP only after both canonical boundaries exist", () => {
|
||||
const f = piControlFixture(); f.events.reverse();
|
||||
f.events.forEach((r, i) => { r.seq = event(r).sourceSeq = i + 1; event(r).sourceEventId = `source:run:${i + 1}`; });
|
||||
|
||||
@@ -46,11 +46,17 @@ function origin(events: readonly unknown[], scope: PiControlScope) {
|
||||
const native = rows.filter(x => x.event.eventType.startsWith("tool.execution.") && rec(x.event.payload).transport === "builtin");
|
||||
const write = native.filter(x => rec(x.event.payload).executionId === executionId);
|
||||
const started = write.filter(x => x.event.eventType === "tool.execution.started");
|
||||
// Pi streams native tool arguments. The start and early progress rows can
|
||||
// have no path yet; the pending permission is admissible only after this
|
||||
// same execution provides the exact target. Conflicting paths and loss of a
|
||||
// previously known path still fail, including after denial or cancellation.
|
||||
const targetIndex = write.findIndex(x => x.event.payload.target === scope.target);
|
||||
requireProof(started.length === 1 && write.filter(x => x.event.eventType === "tool.execution.completed").length <= 1
|
||||
&& write[0] === started[0]
|
||||
&& write.every(x => ["tool.execution.started", "tool.execution.progressed", "tool.execution.completed"].includes(x.event.eventType)
|
||||
&& write[0] === started[0] && targetIndex >= 0
|
||||
&& write.every((x, index) => ["tool.execution.started", "tool.execution.progressed", "tool.execution.completed"].includes(x.event.eventType)
|
||||
&& x.event.payload.schema === "paperclip.tool.execution.v1" && x.event.payload.name === "write" && x.event.payload.operation === "edit"
|
||||
&& x.event.payload.target === scope.target && x.event.payload.status === (x.event.eventType === "tool.execution.completed" ? "failed" : "running")), "exact native write lifecycle missing");
|
||||
&& (x.event.payload.target === scope.target || (index < targetIndex && x.event.payload.target === null && x.event.eventType !== "tool.execution.completed"))
|
||||
&& x.event.payload.status === (x.event.eventType === "tool.execution.completed" ? "failed" : "running")), "exact native write lifecycle missing");
|
||||
requireProof(!write.some((x, index) => x.event.eventType === "tool.execution.completed" && index !== write.length - 1), "write activity after terminal");
|
||||
// Read-only orientation/bootstrap can precede the write. Never exempt another
|
||||
// edit, shell execution, or unknown native operation as an alleged bootstrap.
|
||||
|
||||
Reference in new issue
Block a user