Keep internal file contents returned in chat inline

Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-10-03 03:10:44 -05:00
1 parent 53923e5adb
commit fef9e84562
4 files changed
+13 -9

No files matched your search

@@ -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
@@ -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);
});
@@ -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)));
});
}
@@ -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));