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
Original file line number Diff line number Diff line change
Expand Up @@ -7292,21 +7292,16 @@ describe("AcpAdapterV2", () => {
const event = yield* Queue.take(events);
if (event.type === "turn.terminal" && event.providerTurnId === firstProviderTurnId) break;
}
const snapshotBeforeRollback = yield* runtime.readThreadSnapshot({ providerThread });
// Turns reach orchestration as events; the session keeps no record of them.
assert.deepEqual(snapshotBeforeRollback.providerTurns, []);

const rolledBack = yield* runtime.rollbackThread({
providerThread: { ...providerThread, appThreadId: rollbackThreadId },
providerThreadTurns: snapshotBeforeRollback.providerTurns,
providerThreadTurns: [],
target: {
type: "thread_start",
checkpointId: CheckpointId.make("checkpoint-acp-rollback-session"),
appRunOrdinal: 0,
},
});
assert.isString(rolledBack.providerThread.nativeThreadRef?.nativeId);
assert.deepEqual(rolledBack.providerTurns, []);
assert.equal(
runtimeInputs[1]?.processEnvironment?.T3_ACP_MCP_AUTHORIZATION,
"Bearer rollback-target-token",
Expand All @@ -7330,7 +7325,6 @@ describe("AcpAdapterV2", () => {
const snapshotAfterRollback = yield* runtime.readThreadSnapshot({
providerThread: rolledBack.providerThread,
});
assert.deepEqual(snapshotAfterRollback.providerTurns, []);
assert.deepEqual(snapshotAfterRollback.messages, []);
const sessionEventsBeforeSecondTurn = sessionEventCount;

Expand Down
2 changes: 0 additions & 2 deletions apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15145,7 +15145,6 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
}),
handoffIds: rollbackInput.providerThread.handoffIds,
},
providerTurns: [],
messages: [],
runtimeRequests: [],
};
Expand All @@ -15167,7 +15166,6 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
lastRunOrdinal: rollbackInput.target.appRunOrdinal,
updatedAt: now,
},
providerTurns: [],
messages: [],
runtimeRequests: [],
};
Expand Down
3 changes: 0 additions & 3 deletions apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9179,7 +9179,6 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
nativeConversationHeadRef: threadInput.providerThread.nativeConversationHeadRef,
updatedAt: codexTimestamp(response.thread.updatedAt),
},
providerTurns: [],
messages: [],
runtimeRequests: [],
providerPayload: response.thread,
Expand Down Expand Up @@ -9212,7 +9211,6 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
nativeConversationHeadRef,
status: "idle" as const,
},
providerTurns: [],
messages: [],
runtimeRequests: [],
};
Expand Down Expand Up @@ -9255,7 +9253,6 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
status: "idle" as const,
updatedAt: codexTimestamp(response.thread.updatedAt),
},
providerTurns: [],
messages: [],
runtimeRequests: [],
providerPayload: response.thread,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6873,7 +6873,7 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
}),
);

it.effect("drops the turns a rollback cut from the snapshot it returns", () =>
it.effect("reverts OpenCode at the prompt of the first turn a rollback cuts", () =>
Effect.gen(function* () {
const kept = `msg_t3_turn_${SESSION}:attempt:opencode2-adapter`;
const dropped = `msg_t3_turn_${SESSION}:attempt:opencode2-adapter:2`;
Expand Down Expand Up @@ -6925,7 +6925,7 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
yield* runtime.startTurn(secondTurn(thread));
yield* Deferred.await(bothEnded);
const [first, second] = turns;
const snapshot = yield* runtime.rollbackThread({
yield* runtime.rollbackThread({
providerThread: thread,
target: {
type: "provider_turn",
Expand All @@ -6935,10 +6935,6 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
},
providerThreadTurns: [first!, second!],
});
assert.deepEqual(
snapshot.providerTurns.map((turn) => turn.id),
[first!.id],
);
}),
);

Expand Down Expand Up @@ -6994,10 +6990,7 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
);

it.effect.each([
[
"keeps the recorded turns before the target when rolling back a session not loaded yet",
false,
],
["reverts a session not loaded yet at the first recorded turn after the target", false],
] as const)("%s", ([, running]) =>
Effect.gen(function* () {
const first = `msg_t3_turn_${SESSION}:attempt:first`;
Expand Down Expand Up @@ -7069,10 +7062,6 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
);
} else {
assert.isTrue(Exit.isSuccess(rollback));
assert.deepEqual(
Exit.isSuccess(rollback) ? rollback.value.providerTurns.map((turn) => turn.id) : [],
[kept.id],
);
}
}),
);
Expand Down Expand Up @@ -7360,7 +7349,7 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
],
"msg_external",
);
const snapshot = yield* runtime.rollbackThread({
yield* runtime.rollbackThread({
providerThread: thread,
target: {
type: "provider_turn",
Expand All @@ -7370,10 +7359,6 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
},
providerThreadTurns: [first, second],
});
assert.deepEqual(
snapshot.providerTurns.map((turn) => turn.id),
[first.id],
);
}),
);

