feat(coding-agent): add fork position and duplicate session option (#3431)

This commit is contained in:
Armin Ronacher
2026-04-20 14:13:34 +02:00
committed by GitHub
parent ebc60aa825
commit 23569e304b
10 changed files with 128 additions and 39 deletions

View File

@@ -217,7 +217,7 @@ describe("AgentSessionRuntime characterization", () => {
expect(successResult.selectedText).toBe("hello");
await runtime.session.bindExtensions({});
expect(events).toEqual([
{ type: "session_before_fork", entryId: userMessage.entryId },
{ type: "session_before_fork", entryId: userMessage.entryId, position: "before" },
{ type: "session_start", reason: "fork", previousSessionFile },
]);
@@ -225,7 +225,13 @@ describe("AgentSessionRuntime characterization", () => {
cancelNextFork = true;
const cancelResult = await runtime.fork(userMessage.entryId);
expect(cancelResult).toEqual({ cancelled: true });
expect(events).toEqual([{ type: "session_before_fork", entryId: userMessage.entryId }]);
expect(events).toEqual([{ type: "session_before_fork", entryId: userMessage.entryId, position: "before" }]);
events.length = 0;
cancelNextFork = true;
const cancelAtResult = await runtime.fork("missing-entry", { position: "at" });
expect(cancelAtResult).toEqual({ cancelled: true });
expect(events).toEqual([{ type: "session_before_fork", entryId: "missing-entry", position: "at" }]);
});
it("throws when forking with an invalid entry id", async () => {