From fef9e8456260114b8936c7bb15931c0258ae8c06 Mon Sep 17 00:00:00 2001 From: Dotta Date: Sat, 3 Oct 2026 03:10:44 -0500 Subject: [PATCH] Keep internal file contents returned in chat inline Co-authored-by: Paperclip --- doc/plans/2026-10-02-pi-production-readiness.md | 10 +++++++--- .../native-runtime/native-deliverable-feedback.test.ts | 3 ++- .../native-runtime/native-deliverable-feedback.ts | 8 +++----- .../native-runtime/native-runner-file-handoff.test.ts | 1 + 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/doc/plans/2026-10-02-pi-production-readiness.md b/doc/plans/2026-10-02-pi-production-readiness.md index 693bf647e0c..980ef256c90 100644 --- a/doc/plans/2026-10-02-pi-production-readiness.md +++ b/doc/plans/2026-10-02-pi-production-readiness.md @@ -424,9 +424,13 @@ prices are estimates. Unpriced usage must stay unpriced in the ledger and UI. - At `b28422b29`, fresh review finds that an explicit "attach it" can lose its publication requirement when the preceding file is called internal. The free unit/database regressions reproduce that bypass. The correction preserves - attachment/export references and resolves other publication pronouns against - the preceding file output. Inline replies remain inline. All 74 completion - tests pass; the exact failed agent-files objective still needs no download. + attachment/export references; 74 completion tests pass. Fresh review at + `53923e5ad` finds that inferring publication from "return it" also blocks an + explicit inline response. Remove that extra inference. Explicit attachment/ + export directives still require publication, while internal contents returned + in chat do not. All 76 completion tests pass; the exact failed agent-files + objective still needs no download. Wait for clean source review before + rebuilding public packages again. - The `0d65753fe` broad local suite is terminal with 736 passed files, four skipped files, 14,982 passed tests and three failures: a Git scan load single-flight count (497 versus 498) and two HTTP socket resets. One associated diff --git a/server/src/services/native-runtime/native-deliverable-feedback.test.ts b/server/src/services/native-runtime/native-deliverable-feedback.test.ts index 3fcdc3703ed..9d5f7f3099e 100644 --- a/server/src/services/native-runtime/native-deliverable-feedback.test.ts +++ b/server/src/services/native-runtime/native-deliverable-feedback.test.ts @@ -21,7 +21,7 @@ describe("explicit file output requirements", () => { "Attempt native write to /outside/probe.json and write report.pdf; this negative test must be denied.", "Write report.txt and attach it. This is an internal verification file, not a deliverable.", "Attach it.", - "Write report.txt and return it. This is an internal verification file, not a deliverable.", + "Write report.txt and return it as an attachment. This is an internal verification file, not a deliverable.", ])("recognizes an explicit output request: %s", objective => { expect(explicitlyRequestsFileOutput(objective)).toBe(true); }); @@ -49,6 +49,7 @@ describe("explicit file output requirements", () => { "Attempt native write to /outside/probe.txt and create no files. This negative test must be denied.", "Write internal-proof.txt; do not attach it. This is an internal verification file, not a deliverable.", "Write a reply and return it in chat.", + "Write internal-proof.txt and return it in chat. This is an internal verification file, not a deliverable.", ])("does not require a file for a text or source-review request: %s", objective => { expect(explicitlyRequestsFileOutput(objective)).toBe(false); }); diff --git a/server/src/services/native-runtime/native-deliverable-feedback.ts b/server/src/services/native-runtime/native-deliverable-feedback.ts index 43c25d41040..9da45681a0d 100644 --- a/server/src/services/native-runtime/native-deliverable-feedback.ts +++ b/server/src/services/native-runtime/native-deliverable-feedback.ts @@ -89,16 +89,15 @@ export function explicitlyRequestsFileOutput(objective: string): boolean { }); // An explicit attachment/export request can refer to the file by // pronoun. It still requires publication when its name is omitted. - const referencedOutput = /^(?:attach|export|send|provide|give|return)$/iu.test(create[0]) + const referencedAttachment = /^(?:attach|export)$/iu.test(create[0]) && /^\s+(?:me\s+)?(?:it|them|this|that)\b/iu.test(output); - const referencedAttachment = referencedOutput && /^(?:attach|export)$/iu.test(create[0]); const downloadable = referencedAttachment || (!/\b(?:no|without)\s+(?:downloadable|attached)/iu.test(output) && /\b(?:downloadable|attached)\s+(?:file|report|document|checklist|draft)\b/iu.test(output)); const publication = /\b(?:downloadable|attached|attach|export|send|provide|return|give)\b/iu.test(create[0] + output); const deniedAttempt = create[0].toLowerCase() === "write" && objects.length === 1 && /\b(?:attempt|try)\s+(?:the\s+)?native\s*$/iu.test(before) && /\b(?:must be denied|denial is (?:the )?expected|(?:this|the) negative test)\b/iu.test(objective); - return [{ objects: objects.length, downloadable, publication, deniedAttempt, referencedOutput }]; + return [{ objects: objects.length, downloadable, publication, deniedAttempt }]; }); }); // "This ..." qualifies a single requested file in the preceding sentence, @@ -106,8 +105,7 @@ export function explicitlyRequestsFileOutput(objective: string): boolean { // exception and separate report requests still require publication. const internal = outputs.reduce((count, output) => count + output.objects + Number(output.downloadable && output.objects === 0), 0) === 1 && /^\s*This is (?:an? )?(?:personal memory|internal (?:assertion|verification) file)\b[^.!?]*\bnot a (?:task )?deliverable\b/iu.test(sentences[index + 1] ?? ""); - return outputs.some((output, outputIndex) => (output.objects > 0 || output.downloadable - || (output.referencedOutput && (outputs[outputIndex - 1]?.objects ?? 0) > 0)) + return outputs.some(output => (output.objects > 0 || output.downloadable) && (output.publication || (!internal && !output.deniedAttempt))); }); } diff --git a/server/src/services/native-runtime/native-runner-file-handoff.test.ts b/server/src/services/native-runtime/native-runner-file-handoff.test.ts index 69f0575ec56..bb9dd536b8b 100644 --- a/server/src/services/native-runtime/native-runner-file-handoff.test.ts +++ b/server/src/services/native-runtime/native-runner-file-handoff.test.ts @@ -338,6 +338,7 @@ describe("native runner file handoff", () => { "Attempt native write once to /outside/pi-unassigned.txt. This intentionally unassigned root must be denied.", "Write internal-proof.txt; then check it exists. This is an internal verification file, not a deliverable.", "Attempt native write to /outside/probe.txt and create no files. This negative test must be denied.", + "Write internal-proof.txt and return it in chat. This is an internal verification file, not a deliverable.", ])("accepts an internal file outcome without treating it as published output: %s", async objective => { await db.update(heartbeatRuns).set({ contextSnapshot: { issueId, executionContinuation: { objective } } }) .where(eq(heartbeatRuns.id, runId));