Expand Down Expand Up @@ -7872,7 +7857,7 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
yield* runtime.startTurn(continuationTurn(thread, offers[1]!));
yield* Deferred.await(bothEnded);
const [first, continuation] = turns;
const snapshot = yield* runtime.rollbackThread({
yield* runtime.rollbackThread({
providerThread: thread,
target: {
type: "provider_turn",
Expand All @@ -7882,10 +7867,6 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
},
providerThreadTurns: [first!, continuation!],
});
assert.deepEqual(
snapshot.providerTurns.map((turn) => turn.id),
[first!.id],
);
}),
);

Expand Down Expand Up @@ -7994,7 +7975,7 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
yield* runtime.startTurn(continuationTurn(thread, yield* Deferred.await(offered)));
yield* Deferred.await(bothEnded);
const [first, continuation] = turns;
const snapshot = yield* runtime.rollbackThread({
yield* runtime.rollbackThread({
providerThread: thread,
target: {
type: "provider_turn",
Expand All @@ -8004,10 +7985,6 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
},
providerThreadTurns: [first!, continuation!],
});
assert.deepEqual(
snapshot.providerTurns.map((turn) => turn.id),
[first!.id],
);
}),
);

Expand Down
2 changes: 0 additions & 2 deletions packages/provider-acp/src/server/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10696,7 +10696,6 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
updatedAt: now,
},
// Imports read only the transcript; turns reach orchestration as events.
providerTurns: [],
messages,
reasoningMessageIds: [...state.reasoningIds],
runtimeRequests: [],
Expand Down Expand Up @@ -10755,7 +10754,6 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
status: "idle" as const,
updatedAt: now,
},
providerTurns: [],
messages: [],
runtimeRequests: [],
};
Expand Down
1 change: 0 additions & 1 deletion packages/provider-core/src/server/ProviderAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,6 @@ export interface ProviderAdapterV2RuntimeRequestResponseInput {

export interface ProviderAdapterV2ThreadSnapshot {
readonly providerThread: OrchestrationV2ProviderThread;
readonly providerTurns: ReadonlyArray<OrchestrationV2ProviderTurn>;
readonly messages: ReadonlyArray<OrchestrationV2ConversationMessage>;
/** Ids in `messages` that hold the agent's reasoning, not its reply. */
readonly reasoningMessageIds?: ReadonlyArray<OrchestrationV2ConversationMessage["id"]>;
Expand Down
3 changes: 0 additions & 3 deletions packages/provider-cursor/src/server/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3548,7 +3548,6 @@ export const makeCursorAdapterV2 = Effect.fn("makeCursorAdapterV2")(function* (
status: "idle" as const,
updatedAt: now,
},
providerTurns: [],
messages: projectedMessages,
runtimeRequests: [],
providerPayload: {
Expand Down Expand Up @@ -3629,7 +3628,6 @@ export const makeCursorAdapterV2 = Effect.fn("makeCursorAdapterV2")(function* (
status: "idle" as const,
updatedAt: now,
},
providerTurns: [],
messages: [],
runtimeRequests: [],
};
Expand Down Expand Up @@ -3659,7 +3657,6 @@ export const makeCursorAdapterV2 = Effect.fn("makeCursorAdapterV2")(function* (
status: "idle" as const,
updatedAt: now,
},
providerTurns: [],
messages: [],
runtimeRequests: [],
};
Expand Down
1 change: 0 additions & 1 deletion packages/provider-muse/src/server/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2245,7 +2245,6 @@ export const makeMuseAdapterV2 = Effect.fn("makeMuseAdapterV2")(function* (
const now = yield* DateTime.now;
return {
providerThread: current,
providerTurns: [],
messages: items.flatMap((item): OrchestrationV2ConversationMessage[] =>
item.kind === "agentMessage" || item.kind === "userMessage"
? [
Expand Down
Loading
Loading