Fix turn fold proejctions #3041
Mergedjuliusmarmingemerged 3 commits into
main fromrefs/pull/3041/headmerged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/server/src/orchestration/Layers/ProjectionPipeline.ts line 1116Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1110,7 +1198,6 @@11101198 sourceProposedPlanThreadId: null,11111199 sourceProposedPlanId: null,11121200 assistantMessageId: event.payload.messageId,1113- state: event.payload.streaming ? "running" : "completed",1201+ state: settlesTurn ? "completed" : "running",11141202 requestedAt: event.payload.createdAt,11151203 startedAt: event.payload.createdAt,1116- completedAt: event.payload.streaming ? null : event.payload.updatedAt,apps/web/src/components/chat/MessagesTimeline.logic.ts line 217Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -180,8 +202,16 @@180202 if (!turnId) {181203 continue;182204 }183- const group = groupsByTurnId.get(turnId) ?? {184- entries: [],185- terminalEntry: null,186- hasStreamingMessage: false,187- };205+ let group = groupsByTurnId.get(turnId);206+ if (!group) {207+ group = {208+ entries: [],209+ terminalEntry: null,210+ hasStreamingMessage: false,211+ // Each user boundary starts at most one turn; a second turn after the212+ // same user message (e.g. a steer-superseded continuation) falls back213+ // to its own first entry.214+ startBoundary: pendingUserBoundary,215+ };216+ pendingUserBoundary = null;217+ groupsByTurnId.set(turnId, group);
juliusmarminge changed the title
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
- apps/server/src/provider/Layers/CursorAdapter.ts line 1022Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -989,5 +1007,16 @@989- payload: {990- state: result.stopReason === "cancelled" ? "cancelled" : "completed",991- stopReason: result.stopReason ?? null,992- },993- });1007+ // Only the last remaining prompt settles the turn — a steer-1008+ // superseded prompt resolving (usually cancelled) while another is1009+ // in flight or pending must leave the merged turn running.1010+ if (ctx.promptsInFlight === 1) {1011+ yield* offerRuntimeEvent({1012+ type: "turn.completed",1013+ ...(yield* makeEventStamp()),1014+ provider: PROVIDER,1015+ threadId: input.threadId,1016+ turnId,1017+ payload: {1018+ state: result.stopReason === "cancelled" ? "cancelled" : "completed",1019+ stopReason: result.stopReason ?? null,1020+ },1021+ });1022+ }apps/server/src/provider/Layers/CursorAdapter.ts line 919Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -919,0 +899,21 @@899+900+ return yield* Effect.gen(function* () {901+ const turnModelSelection =902+ input.modelSelection?.instanceId === boundInstanceId ? input.modelSelection : undefined;903+ const model = turnModelSelection?.model ?? ctx.session.model;904+ const resolvedModel = resolveCursorAcpBaseModelId(model);905+ yield* applyRequestedSessionConfiguration({906+ runtime: ctx.acp,907+ runtimeMode: ctx.session.runtimeMode,908+ interactionMode: input.interactionMode,909+ modelSelection:910+ model === undefined911+ ? undefined912+ : {913+ model,914+ options: turnModelSelection?.options,915+ },916+ mapError: ({ cause, method }) =>917+ mapAcpToAdapterError(PROVIDER, input.threadId, method, cause),918+ });919+ ctx.activeTurnId = turnId;
- @@ -810,0 +835,21 @@835+ if (ctx.promptsInFlight === 1) {836+ yield* offerRuntimeEvent({837+ type: "turn.completed",838+ ...(yield* makeEventStamp()),839+ provider: PROVIDER,840+ threadId: input.threadId,841+ turnId: prepared.turnId,842+ payload: {843+ state: result.stopReason === "cancelled" ? "cancelled" : "completed",844+ stopReason: result.stopReason ?? null,845+ },846+ });847+ }848+849+ return {850+ threadId: input.threadId,851+ turnId: prepared.turnId,852+ resumeCursor: ctx.session.resumeCursor,853+ };854+ }),855+ );
juliusmarminge merged this57f6bf7
juliusmarminge closed this
Sign in to join this conversation.



Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID:
6873bd87-69da-471d-bf73-a22c551f8e48You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment `@coderabbitai help` to get the list of available commands and usage tips.