From 3ee2b7f16b595a5a0c974bb3c22dd1ffa9d465d6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 19 Apr 2026 22:13:19 +0000 Subject: [PATCH 1/2] Initial plan From 0b673cfa21d69b8f120c8f0febb13bd92cbc99df Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 19 Apr 2026 22:28:58 +0000 Subject: [PATCH 2/2] fix(js): make copilot driver appendFileSync typing Node-compatible Agent-Logs-Url: https://github.com/github/gh-aw/sessions/57405e7e-6c6c-4992-a1ec-8d20efc533ed Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- actions/setup/js/copilot_driver.cjs | 12 ++---------- actions/setup/js/copilot_driver.test.cjs | 6 +++--- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/actions/setup/js/copilot_driver.cjs b/actions/setup/js/copilot_driver.cjs index a66511be843..e0bf2c038c8 100644 --- a/actions/setup/js/copilot_driver.cjs +++ b/actions/setup/js/copilot_driver.cjs @@ -62,15 +62,7 @@ const MODEL_NOT_SUPPORTED_PATTERN = /The requested model is not supported/; const NO_AUTH_INFO_PATTERN = /No authentication information found/; /** - * @typedef {(path: import("node:fs").PathOrFileDescriptor, data: string | Uint8Array, options?: import("node:fs").WriteFileOptions) => void} NodeAppendFileSync - */ - -/** - * @typedef {(path: string, data: string, encoding: string) => void} StringAppendLineWriter - */ - -/** - * @typedef {NodeAppendFileSync | StringAppendLineWriter} AppendFileSyncLike + * @typedef {(path: import("node:fs").PathOrFileDescriptor, data: string | Uint8Array, options?: import("node:fs").WriteFileOptions) => void} AppendFileSyncLike */ /** @@ -154,7 +146,7 @@ function buildInfrastructureIncompletePayload(details) { * @param {string} payload */ function appendSafeOutputLine(appendFileSync, safeOutputsPath, payload) { - appendFileSync(safeOutputsPath, payload + "\n", "utf8"); + appendFileSync(safeOutputsPath, payload + "\n", { encoding: "utf8" }); } /** diff --git a/actions/setup/js/copilot_driver.test.cjs b/actions/setup/js/copilot_driver.test.cjs index 367c39c53e4..7ee562823be 100644 --- a/actions/setup/js/copilot_driver.test.cjs +++ b/actions/setup/js/copilot_driver.test.cjs @@ -151,9 +151,9 @@ describe("copilot_driver.cjs", () => { it("appends one JSONL line through appendSafeOutputLine", () => { const writes = []; - const appendStub = (file, data, encoding) => writes.push({ file, data, encoding }); + const appendStub = (file, data, options) => writes.push({ file, data, options }); appendSafeOutputLine(appendStub, "/tmp/safeoutputs.jsonl", '{"type":"report_incomplete"}'); - expect(writes).toEqual([{ file: "/tmp/safeoutputs.jsonl", data: '{"type":"report_incomplete"}\n', encoding: "utf8" }]); + expect(writes).toEqual([{ file: "/tmp/safeoutputs.jsonl", data: '{"type":"report_incomplete"}\n', options: { encoding: "utf8" } }]); }); it("emitInfrastructureIncomplete writes payload when path is configured", () => { @@ -161,7 +161,7 @@ describe("copilot_driver.cjs", () => { const logs = []; emitInfrastructureIncomplete("temporary outage", { safeOutputsPath: "/tmp/safeoutputs.jsonl", - appendFileSync: (file, data, encoding) => writes.push({ file, data, encoding }), + appendFileSync: (file, data, options) => writes.push({ file, data, options }), logger: message => logs.push(message), }); expect(writes).toHaveLength(1);