fix(runner): exclude skill framing from input size allowance

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-09-16 08:40:38 -05:00
1 parent 78452129ed
commit 82087ac7e1
2 files changed
+13 -3

No files matched your search

@@ -309,11 +309,18 @@ describe("ACPX runtime host", () => {
{ ...options, runtimeContext: context },
dependencies,
);
const message = JSON.stringify({
let message = JSON.stringify({
schema: "paperclip.native-model-envelope.v2",
task: { description: "Use /assigned", prompt: "A new direct user request" },
interactionResponses: index ? [{ response: { status: "accepted" } }] : [],
});
if (index === 1) {
// The provider command is internal overhead, not part of the caller's
// 1 MiB allowance. Keep the exact envelope even at that boundary.
message += " ".repeat(1024 * 1024 - Buffer.byteLength(message));
expect(() => host.startTurn({ text: `${message} `, requestId: "oversized" }))
.toThrow("turn text exceeds its bounded size");
}
host.startTurn({ text: message, requestId: `skill-turn-${index}` });
expect(providerStartTurn).toHaveBeenLastCalledWith({
text: `/assigned ${message}`, requestId: `skill-turn-${index}`,
@@ -649,9 +649,12 @@ export class AcpxRuntimeHost {
throw new Error("ACPX runtime host already has an active turn");
}
const requestId = boundedRequestId(input.requestId);
const text = boundedTurnText(claudeNativeSkillPrompt(
// Bound caller input before adding the provider's assigned-skill command.
// The command is internal framing; it must not consume the envelope's
// allowance or cause an otherwise valid envelope to be truncated/rejected.
const text = claudeNativeSkillPrompt(
boundedTurnText(input.text), this.#claudeSkillNames,
));
);
const turn = this.#runtime.startTurn({
text,
requestId,