mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-01 18:07:00 +01:00
fix: preserve Pi fixture bytes and trusted cleanup ancestry
This commit is contained in:
1 parent
5a23ef6595
commit
867fa47116
9 files changed
+137
-14
No files matched your search
@@ -7,12 +7,52 @@ qualification. The existing draft stack must be reviewed in dependency order.
|
||||
|
||||
## Case corrections — 2026-10-05
|
||||
|
||||
The latest completed frozen-runtime proofs are **28/33: Product 21/26 and
|
||||
Runner 7/7**. These counts supersede older snapshots below. The two corrected
|
||||
The historical profile-14 proofs are **28/33: Product 21/26 and
|
||||
Runner 7/7**. They do not qualify the current profile-15 runtime. The two corrected
|
||||
Runner prompts pass at private definitions revision `7b112ffe3` with unchanged
|
||||
graders, one attempt per correction and zero automatic retries. Their original
|
||||
failures remain retained. The Mac file-edit correction also passes.
|
||||
|
||||
### Latest boundary fixes — 2026-10-05
|
||||
|
||||
Normal public installs of runtime `b012b3aebe` admit profile 15 on Mac ARM,
|
||||
Mac Intel (through Rosetta), and native Linux. The native Linux image is
|
||||
`sha256:3279d92405a59b4654cb6af5de27bfacffee73a2c57311bf5f2d5ff9272b9b67`.
|
||||
The corrected remote provider-death case passes all six matchers and cleanup;
|
||||
the native-questions case passes all 16 matchers and cleanup. These two passes
|
||||
are source-bound evidence, not qualification of the whole shipping roster.
|
||||
|
||||
The next Mac memory attempt fails at the unchanged 120-second native-session
|
||||
limit, with cleanup passing. Its public description contains invalid JSON:
|
||||
the shared issue validator converts the fenced content's literal `\\n` into a
|
||||
real newline. Browser `.fill()` also exports an escaped paragraph instead of
|
||||
a Markdown code fence. A credential-free actual installed-UI probe reproduces
|
||||
that second boundary and confirms that Markdown paste retains the valid JSON
|
||||
and all 33 content bytes. Both task submissions are intercepted, so neither
|
||||
can create provider work. The shared validator now preserves real multiline
|
||||
bodies; legacy single-line self-escaped descriptions retain their recovery.
|
||||
The exact old/new validator proof fails before and preserves 33 bytes afterward.
|
||||
All 837 shared tests pass using the canonical `/private/tmp` directory.
|
||||
|
||||
The next remote restart attempt fails during controller process cleanup with
|
||||
`Owned process group identity became uncertain`, before any replacement
|
||||
controller starts. Its independently observed remote run retirement passes;
|
||||
canonical cleanup remains failed. The exact owned child sandbox is separately
|
||||
deleted and verified absent. A regression reproduces rejection of a replacement
|
||||
group member whose ancestry still belongs to a separately validated owner.
|
||||
Cleanup now admits only that proven ancestry; recycled groups and mixed live
|
||||
ownership still fail before signaling. All 31 ownership/restart tests pass,
|
||||
including a negative control for a recycled controller ancestry anchor.
|
||||
This addresses a reproducible cleanup condition; the original failure lacks
|
||||
the process table needed to attribute its exact uncertain group.
|
||||
|
||||
`pi-native` definition version 12 records the prompt transport and cleanup
|
||||
changes. The nonce-plus-LF, cross-root denial, fresh-task persistence, native
|
||||
request identity, and deadline assertions are unchanged. Fresh installed
|
||||
artifacts and explicit corrected live attempts remain required. The previous
|
||||
`5a23ef659` head's 53 CI checks pass with two skips; this is not CI proof for
|
||||
the new boundary changes. No merge or release is authorized.
|
||||
|
||||
The provider-death fixture now admits the production runner's stable symlink
|
||||
while still checking the resolved bytes, live Node inode and exact Pi-child
|
||||
pidfd. All 21 Linux fault tests and 297 Linux fixture checks pass. The next live
|
||||
|
||||
@@ -153,6 +153,17 @@ describe("issue validators", () => {
|
||||
expect(parsed.comment).toBe("Done\n\n- Verified the route");
|
||||
});
|
||||
|
||||
it("preserves literal escapes in multiline issue descriptions and comments", () => {
|
||||
const content = `${"0123456789abcdef".repeat(2)}\n`;
|
||||
const description = ["Write the exact JSON content.", "```json", JSON.stringify({ content }), "```"].join("\n");
|
||||
expect(createIssueSchema.parse({ title: "Native memory", description }).description).toBe(description);
|
||||
expect(updateIssueSchema.parse({ description, comment: description }).description).toBe(description);
|
||||
expect(updateIssueSchema.parse({ comment: description }).comment).toBe(description);
|
||||
const storedJson = createIssueSchema.parse({ title: "Native memory", description }).description!.split("\n")[2]!;
|
||||
expect(JSON.parse(storedJson).content).toBe(content);
|
||||
expect(Buffer.byteLength(JSON.parse(storedJson).content, "utf8")).toBe(33);
|
||||
});
|
||||
|
||||
it("validates structured unblock descriptors", () => {
|
||||
expect(
|
||||
updateIssueSchema.parse({
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export function normalizeEscapedLineBreaks(value: string): string {
|
||||
// Recover legacy single-line payloads that encoded their own line breaks.
|
||||
// A real multiline body already has decoded transport newlines; decoding
|
||||
// it again corrupts literal escapes in JSON, code, paths and agent prompts.
|
||||
if (/[\r\n]/.test(value)) return value;
|
||||
return value
|
||||
.replace(/\\r\\n/g, "\n")
|
||||
.replace(/\\n/g, "\n")
|
||||
|
||||
@@ -394,8 +394,12 @@ different executable fail admission. Linux calibration covers this installation
|
||||
form as well as a copied runner.
|
||||
|
||||
The agent-memory fixture requires the nonce's UTF-8 bytes followed by exactly
|
||||
one line-feed byte (`0x0A`). Its prompt states that byte contract in plain text:
|
||||
the browser editor can normalize backslash escapes in a quoted JSON example.
|
||||
one line-feed byte (`0x0A`). Its prompt states that byte contract in plain text
|
||||
and provides the exact content as fenced JSON. Fenced task prompts use the rich
|
||||
editor's Markdown paste path; filling the editor directly produces escaped
|
||||
paragraph text instead of a code block. The issue API preserves literal escapes
|
||||
in real multiline bodies and only recovers self-escaped line breaks in legacy
|
||||
single-line bodies. Code fences and JSON escapes must survive both boundaries.
|
||||
The prompt orders one memory write, one complete native read, a separate expected
|
||||
cross-root write denial, and then completion. Native paths use the exact current
|
||||
absolute agent directory; shell-variable expansion is not assumed. An incorrect
|
||||
@@ -403,6 +407,11 @@ memory result must be reported without a repeated rewrite loop. Native readback
|
||||
managed-file API must retain the exact bytes across a new task and controller
|
||||
restart. The byte graders remain unchanged.
|
||||
|
||||
Controller cleanup can admit a replacement group member only when its ancestry
|
||||
belongs to a separately revalidated, continuously owned process. A recycled
|
||||
numeric group, a changed PID/start identity, or any unowned live member still
|
||||
fails cleanup before signaling. This rule is recorded in `pi-native` version 12.
|
||||
|
||||
The runtime itself must emit `runtime_request.expired` for the original callback
|
||||
with `provider_process_lost` and `replayAllowed:false`, followed by native turn
|
||||
failure. The permanent failed-terminal recovery projection must put the owned
|
||||
|
||||
@@ -1114,7 +1114,7 @@ export const runnerSuites: readonly RunnerSuiteFixture[] = [
|
||||
groups: ["native"], profiles: extendedHarnessProfiles.filter(profile => profile.qualificationCandidate === "pi"),
|
||||
environments: runnerEnvironments, tasks: piNativeTasks, expectedMatrixSize: 10,
|
||||
excludedExecutionIds: ["pi-native.runner-acpx-pi.daytona.restrictive-denial", "pi-native.runner-acpx-pi.local.native-pending-provider-death"],
|
||||
definitionMetadata: { version: 11, qualification: "pending", scheduling: "explicit-only", profileVersion: QUALIFIED_ACPX_PROFILES.pi.agentProfileVersion, agentMemoryContent: "utf8-nonce-plus-final-lf", agentMemoryPrompt: "ordered-memory-adjacent-internal-qualifier-and-fenced-content", nativeFinish: "current-contract-objective-evidence-refs", providerDeath: "daytona-exact-pi-child-pidfd-production-expiry", providerFaultExecutable: "stable-preinstalled-runner-link-and-snapshot-node-inode-with-held-bootstrap-fd-3-or-7", remoteBootstrapApproval: "exact-published-native-read-public-accept-once-v1", remoteDenyAll: "unsupported-native-bootstrap-read-is-denied", remoteEvidence: "owned-lease-sealed-observer", pendingControllerRestart: "same-live-native-request" },
|
||||
definitionMetadata: { version: 12, qualification: "pending", scheduling: "explicit-only", profileVersion: QUALIFIED_ACPX_PROFILES.pi.agentProfileVersion, agentMemoryContent: "utf8-nonce-plus-final-lf", agentMemoryPrompt: "ordered-memory-adjacent-internal-qualifier-and-fenced-content", taskPromptTransport: "fenced-markdown-paste-and-multiline-literal-escapes", nativeFinish: "current-contract-objective-evidence-refs", providerDeath: "daytona-exact-pi-child-pidfd-production-expiry", providerFaultExecutable: "stable-preinstalled-runner-link-and-snapshot-node-inode-with-held-bootstrap-fd-3-or-7", remoteBootstrapApproval: "exact-published-native-read-public-accept-once-v1", remoteDenyAll: "unsupported-native-bootstrap-read-is-denied", remoteEvidence: "owned-lease-sealed-observer", pendingControllerRestart: "same-live-native-request-trusted-ancestry-cleanup" },
|
||||
},
|
||||
{
|
||||
id: "native-active-stop", label: "Stop an unanswered native permission", manualOnly: true,
|
||||
|
||||
@@ -189,7 +189,7 @@ describe("Pi controls catalog admission", () => {
|
||||
// Extended v3 states the strict file oracle's task-wide Bash limit.
|
||||
const pi = runnerMatrix.find(c => c.profile.qualificationCandidate === "pi")!.profile;
|
||||
expect(pi.modelQualification?.qualificationId).toBe("pi:0.0.33:1.0.0:openrouter");
|
||||
expect(runnerSuites.find(s => s.id === "pi-native")!.definitionMetadata).toMatchObject({ version: 11, profileVersion: 15, agentMemoryContent: "utf8-nonce-plus-final-lf", agentMemoryPrompt: "ordered-memory-adjacent-internal-qualifier-and-fenced-content", nativeFinish: "current-contract-objective-evidence-refs", providerFaultExecutable: "stable-preinstalled-runner-link-and-snapshot-node-inode-with-held-bootstrap-fd-3-or-7" });
|
||||
expect(runnerSuites.find(s => s.id === "pi-native")!.definitionMetadata).toMatchObject({ version: 12, profileVersion: 15, agentMemoryContent: "utf8-nonce-plus-final-lf", agentMemoryPrompt: "ordered-memory-adjacent-internal-qualifier-and-fenced-content", taskPromptTransport: "fenced-markdown-paste-and-multiline-literal-escapes", nativeFinish: "current-contract-objective-evidence-refs", providerFaultExecutable: "stable-preinstalled-runner-link-and-snapshot-node-inode-with-held-bootstrap-fd-3-or-7" });
|
||||
expect(runnerSuites.find(s => s.id === "pi-controls")!.definitionMetadata).toMatchObject({ version: 8, profileVersion: 15,
|
||||
remoteProcessIdentity: "observer-pid-startTicks-bootId",
|
||||
controlPlaneSettlement: "required-scoped-result-and-terminal-after-runner" });
|
||||
@@ -200,7 +200,7 @@ describe("Pi controls catalog admission", () => {
|
||||
}
|
||||
const hashes = Object.fromEntries(runnerSuites.filter(s => ["pi-native", "native-active-stop", "extended-harnesses", "rich-acp-warm-continuity"].includes(s.id)).map(s => [s.id, suiteDefinitionHash(s)]));
|
||||
expect(hashes).toEqual({
|
||||
"pi-native": "3faa4f2d27835f58cf5437a4d5621d7bb648be6eaeb73a320c1ad8bc0e2eda0f",
|
||||
"pi-native": "7ba2ea4e0007667ef59694c4bdde8f448bbc72f50c705ada64e49ebe69bc943f",
|
||||
"native-active-stop": "99682b2b106d816a011834fae5a944ed7729958893709d5b83a19b6f595e7e4d",
|
||||
"rich-acp-warm-continuity": "036c0faebc2f6eee5cd22ea38887c9c22650a83561fd08ee83473a565b11bb00",
|
||||
"extended-harnesses": "121f4cf75267bcdb003e5ed59e165755b2ac0c3d31c82dc217a62c8abe3d1b4d",
|
||||
|
||||
@@ -27,6 +27,38 @@ it.skipIf(process.platform === "win32")("revalidates PID/start before signaling
|
||||
} finally { f.owner.stopObserving(); }
|
||||
});
|
||||
|
||||
it.skipIf(process.platform === "win32")("admits replacement group members only through a still-owned ancestor", async () => {
|
||||
const f = fixture([row(100, process.pid, 100), row(200, 100, 200)]);
|
||||
try {
|
||||
await f.owner.observe();
|
||||
// The short-lived group leader exited between polls. Its new member is
|
||||
// independently owned through the original, still-live controller.
|
||||
f.replace([row(100, process.pid, 100), row(300, 100, 200)]);
|
||||
await f.owner.signal("SIGKILL");
|
||||
expect(f.signals).toEqual([[200, "SIGKILL"], [100, "SIGKILL"]]);
|
||||
} finally { f.owner.stopObserving(); }
|
||||
});
|
||||
|
||||
it.skipIf(process.platform === "win32")("refuses replacement groups containing any unowned live member", async () => {
|
||||
const f = fixture([row(100, process.pid, 100), row(200, 100, 200)]);
|
||||
try {
|
||||
await f.owner.observe();
|
||||
f.replace([row(100, process.pid, 100), row(300, 100, 200), row(400, 1, 200)]);
|
||||
await expect(f.owner.signal("SIGKILL")).rejects.toThrow("identity became uncertain");
|
||||
expect(f.signals).toEqual([]);
|
||||
} finally { f.owner.stopObserving(); }
|
||||
});
|
||||
|
||||
it.skipIf(process.platform === "win32")("does not use a recycled controller as a replacement member's ownership anchor", async () => {
|
||||
const f = fixture([row(100, process.pid, 100), row(200, 100, 200)]);
|
||||
try {
|
||||
await f.owner.observe();
|
||||
f.replace([row(100, process.pid, 100, "recycled-controller"), row(300, 100, 200)]);
|
||||
await expect(f.owner.signal("SIGKILL")).rejects.toThrow("identity became uncertain");
|
||||
expect(f.signals).toEqual([]);
|
||||
} finally { f.owner.stopObserving(); }
|
||||
});
|
||||
|
||||
it.skipIf(process.platform === "win32")("retains observed descendants when the root exits and excludes the caller group", async () => {
|
||||
const f = fixture([row(100, process.pid, 100), row(200, 100, 200), row(300, 100, 10), row(999, process.pid, 999)]);
|
||||
try {
|
||||
|
||||
@@ -55,10 +55,20 @@ export function createProcessTreeOwner(root: ChildProcess, options: {
|
||||
const rootRow = next.find(row => row.pid === root.pid);
|
||||
if (!rootStarted && !exited()) rootStarted = rootRow?.started;
|
||||
const retained = revalidateObservedProcessGroups(groups, next);
|
||||
// Never acquire a recycled group from its numeric ID alone.
|
||||
const trustedAnchors = retained.flatMap(group => group.members
|
||||
.filter(member => next.some(row => row.pid === member.pid && row.started === member.started
|
||||
&& row.processGroupId === group.processGroupId)).map(member => member.pid));
|
||||
if (rootRow && rootStarted === rootRow.started) trustedAnchors.push(rootRow.pid);
|
||||
const ownedNow = new Set(trustedAnchors.flatMap(pid =>
|
||||
observeDescendantProcessTree(next, pid).members.map(member => member.process.pid)));
|
||||
// A short-lived leader can exit between polls while its replacement
|
||||
// remains a descendant of a separately validated owner. Admit that
|
||||
// ancestry, never a recycled numeric group or a mixed ownership group.
|
||||
const lost = groups.filter(group => !retained.includes(group) && next.some(row => row.processGroupId === group.processGroupId && running(row)));
|
||||
if (lost.length) throw new Error("Owned process group identity became uncertain");
|
||||
const refreshed = refreshContinuouslyLiveProcessGroups(retained, next)
|
||||
const uncertain = lost.filter(group => next.some(row => row.processGroupId === group.processGroupId
|
||||
&& running(row) && !ownedNow.has(row.pid)));
|
||||
if (uncertain.length) throw new Error(`Owned process group identity became uncertain: ${uncertain.map(group => group.processGroupId).join(",")}`);
|
||||
const refreshed = refreshContinuouslyLiveProcessGroups([...retained, ...lost], next)
|
||||
.filter(group => group.processGroupId !== callerGroup);
|
||||
const anchors = refreshed.flatMap(group => group.members.map(member => member.pid));
|
||||
if (rootRow && rootStarted === rootRow.started) anchors.push(rootRow.pid);
|
||||
|
||||
@@ -1,4 +1,22 @@
|
||||
import { expect, type Page } from "@playwright/test";
|
||||
import { expect, type Locator, type Page } from "@playwright/test";
|
||||
|
||||
/** Rich editors interpret pasted Markdown; fill inserts literal paragraph text. */
|
||||
export async function fillTaskPrompt(editor: Locator, prompt: string): Promise<void> {
|
||||
if (!/^ {0,3}(?:`{3,}|~{3,})/m.test(prompt)
|
||||
|| await editor.evaluate(element => element.tagName === "TEXTAREA")) {
|
||||
await editor.fill(prompt);
|
||||
return;
|
||||
}
|
||||
await editor.fill("");
|
||||
await editor.focus();
|
||||
await editor.evaluate((element, text) => {
|
||||
const clipboardData = new DataTransfer();
|
||||
clipboardData.setData("text/plain", text);
|
||||
const event = new ClipboardEvent("paste", { clipboardData, bubbles: true, cancelable: true });
|
||||
element.dispatchEvent(event);
|
||||
if (!event.defaultPrevented) throw new Error("Task editor did not accept the Markdown paste");
|
||||
}, prompt);
|
||||
}
|
||||
|
||||
export async function createTaskThroughUi(input: {
|
||||
page: Page;
|
||||
@@ -34,10 +52,9 @@ export async function createTaskThroughUi(input: {
|
||||
}
|
||||
await newTask.click();
|
||||
await input.page.getByPlaceholder("Task title").fill(input.title);
|
||||
await input.page
|
||||
await fillTaskPrompt(input.page
|
||||
.getByRole("dialog")
|
||||
.getByRole("textbox", { name: "editable markdown", exact: true })
|
||||
.fill(input.prompt);
|
||||
.getByRole("textbox", { name: "editable markdown", exact: true }), input.prompt);
|
||||
if (input.workMode !== "standard") {
|
||||
await input.page
|
||||
.getByRole("dialog")
|
||||
|
||||
Reference in new issue
Block a user