Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions connectors/github/editor_tool_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ 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 }
);
}
throw err;
Expand Down Expand Up @@ -250,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);
Expand Down
3 changes: 1 addition & 2 deletions test/editor-tools.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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);
});
});

Expand Down
Loading