Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Improve error detection for `read` and `edit` observations (#7090)

Ryan H. Trancb61282c3940
diff --git a/frontend/src/services/observations.ts b/frontend/src/services/observations.ts
index 161f867f0d..9760e0c804 100644
--- a/frontend/src/services/observations.ts
+++ b/frontend/src/services/observations.ts
@@ -95,6 +95,7 @@ export function handleObservationMessage(message: ObservationMessage) {
observation,
extras: {
path: String(message.extras.path || ""),
+ impl_source: String(message.extras.impl_source || ""),
},
}),
);
@@ -107,6 +108,7 @@ export function handleObservationMessage(message: ObservationMessage) {
extras: {
path: String(message.extras.path || ""),
diff: String(message.extras.diff || ""),
+ impl_source: String(message.extras.impl_source || ""),
},
}),
);
diff --git a/frontend/src/state/chat-slice.ts b/frontend/src/state/chat-slice.ts
index 6b1be063f2..8a0bc20d39 100644
--- a/frontend/src/state/chat-slice.ts
+++ b/frontend/src/state/chat-slice.ts
@@ -159,9 +159,16 @@ export const chatSlice = createSlice({
.includes("error:");
} else if (observationID === "read" || observationID === "edit") {
// For read/edit operations, we consider it successful if there's content and no error
- causeMessage.success =
- observation.payload.content.length > 0 &&
- !observation.payload.content.toLowerCase().includes("error:");
+
+ if (observation.payload.extras.impl_source === "oh_aci") {
+ causeMessage.success =
+ observation.payload.content.length > 0 &&
+ !observation.payload.content.startsWith("ERROR:\n");
+ } else {
+ causeMessage.success =
+ observation.payload.content.length > 0 &&
+ !observation.payload.content.toLowerCase().includes("error:");
+ }
}
if (observationID === "run" || observationID === "run_ipython") {
diff --git a/frontend/src/types/core/observations.ts b/frontend/src/types/core/observations.ts
index 4d1494a318..30ecbde9af 100644
--- a/frontend/src/types/core/observations.ts
+++ b/frontend/src/types/core/observations.ts
@@ -63,6 +63,7 @@ export interface ReadObservation extends OpenHandsObservationEvent<"read"> {
source: "agent";
extras: {
path: string;
+ impl_source: string;
};
}
@@ -71,6 +72,7 @@ export interface EditObservation extends OpenHandsObservationEvent<"edit"> {
extras: {
path: string;
diff: string;
+ impl_source: string;
};
}