@@ -5429,14 +5429,15 @@ describe("ClaudeAdapterV2 background wake turns", () => {
54295429 const rollbackTo = (
54305430 providerThreadTurns: ReadonlyArray<typeof providerTurn>,
54315431 text = "Background task completed.",
5432+ targetTurn = providerTurn,
54325433 ) =>
54335434 harness.runtime.rollbackThread({
54345435 providerThread: harness.providerThread,
54355436 target: {
54365437 type: "provider_turn",
54375438 checkpointId: CheckpointId.make("checkpoint-claude-cursor-subagent-only"),
54385439 appRunOrdinal: 1,
5439- providerTurn,
5440+ providerTurn: targetTurn ,
54405441 message: { role: "user", text, attachments: [] },
54415442 },
54425443 providerThreadTurns,
@@ -5480,6 +5481,38 @@ describe("ClaudeAdapterV2 background wake turns", () => {
54805481 pastSilentTurn.providerThread.nativeConversationHeadRef?.nativeId,
54815482 earlierCursor,
54825483 );
5484+ const interruptedBeforeCompact = yield* rollbackTo(
5485+ [
5486+ {
5487+ ...providerTurn,
5488+ id: ProviderTurnId.make("provider-turn-claude-cursor-earlier"),
5489+ ordinal: 1,
5490+ nativeTurnRef: {
5491+ driver: ClaudeAdapterV2.CLAUDE_PROVIDER,
5492+ nativeId: earlierCursor,
5493+ strength: "weak",
5494+ },
5495+ },
5496+ {
5497+ ...providerTurn,
5498+ id: ProviderTurnId.make("provider-turn-claude-interrupted-before-compact"),
5499+ ordinal: 2,
5500+ status: "interrupted",
5501+ },
5502+ { ...providerTurn, ordinal: 3 },
5503+ {
5504+ ...providerTurn,
5505+ id: ProviderTurnId.make("provider-turn-claude-cursor-next"),
5506+ ordinal: 4,
5507+ },
5508+ ],
5509+ "/compact",
5510+ { ...providerTurn, ordinal: 3 },
5511+ ).pipe(Effect.flip);
5512+ assert.instanceOf(
5513+ interruptedBeforeCompact,
5514+ ProviderAdapter.ProviderAdapterRollbackThreadError,
5515+ );
54835516
54845517 yield* harness.runtime.startTurn(
54855518 makeClaudeTestTurnInput({
0 commit comments