From 0efd70e65bb8971edfd034c0d846868917d7b4d9 Mon Sep 17 00:00:00 2001 From: allocsys <225476909+allocsys@users.noreply.github.com> Date: Thu, 10 Sep 2026 09:30:17 +0330 Subject: [PATCH 1/3] Fix preserve-caught-error lint: attach original 404 error as cause in readFile's rethrow --- connectors/github/editor_tool_functions.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/connectors/github/editor_tool_functions.js b/connectors/github/editor_tool_functions.js index 9815968..29308c6 100644 --- a/connectors/github/editor_tool_functions.js +++ b/connectors/github/editor_tool_functions.js @@ -115,7 +115,8 @@ export async function readFile(owner, repo, path, ref) { if (is404(err)) { throw new Error( `${path} does not exist on branch ${ref} -- double-check the path (it's case-sensitive and relative to the repo root). ` + - `This is not a transient error; retrying the exact same path will not help. If you're creating a new file, skip read_file and call write_file with \`content\` directly.` + `This is not a transient error; retrying the exact same path will not help. If you're creating a new file, skip read_file and call write_file with \`content\` directly.`, + { cause: err } ); } throw err; From 142a5ca1e852dc3a0bc72f7be7fe7cf441b46629 Mon Sep 17 00:00:00 2001 From: allocsys <225476909+allocsys@users.noreply.github.com> Date: Thu, 10 Sep 2026 09:31:25 +0330 Subject: [PATCH 2/3] Update editor-tools test: stop asserting the removed no-PR-merge sentence in the tool description (trimmed in #162); the underlying no-PR-merge behavior is still enforced in code, just no longer restated in the description text --- test/editor-tools.test.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/editor-tools.test.js b/test/editor-tools.test.js index ca79e0c..3d3061f 100644 --- a/test/editor-tools.test.js +++ b/test/editor-tools.test.js @@ -86,7 +86,7 @@ describe("register() -- EDITOR_AGENT_ENABLED gate", () => { expect(server.tool.mock.calls[0][0]).toBe("delegate_editor"); }); - it("the registered tool's description explicitly states the non-default-branch and no-PR-merge scope limits", async () => { + it("the registered tool's description explicitly states the non-default-branch scope limit", async () => { process.env.EDITOR_AGENT_ENABLED = "true"; vi.resetModules(); const { register } = await import("../connectors/delegate/editor/editor_tools.js"); @@ -96,7 +96,6 @@ describe("register() -- EDITOR_AGENT_ENABLED gate", () => { const description = server.tool.mock.calls[0][1]; expect(description).toMatch(/MUST NOT be the repo's default branch/i); - expect(description).toMatch(/CANNOT open, approve, or merge pull requests/i); }); }); From 7644764b2cf6bb9cb2a13093e3626b8fd190468c Mon Sep 17 00:00:00 2001 From: allocsys <225476909+allocsys@users.noreply.github.com> Date: Thu, 10 Sep 2026 09:41:07 +0330 Subject: [PATCH 3/3] Fix delegate_editor 404 error messages: stop telling the agent to "double-check the path" (it has no tool to do so) and stop nudging it toward assuming a missing path means a new file should be created. Both now instruct the agent to stop and report the exact path as unresolved instead of guessing. --- connectors/github/editor_tool_functions.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/connectors/github/editor_tool_functions.js b/connectors/github/editor_tool_functions.js index 29308c6..62be7c7 100644 --- a/connectors/github/editor_tool_functions.js +++ b/connectors/github/editor_tool_functions.js @@ -114,8 +114,7 @@ export async function readFile(owner, repo, path, ref) { } catch (err) { if (is404(err)) { throw new Error( - `${path} does not exist on branch ${ref} -- double-check the path (it's case-sensitive and relative to the repo root). ` + - `This is not a transient error; retrying the exact same path will not help. If you're creating a new file, skip read_file and call write_file with \`content\` directly.`, + `${path} does not exist on branch ${ref}. Path might be mistyped or genuinely never created -- do not guess at a corrected path or assume this means a new file should be created. Stop and report this exact path back as unresolved.`, { cause: err } ); } @@ -251,7 +250,7 @@ export async function writeFile(owner, repo, path, options = {}) { afterContent = content; } else { if (existingContent === undefined) { - throw new Error(`${path} does not exist on branch ${branch} -- replacements mode requires an existing file. Use content mode to create it.`); + throw new Error(`${path} does not exist on branch ${branch}, so replacements mode (which requires an existing file) cannot be used. Do not switch to content mode to create it unless the task explicitly called for creating this file. Otherwise, stop and report this exact path back as unresolved.`); } afterContent = applyReplacements(existingContent, replacements); diff = buildUnifiedDiff(path, existingContent, afterContent);