Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

fix(eve): accept create responses from protocol-1 remote agents (#4490)

roboeve[bot]32aaf686bc90
diff --git a/.changeset/accept-protocol-1-remotes.md b/.changeset/accept-protocol-1-remotes.md
new file mode 100644
index 000000000..b914737c1
--- /dev/null
+++ b/.changeset/accept-protocol-1-remotes.md
@@ -0,0 +1,5 @@
+---
+"eve": patch
+---
+
+Accept create-session responses from remote agents on eve 0.66–0.68 (protocol 1). A newer parent no longer fails a call that the older remote already accepted and is running.
diff --git a/docs/guides/remote-agents.md b/docs/guides/remote-agents.md
index 6f23f5279..54874f2e8 100644
--- a/docs/guides/remote-agents.md
+++ b/docs/guides/remote-agents.md
@@ -215,7 +215,7 @@ Cancelling the parent turn or the agent task with `eve__task_cancel` also cancel
When the workflow run that opened a remote child finishes, eve sends an authenticated `POST /eve/v1/session/:childSessionId/reset` for it. An agent task's run finishes when the parent session ends. Reset retires the parked remote session and recursively cleans up its descendants. The request uses freshly resolved `headers` and `auth`; failures are logged so an unreachable remote cannot block parent finalization.
-The parent names its eve remote agent protocol version when it creates the child, and the remote answers with the version it serves. A remote also serves parents on protocol 1 (eve 0.66 through 0.68), including their approvals and sign-in requests, so upgrade remote agents before their callers; see [Upgrade remote agents before their callers](../tools/tasks-upgrade#upgrade-remote-agents-before-their-callers). Any other mismatch fails the call at start with an error naming both versions. A failed _start_ fails the call immediately. After a remote starts, a terminal failure callback fails the call with the remote's error. Terminal callback delivery runs as a durable step on the underlying workflow engine (see [Execution model & durability](../concepts/execution-model-and-durability)). A failed callback POST is rethrown rather than completing the call, so the engine retries it.
+The parent names its eve remote agent protocol version when it creates the child, and the remote answers with the version it serves. A remote also serves parents on protocol 1 (eve 0.66 through 0.68), including their approvals and sign-in requests, so upgrade remote agents before their callers; see [Upgrade remote agents before their callers](../tools/tasks-upgrade#upgrade-remote-agents-before-their-callers). A parent accepts a protocol-1 remote's results and failures, but that remote's approvals and sign-in requests don't reach the parent. Any other mismatch fails the call at start with an error naming both versions. A failed _start_ fails the call immediately. After a remote starts, a terminal failure callback fails the call with the remote's error. Terminal callback delivery runs as a durable step on the underlying workflow engine (see [Execution model & durability](../concepts/execution-model-and-durability)). A failed callback POST is rethrown rather than completing the call, so the engine retries it.
If a remote accepts the create request but its response has an incompatible
protocol or an unreadable body, the work may have completed. eve stops workflow
diff --git a/packages/eve/src/execution/agent-sessions/remote.test.ts b/packages/eve/src/execution/agent-sessions/remote.test.ts
index 48c60f1f5..2f3ff0500 100644
--- a/packages/eve/src/execution/agent-sessions/remote.test.ts
+++ b/packages/eve/src/execution/agent-sessions/remote.test.ts
@@ -194,6 +194,26 @@ describe("startRemoteAgentSession", () => {
});
});
+ it("accepts an unversioned (protocol 1) remote's create response", async () => {
+ vi.stubGlobal(
+ "fetch",
+ vi
+ .fn()
+ .mockResolvedValue(
+ Response.json({ ok: true, sessionId: "legacy-session", status: "accepted" }),
+ ),
+ );
+
+ await expect(
+ startRemoteAgentSession({
+ action: createAction(),
+ callbackBaseUrl: "https://caller.example.com",
+ remote: createRemoteAgent(),
+ session: { continuationToken: "eve:parent-token" },
+ }),
+ ).resolves.toEqual({ sessionId: "legacy-session" });
+ });
+
it.each([true, false])(
"preserves configured headers unless context replaces them (%s)",
async (hasContext) => {
diff --git a/packages/eve/src/execution/agent-sessions/remote.ts b/packages/eve/src/execution/agent-sessions/remote.ts
index 8bc759139..6e1089a3e 100644
--- a/packages/eve/src/execution/agent-sessions/remote.ts
+++ b/packages/eve/src/execution/agent-sessions/remote.ts
@@ -5,6 +5,7 @@ import { ResetResponseSchema, type ResetResponse } from "#protocol/reset-session
import {
REMOTE_AGENT_PROTOCOL_MISMATCH,
REMOTE_AGENT_PROTOCOL_VERSION,
+ UNVERSIONED_REMOTE_AGENT_PROTOCOL,
formatRemoteAgentProtocolMismatch,
readRemoteAgentProtocolVersion,
} from "#protocol/remote-agent-protocol.js";
@@ -182,7 +183,11 @@ export async function startRemoteAgentSession(input: {
);
}
const receiverVersion = readRemoteAgentProtocolVersion(parsed.data.protocolVersion);
- if (receiverVersion !== REMOTE_AGENT_PROTOCOL_VERSION) {
+ // A protocol-1 remote already accepted the work and settles it with the same result callbacks.
+ if (
+ receiverVersion !== REMOTE_AGENT_PROTOCOL_VERSION &&
+ receiverVersion !== UNVERSIONED_REMOTE_AGENT_PROTOCOL
+ ) {
throw new FatalError(
`${formatRemoteAgentProtocolMismatch({ name: input.action.remoteAgentName, receiverVersion })} ${UNKNOWN_REMOTE_OUTCOME} Remote session: ${parsed.data.sessionId}.`,
);
diff --git a/packages/eve/src/protocol/remote-agent-protocol.ts b/packages/eve/src/protocol/remote-agent-protocol.ts
index 94d31de03..304916a07 100644
--- a/packages/eve/src/protocol/remote-agent-protocol.ts
+++ b/packages/eve/src/protocol/remote-agent-protocol.ts
@@ -9,7 +9,8 @@ export const REMOTE_AGENT_PROTOCOL_VERSION = 2;
/** Error code a receiver answers when the caller speaks another protocol version. */
export const REMOTE_AGENT_PROTOCOL_MISMATCH = "REMOTE_AGENT_PROTOCOL_MISMATCH";
-const UNVERSIONED_REMOTE_AGENT_PROTOCOL = 1;
+/** Protocol of eve 0.66–0.68, which sent no version. */
+export const UNVERSIONED_REMOTE_AGENT_PROTOCOL = 1;
/** Reads a peer's protocol version, treating an absent one as the unversioned protocol. */
export function readRemoteAgentProtocolVersion(value: unknown): number {