mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-30 09:05:15 +01:00
Report Pi retry failure without claiming execution resumes
The actual patched wrapper now distinguishes successful, failed, and missing retry outcomes. Regressions fail on the previous wrapper and preserve terminal provider failure. Regenerate the wrapper, target closure and profile pins; the previous pack evidence remains historical until rebuilt after the foundation rebase. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
9642ad62c0
commit
3c314413be
8 files changed
+87
-45
No files matched your search
@@ -120,6 +120,10 @@ the optional actual-distribution installation test. The patched-wrapper, real-Pi
|
||||
and distribution-builder Node suites passed all 14 tests with the exact pinned
|
||||
materialized distribution. These focused checks do not establish that full
|
||||
repository checks or PR CI pass after the final foundation rebase.
|
||||
The subsequent retry-status repair passed the same 30 Vitest tests and all 17
|
||||
Node tests, including new successful, failed, and missing-outcome retry cases.
|
||||
The failed and missing-outcome cases were observed failing against the prior
|
||||
wrapper before the repair.
|
||||
|
||||
`test/pi-native-package-contract.test.mjs` runs the real Pi 0.84.2 CLI without
|
||||
credentials. It loads the compiled owned extension, initializes a loopback MCP
|
||||
@@ -185,7 +189,7 @@ change its qualification status or enable admission without required live proof.
|
||||
The default provider pack remains independent of this isolated graph.
|
||||
|
||||
On 2026-09-28 the builder completed a real public-registry installation on macOS
|
||||
arm64 with official Node 24.19.0. The resulting complete distribution passed all nine patched
|
||||
arm64 with official Node 24.19.0. The resulting complete distribution passed all twelve patched
|
||||
wrapper and real Pi admission tests; those tests never submit a model prompt to a
|
||||
provider. Five builder tests cover the full dependency lock, missing/changed
|
||||
packages, missing shrinkwrap entries, resource mutation, escaping links and unsafe
|
||||
@@ -221,7 +225,7 @@ initialization and the missing-credential admission path without a model call.
|
||||
The exact reported `currentModelId` and billable receipt still need credentialed
|
||||
local and Linux/Daytona qualification.
|
||||
|
||||
Profile version 2 declaration digest: `sha256:b18deb44976b92e5e6b4f874f6e28dbbf23b34c917879ee3f7cdc03472919476`. It hashes the versioned
|
||||
Profile version 2 declaration digest: `sha256:5ed73f923b24bf203cf39d6c5dedd5dfd21e94efcb2c2580b4adf53f1b91fd2f`. It hashes the versioned
|
||||
profile domain, patched wrapper source and platform closure pins. Every native
|
||||
closure remains independently checked at launch. Version 1 warm sessions cannot
|
||||
be reused with this integration.
|
||||
@@ -247,7 +251,10 @@ capability fields come from the earlier complete receipt for the unchanged Pi
|
||||
closure. The JSON records that distinction and the correction of a serialization
|
||||
field after the provider had closed. It supersedes the earlier pack proof from
|
||||
`e3658cd0a6d26af63d59201a47039af7e6f33510` and precedes the evidence-retention and
|
||||
this report-only commit. It proves packaged offline admission only; it does not
|
||||
the later retry-status repair. That repair changes the wrapper, all three closure
|
||||
pins, and the profile digest; the retained pack does not prove those new bytes.
|
||||
A fresh pack record is required after the final foundation rebase. The historical
|
||||
record proves packaged offline admission only; it does not
|
||||
claim live model, interaction, or Daytona qualification. Later foundation changes
|
||||
require another pack build and source-pinned admission record.
|
||||
|
||||
@@ -260,9 +267,9 @@ every field in Pi's native event stream. These are explicit follow-ups:
|
||||
does not retain all structured `attempt`, `maxAttempts`, `delayMs`,
|
||||
`errorMessage`, `success`, `finalError`, `reason`, and `willRetry` fields. A
|
||||
follow-up should emit bounded provider notices with source-event provenance
|
||||
and test failed retry completion. The current `auto_retry_end` display says
|
||||
"Retry finished, resuming." even when its `success` field is false; terminal
|
||||
assistant failure still fails the prompt, but this progress copy needs repair.
|
||||
and test its metadata. The `auto_retry_end` display distinguishes explicit
|
||||
success, failure, and unknown outcomes. A patched-process regression covers
|
||||
each result and confirms that terminal assistant failure still fails the prompt.
|
||||
- Native `queue_update` contains steering and follow-up queues. Extension calls
|
||||
acknowledge RPC acceptance, but the wrapper does not project that event into
|
||||
durable queued/delivered state. Do not treat `{accepted: true}` as proof that
|
||||
|
||||
@@ -170,7 +170,7 @@ impl AcpxProviderDescriptor {
|
||||
"0.0.33",
|
||||
Some("@earendil-works/pi-coding-agent"),
|
||||
Some("0.84.2"),
|
||||
"sha256:b18deb44976b92e5e6b4f874f6e28dbbf23b34c917879ee3f7cdc03472919476",
|
||||
"sha256:5ed73f923b24bf203cf39d6c5dedd5dfd21e94efcb2c2580b4adf53f1b91fd2f",
|
||||
),
|
||||
"cursor" => (
|
||||
self.model.as_str(),
|
||||
@@ -2461,7 +2461,7 @@ mod tests {
|
||||
"pi",
|
||||
"pi-acp",
|
||||
"0.0.33",
|
||||
"sha256:b18deb44976b92e5e6b4f874f6e28dbbf23b34c917879ee3f7cdc03472919476",
|
||||
"sha256:5ed73f923b24bf203cf39d6c5dedd5dfd21e94efcb2c2580b4adf53f1b91fd2f",
|
||||
Some("@earendil-works/pi-coding-agent"),
|
||||
Some("0.84.2"),
|
||||
"openrouter/deepseek/deepseek-v4-flash-0731",
|
||||
|
||||
@@ -18,7 +18,7 @@ const patchPath = join(workspaceRoot, "patches/pi-acp@0.0.33.patch");
|
||||
const supportedTargets = new Set(["darwin-arm64", "darwin-x64", "linux-x64"]);
|
||||
export const PI_DISTRIBUTION_PINS = Object.freeze({
|
||||
wrapper: "0.0.33", runtime: "0.84.2", sdk: "0.26.0", zod: "3.25.76", nodeVersion: PI_NODE_VERSION,
|
||||
wrapperSha256: "80c0e302e75b39d71404c69afb2d5182c468ccdee68bfe8b09f1f40e20a47fb4",
|
||||
wrapperSha256: "2eb201c3a931177490a8e18f4a8392f00cbcf21847e9cc171de528da5e253935",
|
||||
helperSha256: "4333d284ff06ab1195e49630041f0b03a486a92fc678100525ad107e0982dba1",
|
||||
});
|
||||
const hash = (bytes) => createHash("sha256").update(bytes).digest("hex");
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* three pins. Never accept a digest supplied only by an installed manifest.
|
||||
*/
|
||||
export const PI_DISTRIBUTION_CLOSURE_SHA256 = Object.freeze({
|
||||
"darwin-arm64": "2fde022b3714c497f352e628789c4dd47b6446351dc69779293b3a0eafcbc17f",
|
||||
"darwin-x64": "049fe566c4844db05187cc7e3e94b813f9a3fa8600d37c344f3b425b8776f743",
|
||||
"linux-x64": "12ff126d91bc296f39bd6c82b52b95dbf8075076e6257bb73256b043f614f391",
|
||||
"darwin-arm64": "c79fa33fd134e860fd777cd467873438b17b80b0b462a89e95cc63fbaa46bada",
|
||||
"darwin-x64": "73624d1f59d55f7654bbe014ca30b55f5d0b3fbb3343467e71105414743a5c1c",
|
||||
"linux-x64": "2f8ae83b42b12e6d4a99e347c245c274f67a2b180ab411441e8fe747fa84d72d",
|
||||
});
|
||||
@@ -54,7 +54,7 @@ export const QUALIFIED_ACPX_PROFILES: Readonly<
|
||||
agentRuntimePackage: "@earendil-works/pi-coding-agent",
|
||||
agentRuntimeVersion: "0.84.2",
|
||||
commandDigest:
|
||||
"sha256:b18deb44976b92e5e6b4f874f6e28dbbf23b34c917879ee3f7cdc03472919476",
|
||||
"sha256:5ed73f923b24bf203cf39d6c5dedd5dfd21e94efcb2c2580b4adf53f1b91fd2f",
|
||||
qualificationModel: "openrouter/deepseek/deepseek-v4-flash-0731",
|
||||
reportedModelId: "openrouter/deepseek/deepseek-v4-flash-0731",
|
||||
permissionPolicy: "interactive",
|
||||
|
||||
@@ -34,6 +34,15 @@ createInterface({ input: process.stdin }).on("line", (line) => {
|
||||
response({ disposition: "started" }); active = true; output({ type: "agent_start" });
|
||||
if (request.message === "die") { process.exit(4); }
|
||||
if (request.message === "long") return;
|
||||
if (["retry-success", "retry-failure", "retry-unknown"].includes(request.message)) {
|
||||
output({ type: "auto_retry_start", attempt: 2, maxAttempts: 2, delayMs: 10, errorMessage: "Fixture provider unavailable" });
|
||||
output({ type: "auto_retry_end", attempt: 2, ...(request.message === "retry-unknown" ? {} : { success: request.message === "retry-success" }) });
|
||||
if (request.message === "retry-failure") {
|
||||
output({ type: "message_end", message: { role: "assistant", timestamp: 2, stopReason: "error", usage: { input: 1, output: 0 } } });
|
||||
active = false; output({ type: "agent_settled" });
|
||||
} else finish("retry outcome received");
|
||||
return;
|
||||
}
|
||||
if (request.message === "auto-compact" || request.message === "retry-compact") { output({ type: "compaction_start", reason: "threshold" }); if (request.message === "retry-compact") output({ type: "summarization_retry_scheduled" }); output({ type: "compaction_end", reason: "threshold", result: compaction(), aborted: false, willRetry: true }); finish("compacted"); return; }
|
||||
if (request.message === "question") { output({ type: "extension_ui_request", id: "question-id", method: "input", title: "Project name", placeholder: "Name" }); return; }
|
||||
if (request.message === "permission") { output({ type: "extension_ui_request", id: "permission-id", method: "select", title: 'paperclip.pi.permission.v1:{"toolCallId":"tool-1","toolName":"bash","input":{"command":"pwd"}}', options: ["Allow once", "Allow for this session", "Deny"] }); return; }
|
||||
|
||||
@@ -123,6 +123,23 @@ test("provider failure is typed and unadmitted slash commands cannot bypass cont
|
||||
await assert.rejects(f.call("session/prompt", { sessionId: session.sessionId, prompt: [{ type: "text", text: "/export /outside/report.html" }] }), /not admitted/);
|
||||
});
|
||||
|
||||
for (const [outcome, expected] of [
|
||||
["success", "Retry finished, resuming."],
|
||||
["failure", "Retry failed; the provider request did not recover."],
|
||||
["unknown", "Retry finished; the provider did not report an outcome."],
|
||||
]) {
|
||||
test(`actual patched ACP retry ${outcome} reports only its stated outcome`, async (t) => {
|
||||
const f = await fixture(t);
|
||||
const session = await f.call("session/new", { cwd: join(f.root, "workspace"), mcpServers: [] });
|
||||
const result = await f.call("session/prompt", { sessionId: session.sessionId, prompt: [{ type: "text", text: `retry-${outcome}` }] });
|
||||
const messages = f.notifications.map((event) => event.params?.update?.content?.text).filter((text) => typeof text === "string");
|
||||
assert.ok(messages.includes(expected));
|
||||
if (outcome !== "success") assert.ok(messages.every((text) => !text.includes("resuming")));
|
||||
if (outcome === "failure") assert.equal(result._meta.jetbrains.air.sessionFailure.severity, "error");
|
||||
else assert.equal(result._meta?.jetbrains?.air?.sessionFailure, undefined);
|
||||
});
|
||||
}
|
||||
|
||||
test("manual and automatic compaction retain Pi 0.84.2 progress and usage", async (t) => {
|
||||
const f = await fixture(t); const session = await f.call("session/new", { cwd: join(f.root, "workspace"), mcpServers: [] });
|
||||
const prompt = (text) => f.call("session/prompt", { sessionId: session.sessionId, prompt: [{ type: "text", text }] });
|
||||
|
||||
+41
-32
@@ -278,22 +278,25 @@
|
||||
break;
|
||||
}
|
||||
case "auto_retry_start": {
|
||||
@@ -1178,24 +1206,22 @@
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -1174,28 +1202,31 @@
|
||||
case "auto_retry_end": {
|
||||
this.emit({
|
||||
sessionUpdate: "agent_message_chunk",
|
||||
- content: { type: "text", text: "Retry finished, resuming." }
|
||||
- });
|
||||
- break;
|
||||
- }
|
||||
- case "auto_compaction_start": {
|
||||
- this.emit({
|
||||
- sessionUpdate: "agent_message_chunk",
|
||||
- content: {
|
||||
- type: "text",
|
||||
content: {
|
||||
type: "text",
|
||||
- text: "Context nearing limit, running automatic compaction..."
|
||||
- }
|
||||
- });
|
||||
+ case "compaction_start": {
|
||||
+ this.emit({ sessionUpdate: "agent_message_chunk", content: {
|
||||
+ type: "text", text: ev.reason === "manual" ? "Compacting context..." : "Context nearing limit, running automatic compaction..."
|
||||
+ } });
|
||||
+ text: ev.success === true ? "Retry finished, resuming."
|
||||
+ : ev.success === false ? "Retry failed; the provider request did not recover."
|
||||
+ : "Retry finished; the provider did not report an outcome."
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
- case "auto_compaction_end": {
|
||||
@@ -304,6 +307,12 @@
|
||||
- text: "Automatic compaction finished; context was summarized to continue the session."
|
||||
- }
|
||||
- });
|
||||
+ case "compaction_start": {
|
||||
+ this.emit({ sessionUpdate: "agent_message_chunk", content: {
|
||||
+ type: "text", text: ev.reason === "manual" ? "Compacting context..." : "Context nearing limit, running automatic compaction..."
|
||||
+ } });
|
||||
+ break;
|
||||
+ }
|
||||
+ case "compaction_end": {
|
||||
+ (this.pendingTurn ? this.turnUsage : this.manualCompactionUsage)?.acceptCompaction(ev.result);
|
||||
+ this.emit({ sessionUpdate: "agent_message_chunk", content: {
|
||||
@@ -317,7 +326,7 @@
|
||||
break;
|
||||
}
|
||||
case "agent_start": {
|
||||
@@ -1210,9 +1236,12 @@
|
||||
@@ -1210,9 +1241,12 @@
|
||||
break;
|
||||
}
|
||||
case "agent_settled": {
|
||||
@@ -331,7 +340,7 @@
|
||||
this.pendingTurn = null;
|
||||
this.inAgentLoop = false;
|
||||
const next = this.turnQueue.shift();
|
||||
@@ -1725,6 +1754,7 @@
|
||||
@@ -1725,6 +1759,7 @@
|
||||
return process.env.PI_CODING_AGENT_DIR ? resolve3(process.env.PI_CODING_AGENT_DIR) : join4(homedir4(), ".pi", "agent");
|
||||
}
|
||||
function getEnableSkillCommands(cwd) {
|
||||
@@ -339,7 +348,7 @@
|
||||
const merged = getMergedSettings(cwd);
|
||||
const direct = merged.enableSkillCommands;
|
||||
if (typeof direct === "boolean") return direct;
|
||||
@@ -1733,6 +1763,7 @@
|
||||
@@ -1733,6 +1768,7 @@
|
||||
return true;
|
||||
}
|
||||
function getQuietStartup(cwd) {
|
||||
@@ -347,7 +356,7 @@
|
||||
const merged = getMergedSettings(cwd);
|
||||
const direct = merged.quietStartup;
|
||||
if (typeof direct === "boolean") return direct;
|
||||
@@ -1824,6 +1855,7 @@
|
||||
@@ -1824,6 +1860,7 @@
|
||||
const out = [];
|
||||
const seen = /* @__PURE__ */ new Set();
|
||||
for (const c of [...a, ...b]) {
|
||||
@@ -355,7 +364,7 @@
|
||||
if (seen.has(c.name)) continue;
|
||||
seen.add(c.name);
|
||||
out.push(c);
|
||||
@@ -1884,11 +1916,13 @@
|
||||
@@ -1884,11 +1921,13 @@
|
||||
throw RequestError3.invalidParams(`Unknown sessionId: ${sessionId}`);
|
||||
}
|
||||
const cwd = opts?.cwd ?? stored.cwd;
|
||||
@@ -369,7 +378,7 @@
|
||||
piCommand: process.env.PI_ACP_PI_COMMAND
|
||||
});
|
||||
} catch (e) {
|
||||
@@ -1897,7 +1931,7 @@
|
||||
@@ -1897,7 +1936,7 @@
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
@@ -378,7 +387,7 @@
|
||||
const session = this.sessions.getOrCreate(sessionId, {
|
||||
cwd,
|
||||
mcpServers: opts?.mcpServers ?? [],
|
||||
@@ -1917,6 +1951,7 @@
|
||||
@@ -1917,6 +1956,7 @@
|
||||
}
|
||||
}
|
||||
async initialize(params) {
|
||||
@@ -386,7 +395,7 @@
|
||||
const supportedVersion = 1;
|
||||
const requested = params.protocolVersion;
|
||||
return {
|
||||
@@ -1933,7 +1968,8 @@
|
||||
@@ -1933,7 +1973,8 @@
|
||||
}),
|
||||
agentCapabilities: {
|
||||
loadSession: true,
|
||||
@@ -396,7 +405,7 @@
|
||||
promptCapabilities: {
|
||||
image: true,
|
||||
audio: false,
|
||||
@@ -1942,8 +1978,7 @@
|
||||
@@ -1942,8 +1983,7 @@
|
||||
sessionCapabilities: {
|
||||
// **UNSTABLE** ACP capability used by Zed's codex-acp adapter.
|
||||
// Enables a native session picker in clients that support it.
|
||||
@@ -406,7 +415,7 @@
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1953,7 +1988,7 @@
|
||||
@@ -1953,7 +1993,7 @@
|
||||
throw RequestError3.invalidParams(`cwd must be an absolute path: ${params.cwd}`);
|
||||
}
|
||||
this.lastSessionCwd = params.cwd;
|
||||
@@ -415,7 +424,7 @@
|
||||
const enableSkillCommands = getEnableSkillCommands(params.cwd);
|
||||
const session = await this.sessions.create({
|
||||
cwd: params.cwd,
|
||||
@@ -1994,14 +2029,14 @@
|
||||
@@ -1994,14 +2034,14 @@
|
||||
this.cleanupFailedNewSession(session.sessionId, state);
|
||||
throw RequestError3.authRequired(
|
||||
{ authMethods: getAuthMethods() },
|
||||
@@ -432,7 +441,7 @@
|
||||
);
|
||||
}
|
||||
const { configOptions, models, modes } = await getSessionConfiguration(session.proc, {
|
||||
@@ -2064,34 +2099,27 @@
|
||||
@@ -2064,34 +2104,27 @@
|
||||
}
|
||||
async prompt(params) {
|
||||
const session = await this.restoreSession(params.sessionId);
|
||||
@@ -479,7 +488,7 @@
|
||||
}
|
||||
if (cmd === "session") {
|
||||
const stats = await session.proc.getSessionStats();
|
||||
@@ -2432,8 +2460,18 @@
|
||||
@@ -2432,8 +2465,18 @@
|
||||
}
|
||||
}
|
||||
const result = await session.prompt(message, images);
|
||||
@@ -500,7 +509,7 @@
|
||||
}
|
||||
async cancel(params) {
|
||||
const session = this.sessions.maybeGet(params.sessionId);
|
||||
@@ -2473,7 +2511,7 @@
|
||||
@@ -2473,7 +2516,7 @@
|
||||
mcpServers: params.mcpServers
|
||||
});
|
||||
const proc = session.proc;
|
||||
@@ -509,7 +518,7 @@
|
||||
this.sessions.closeAllExcept?.(session.sessionId);
|
||||
this.store.upsert({
|
||||
sessionId: params.sessionId,
|
||||
@@ -2607,6 +2645,7 @@
|
||||
@@ -2607,6 +2650,7 @@
|
||||
return response;
|
||||
}
|
||||
async deleteSession(params) {
|
||||
@@ -517,7 +526,7 @@
|
||||
const stored = this.store.get(params.sessionId);
|
||||
const piSession = findPiSession(params.sessionId);
|
||||
if (!stored && !piSession) {
|
||||
@@ -2828,6 +2867,7 @@
|
||||
@@ -2828,6 +2872,7 @@
|
||||
return 0;
|
||||
}
|
||||
function buildUpdateNotice() {
|
||||
@@ -525,7 +534,7 @@
|
||||
try {
|
||||
const piVersion = spawnSync("pi", ["--version"], { encoding: "utf-8" });
|
||||
const installed = (String(piVersion.stdout ?? "").trim() || String(piVersion.stderr ?? "").trim()).replace(
|
||||
@@ -2848,6 +2888,7 @@
|
||||
@@ -2848,6 +2893,7 @@
|
||||
}
|
||||
}
|
||||
function buildStartupInfo(opts) {
|
||||
@@ -533,7 +542,7 @@
|
||||
void opts.fileCommands;
|
||||
const md = [];
|
||||
try {
|
||||
@@ -2980,6 +3021,7 @@
|
||||
@@ -2980,6 +3026,7 @@
|
||||
|
||||
// src/index.ts
|
||||
if (process.argv.includes("--terminal-login")) {
|
||||
@@ -541,7 +550,7 @@
|
||||
const { spawnSync: spawnSync2 } = await import("child_process");
|
||||
const cmd = getPiCommand(process.env.PI_ACP_PI_COMMAND);
|
||||
const res = spawnSync2(cmd, [], {
|
||||
@@ -3019,11 +3061,12 @@
|
||||
@@ -3019,11 +3066,12 @@
|
||||
}
|
||||
});
|
||||
var stream = ndJsonStream(input, output);
|
||||
@@ -556,7 +565,7 @@
|
||||
} catch {
|
||||
}
|
||||
try {
|
||||
--- a/dist/paperclip-runtime.js
|
||||
--- /dev/null
|
||||
+++ b/dist/paperclip-runtime.js
|
||||
@@ -0,0 +1,283 @@
|
||||
+/** Source for the helper embedded in patches/pi-acp@0.0.33.patch. */
|
||||
|
||||
Reference in new issue
Block a user