fix(agents): set isError: false in host edit post-write recovery
When the upstream edit tool throws after writing (e.g. generateDiffString fails), the recovery check correctly returns a success result, but the result object lacked an explicit isError: false field. Explicitly setting isError: false ensures the framework never surfaces a false 'edit failed' notification, even when internal error-handling paths preserve unexpected isError flags from caught exceptions. Also adds an explicit assertion in the existing recovery test that the returned result has isError: false. Fixes #32333 (follow-up)
This commit is contained in:
parent
67da67b61a
commit
d905e4c5d5
@ -63,6 +63,7 @@ export function wrapHostEditToolWithPostWriteRecovery(
|
||||
oldText !== undefined && oldText.length > 0 && content.includes(oldText);
|
||||
if (hasNew && !stillHasOld) {
|
||||
return {
|
||||
isError: false,
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
|
||||
@ -61,6 +61,8 @@ describe("createHostWorkspaceEditTool post-write recovery", () => {
|
||||
: [];
|
||||
const textBlock = content.find((b) => b?.type === "text" && typeof b.text === "string");
|
||||
expect(textBlock?.text).toContain("Successfully replaced text");
|
||||
// isError must be explicitly false so the framework does not surface a false failure notification
|
||||
expect((result as { isError?: unknown }).isError).toBe(false);
|
||||
});
|
||||
|
||||
it("rethrows when file on disk does not contain newText", async () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user