GeezerVison is showing github.com — Merge upstream/main after #43278 · pingdotgg/t3code@3fc25db
File treeExpand file treeCollapse file tree Open diff view settings provider-cursor/src/server
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: apps/server/src/htmlRender/HtmlRender.test.ts +7Lines changed: 7 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -105,13 +105,20 @@ describe("HtmlRender", () => { | 105 | 105 | "<style media=screen>main{height: calc(100dvh - 2rem)}", | 106 | 106 | "<div style='top:.5svh'></div>", | 107 | 107 | "<div style=height:100vh></div>", | | 108 | + "<style>main{min-height:100vmax}</style>", | | 109 | + "<div style='height:calc(100dvmax - 1rem)'></div>", | | 110 | + "<style>main{block-size:100vb}</style>", | | 111 | + "<div style='margin-top:-50vh'></div>", | 108 | 112 | ]) { | 109 | 113 | const error = yield* htmlRender.prepare(page).pipe(Effect.flip); | 110 | 114 | expect(error).toBeInstanceOf(HtmlRender.HtmlRenderViewportHeightError); | 111 | 115 | } | 112 | 116 | yield* htmlRender.prepare( | 113 | 117 | '<style>main{width:100vw;height:320px}</style><img src="data:image/png;base64,AB1vh+2vh/3vhC">', | 114 | 118 | ); | | 119 | + yield* htmlRender.prepare( | | 120 | + '<style>.h-100vmax,.min-h-100vb{height:200px}</style><main class="h-100vmax">hi</main>', | | 121 | + ); | 115 | 122 | yield* htmlRender.prepare( | 116 | 123 | "<p>Avoid 100vh here.</p><!-- <div style=\"height:100vh\"></div> --><script>const unit = '100vh';</script>", | 117 | 124 | ); | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/htmlRender/HtmlRender.ts +5-2Lines changed: 5 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -105,8 +105,11 @@ export class HtmlRenderViewportHeightError extends Schema.TaggedError<HtmlRender | 105 | 105 | // Consume unclosed comments, tags, or quotes through EOF to keep both patterns linear. | 106 | 106 | const CSS_SOURCE = | 107 | 107 | /<!--[\s\S]*?(?:-->|$)|<style\b[^>]*(?:>|$)([\s\S]*?)(?:<\/style\s*>|$)|\sstyle\s*=\s*(?:"([^"]*)(?:"|$)|'([^']*)(?:'|$)|([^\s>]+))/gi; | 108 | | -// The lookbehind skips base64 runs, such as an inlined image that happens to contain "1vh". | 109 | | -const VIEWPORT_HEIGHT_UNIT = /(?<![\w.+/])(?:\d+(?:\.\d+)?|\.\d+)[sld]?vh(?![\w-])/i; | | 108 | +// vb and vmax follow the frame height too; vmin stays, as the frame width caps it. | | 109 | +// The lookbehind skips base64 runs, such as an inlined image that happens to contain "1vh", | | 110 | +// and identifiers such as the class `.h-100vmax`, while a negative `-50vh` still counts. | | 111 | +const VIEWPORT_HEIGHT_UNIT = | | 112 | + /(?<![\w.+/]|[\w-]-)(?:\d+(?:\.\d+)?|\.\d+)[sld]?v(?:h|b|max)(?![\w-])/i; | 110 | 113 |
| 111 | 114 | const rejectViewportHeight = (html: string) => { | 112 | 115 | for (const [, sheet, doubleQuoted, singleQuoted, unquoted] of html.matchAll(CSS_SOURCE)) { | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/ProviderTurnStartService.ts +36-23Lines changed: 36 additions & 23 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -154,12 +154,11 @@ export function abandonedProviderTurns( | 154 | 154 | const CUT_TURN_SETTLED = "cut-turn-settled"; | 155 | 155 |
| 156 | 156 | /** | 157 | | - * The latest cancelled or stopped turn when no adapter said whether it kept the request. A restart | 158 | | - * cancels the turn with no adapter left to tell. A Stop leaves its request with the session, which | 159 | | - * carries it into the next turn and is gone once the session closes. Later runs whose request the | 160 | | - * provider never got are passed over: a stopped request they carried was lost with them. | | 157 | + * The latest cancelled or interrupted turn when no adapter said whether it kept the request. Later | | 158 | + * runs whose request the provider never got are passed over, since a session carries a stopped | | 159 | + * request into the next turn and anything they carried was lost with them. | 161 | 160 | */ | 162 | | -function unsettledCutProviderTurn( | | 161 | +function unsettledStoppedProviderTurn( | 163 | 162 | projection: Pick<OrchestrationV2ThreadProjection, "runs" | "providerTurns">, | 164 | 163 | run: Pick<OrchestrationV2Run, "ordinal">, | 165 | 164 | providerThread: Pick<OrchestrationV2ProviderThread, "id" | "nativeThreadRef">, | @@ -1014,6 +1013,7 @@ export const layer: Layer.Layer< | 1014 | 1013 | // restart superseded, and the session cannot be reused until those turns stop. | 1015 | 1014 | const abandonedTurns = abandonedProviderTurns(projection, run, providerThread.id); | 1016 | 1015 | const abandonedTurn = abandonedTurns.at(-1)?.turn; | | 1016 | + let providerTurns = projection.providerTurns; | 1017 | 1017 | if (abandonedTurn !== undefined) { | 1018 | 1018 | const liveSession = yield* providerSessions.get(providerSessionId); | 1019 | 1019 | if (Option.isSome(liveSession)) { | @@ -1038,27 +1038,32 @@ export const layer: Layer.Layer< | 1038 | 1038 | } | 1039 | 1039 | } | 1040 | 1040 | const completedAt = yield* DateTime.now; | | 1041 | + const repairEvents = yield* Effect.forEach(abandonedTurns, ({ turn, run: abandonedRun }) => | | 1042 | + Effect.gen(function* () { | | 1043 | + return { | | 1044 | + id: yield* idAllocator.allocate.event({ threadId: projection.thread.id }), | | 1045 | + type: "provider-turn.updated" as const, | | 1046 | + threadId: projection.thread.id, | | 1047 | + runId: abandonedRun.id, | | 1048 | + nodeId: turn.nodeId, | | 1049 | + providerInstanceId: abandonedRun.providerInstanceId, | | 1050 | + occurredAt: completedAt, | | 1051 | + payload: { ...turn, status: "interrupted" as const, completedAt }, | | 1052 | + }; | | 1053 | + }), | | 1054 | + ); | 1041 | 1055 | const repaired = yield* eventSink.writeIfRunCurrent({ | 1042 | 1056 | threadId: projection.thread.id, | 1043 | 1057 | runId: run.id, | 1044 | 1058 | activeAttemptId: attempt.id, | 1045 | 1059 | expectedStatus: "starting", | 1046 | | - events: yield* Effect.forEach(abandonedTurns, ({ turn, run: abandonedRun }) => | 1047 | | - Effect.gen(function* () { | 1048 | | - return { | 1049 | | - id: yield* idAllocator.allocate.event({ threadId: projection.thread.id }), | 1050 | | - type: "provider-turn.updated" as const, | 1051 | | - threadId: projection.thread.id, | 1052 | | - runId: abandonedRun.id, | 1053 | | - nodeId: turn.nodeId, | 1054 | | - providerInstanceId: abandonedRun.providerInstanceId, | 1055 | | - occurredAt: completedAt, | 1056 | | - payload: { ...turn, status: "interrupted" as const, completedAt }, | 1057 | | - }; | 1058 | | - }), | 1059 | | - ), | | 1060 | + events: repairEvents, | 1060 | 1061 | }); | 1061 | 1062 | if (!repaired.committed) return; | | 1063 | + const repairedTurns = new Map( | | 1064 | + repairEvents.map((event) => [event.payload.id, event.payload]), | | 1065 | + ); | | 1066 | + providerTurns = providerTurns.map((turn) => repairedTurns.get(turn.id) ?? turn); | 1062 | 1067 | } | 1063 | 1068 | // Opening a session does not prompt the provider, so the workspace is still unchanged. | 1064 | 1069 | const baseline = yield* runExecution.forkBaseline({ | @@ -1108,7 +1113,11 @@ export const layer: Layer.Layer< | 1108 | 1113 | } | 1109 | 1114 | const session = sessionResult.success; | 1110 | 1115 | if (!(yield* isCurrentAttemptInStatus("starting"))) return; | 1111 | | - const cutTurn = unsettledCutProviderTurn(projection, run, providerThread); | | 1116 | + const cutTurn = unsettledStoppedProviderTurn( | | 1117 | + { runs: projection.runs, providerTurns }, | | 1118 | + run, | | 1119 | + providerThread, | | 1120 | + ); | 1112 | 1121 | // A cut turn the provider did not keep may itself have carried an earlier stopped request, | 1113 | 1122 | // which is lost with it, so keep asking back to a turn the provider kept. | 1114 | 1123 | const droppedCutTurns: Array<NonNullable<typeof cutTurn>> = []; | @@ -1122,14 +1131,18 @@ export const layer: Layer.Layer< | 1122 | 1131 | // As when the turn ends: an unknown answer resends the request rather than losing it. | 1123 | 1132 | .pipe(Effect.orElseSucceed(() => false)) | 1124 | 1133 | )); | 1125 | | - candidate = unsettledCutProviderTurn(projection, candidate.run, providerThread) | | 1134 | + candidate = unsettledStoppedProviderTurn( | | 1135 | + { runs: projection.runs, providerTurns }, | | 1136 | + candidate.run, | | 1137 | + providerThread, | | 1138 | + ) | 1126 | 1139 | ) { | 1127 | 1140 | droppedCutTurns.push(candidate); | 1128 | 1141 | } | 1129 | 1142 | const earliestCutTurn = droppedCutTurns.at(-1); | 1130 | 1143 | if (earliestCutTurn !== undefined) { | 1131 | | - // Settle them as a failed turn is settled: mark each request dropped and take back their | 1132 | | - // inline context, so this turn resends all of it. Starting again reads the settled state. | | 1144 | + // Settle them as a Stop would: mark each request dropped and take back their inline | | 1145 | + // context, so this turn resends all of it. Starting again reads the settled state. | 1133 | 1146 | const occurredAt = yield* DateTime.now; | 1134 | 1147 | const allocateEventId = () => | 1135 | 1148 | idAllocator.allocate.event({ threadId: projection.thread.id }); | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/testkit/ProviderSwitch.integration.test.ts +101-20Lines changed: 101 additions & 20 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -6552,8 +6552,6 @@ describe("orchestration v2 provider switching", () => { | 6552 | 6552 | "same-provider-retry", | 6553 | 6553 | "cancelled-dropped", | 6554 | 6554 | "cancelled-by-restart", | 6555 | | - "stopped-session-closed", | 6556 | | - "stopped-session-kept", | 6557 | 6555 | "switch-away-and-return", | 6558 | 6556 | "persisted-failure", | 6559 | 6557 | ] as const)("handles an inline context handoff after a failed returning turn (%s)", (variant) => | @@ -6562,10 +6560,7 @@ describe("orchestration v2 provider switching", () => { | 6562 | 6560 | const capturedTurns = yield* Ref.make<ReadonlyArray<CapturedTurn>>([]); | 6563 | 6561 | // A restart cancels the turn with no adapter left to report the drop. | 6564 | 6562 | const cutByRestart = variant === "cancelled-by-restart"; | 6565 | | - // A Stop leaves the request with the session; once that closes, nothing carries it. | 6566 | | - const stopped = variant === "stopped-session-closed" || variant === "stopped-session-kept"; | 6567 | | - const unsettled = cutByRestart || variant === "stopped-session-closed"; | 6568 | | - const dropped = variant !== "persisted-failure" && !cutByRestart && !stopped; | | 6563 | + const dropped = variant !== "persisted-failure" && !cutByRestart; | 6569 | 6564 | const cancelled = variant === "cancelled-dropped" || cutByRestart; | 6570 | 6565 | const layerRegistry = ProviderAdapterRegistry.layerFromAdapters([ | 6571 | 6566 | makeTestAdapter({ | @@ -6580,17 +6575,13 @@ describe("orchestration v2 provider switching", () => { | 6580 | 6575 | 5: "Recovered Codex after round-trip.", | 6581 | 6576 | }, | 6582 | 6577 | capturedTurns, | 6583 | | - ...(stopped | 6584 | | - ? { interruptedRunOrdinals: new Set([3]) } | 6585 | | - : cancelled | 6586 | | - ? { cancelledRunOrdinals: new Set([3]) } | 6587 | | - : { failedRunOrdinals: new Set([3]) }), | | 6578 | + ...(cancelled | | 6579 | + ? { cancelledRunOrdinals: new Set([3]) } | | 6580 | + : { failedRunOrdinals: new Set([3]) }), | 6588 | 6581 | ...(dropped ? { promptDroppedRunOrdinals: new Set([3]) } : {}), | 6589 | | - ...(unsettled | | 6582 | + ...(cutByRestart | 6590 | 6583 | ? { nativeTurnKept: (nativeTurnId: string) => !nativeTurnId.endsWith(":3") } | 6591 | | - : stopped | 6592 | | - ? { nativeTurnKept: () => true } | 6593 | | - : {}), | | 6584 | + : {}), | 6594 | 6585 | }), | 6595 | 6586 | makeTestAdapter({ | 6596 | 6587 | instanceId: CLAUDE_MODEL_SELECTION.instanceId, | @@ -6652,7 +6643,7 @@ describe("orchestration v2 provider switching", () => { | 6652 | 6643 | // Run 3: switch back to Codex (delta handoff covering run 2); fails. | 6653 | 6644 | const afterRun3 = yield* send("Resume after failure", CODEX_MODEL_SELECTION); | 6654 | 6645 | const run3 = afterRun3.runs.find((run) => run.ordinal === 3)!; | 6655 | | - assert.equal(run3.status, stopped ? "interrupted" : cancelled ? "cancelled" : "failed"); | | 6646 | + assert.equal(run3.status, cancelled ? "cancelled" : "failed"); | 6656 | 6647 | const run3Handoff = afterRun3.contextHandoffs.find( | 6657 | 6648 | (handoff) => handoff.targetRunId === run3.id, | 6658 | 6649 | ); | @@ -6672,7 +6663,7 @@ describe("orchestration v2 provider switching", () => { | 6672 | 6663 | assert.equal(run3Handoff?.delivery?.status, "inline"); | 6673 | 6664 | } | 6674 | 6665 |
| 6675 | | - if (variant === "same-provider-retry" || variant === "cancelled-dropped" || unsettled) { | | 6666 | + if (variant === "same-provider-retry" || variant === "cancelled-dropped" || cutByRestart) { | 6676 | 6667 | // Run 4: stay on Codex; must re-deliver run 2's handoff. | 6677 | 6668 | const afterRun4 = yield* send("Resume", CODEX_MODEL_SELECTION); | 6678 | 6669 | const turns = yield* Ref.get(capturedTurns); | @@ -6702,12 +6693,10 @@ describe("orchestration v2 provider switching", () => { | 6702 | 6693 | assert.include(run5Turn.text, "Afternoon Claude shipped b63 live draft."); | 6703 | 6694 | assert.include(run5Turn.text, "Extra Claude turn after dropped handoff."); | 6704 | 6695 | } else { | 6705 | | - // Control: run 3 persisted its prompt before failing, or its live session still carries | 6706 | | - // the stopped request, so run 4 must not send run 2 or run 3 again. | | 6696 | + // Control: run 3 persisted its prompt before failing, so run 4 must not re-send run 2. | 6707 | 6697 | yield* send("Resume", CODEX_MODEL_SELECTION); | 6708 | 6698 | const run4Turn = (yield* Ref.get(capturedTurns)).at(-1)!; | 6709 | 6699 | assert.notInclude(run4Turn.text, "Afternoon Claude shipped b63 live draft."); | 6710 | | - assert.notInclude(run4Turn.text, "Resume after failure"); | 6711 | 6700 | } | 6712 | 6701 | }).pipe( | 6713 | 6702 | Effect.provide( | @@ -6731,6 +6720,98 @@ describe("orchestration v2 provider switching", () => { | 6731 | 6720 | }), | 6732 | 6721 | ); | 6733 | 6722 |
| | 6723 | + it.effect("resends a stopped request the provider dropped once its session closed", () => | | 6724 | + Effect.gen(function* () { | | 6725 | + const cwd = yield* checkpointWorkspace("stopped-request-dropped"); | | 6726 | + const capturedTurns = yield* Ref.make<ReadonlyArray<CapturedTurn>>([]); | | 6727 | + const layerRegistry = ProviderAdapterRegistry.layerFromAdapters([ | | 6728 | + makeTestAdapter({ | | 6729 | + instanceId: CODEX_MODEL_SELECTION.instanceId, | | 6730 | + driver: CODEX_DRIVER, | | 6731 | + capabilities: CodexProviderCapabilitiesV2, | | 6732 | + modelSelection: CODEX_MODEL_SELECTION, | | 6733 | + responseByRunOrdinal: { 1: "hello", 2: "", 3: "Answer." }, | | 6734 | + capturedTurns, | | 6735 | + interruptedRunOrdinals: new Set([2]), | | 6736 | + // Stopped before its first checkpoint: the provider never kept run 2. | | 6737 | + nativeTurnKept: (nativeTurnId) => !nativeTurnId.endsWith(":2"), | | 6738 | + }), | | 6739 | + ]); | | 6740 | + | | 6741 | + yield* Effect.gen(function* () { | | 6742 | + const orchestrator = yield* Orchestrator.OrchestratorV2; | | 6743 | + const worker = yield* EffectWorker.OrchestrationEffectWorkerV2; | | 6744 | + const testThreadId = ThreadId.make("thread:stopped-request-dropped"); | | 6745 | + yield* orchestrator.dispatch({ | | 6746 | + type: "thread.create", | | 6747 | + createdBy: "user", | | 6748 | + creationSource: "web", | | 6749 | + commandId: CommandId.make("command:stopped-request-dropped:create"), | | 6750 | + threadId: testThreadId, | | 6751 | + projectId, | | 6752 | + title: "Stopped request dropped", | | 6753 | + modelSelection: CODEX_MODEL_SELECTION, | | 6754 | + runtimeMode: "full-access", | | 6755 | + interactionMode: "default", | | 6756 | + branch: null, | | 6757 | + worktreePath: cwd, | | 6758 | + }); | | 6759 | + let step = 0; | | 6760 | + const send = (text: string) => | | 6761 | + Effect.gen(function* () { | | 6762 | + step += 1; | | 6763 | + yield* orchestrator.dispatch({ | | 6764 | + type: "message.dispatch", | | 6765 | + createdBy: "user", | | 6766 | + creationSource: "web", | | 6767 | + commandId: CommandId.make(`command:stopped-request-dropped:msg-${step}`), | | 6768 | + threadId: testThreadId, | | 6769 | + messageId: MessageId.make(`message:stopped-request-dropped:${step}`), | | 6770 | + text, | | 6771 | + attachments: [], | | 6772 | + modelSelection: CODEX_MODEL_SELECTION, | | 6773 | + dispatchMode: { type: "start_immediately" }, | | 6774 | + }); | | 6775 | + yield* worker.drain(); | | 6776 | + yield* waitForIdle(testThreadId); | | 6777 | + yield* worker.drain(); | | 6778 | + return yield* orchestrator.getThreadProjection(testThreadId); | | 6779 | + }); | | 6780 | + | | 6781 | + yield* send("Say hello"); | | 6782 | + const afterStop = yield* send("List every prime number below 300"); | | 6783 | + const stopped = afterStop.runs.find((run) => run.ordinal === 2)!; | | 6784 | + assert.equal(stopped.status, "interrupted"); | | 6785 | + | | 6786 | + const afterNext = yield* send("Did I ask you anything about math?"); | | 6787 | + const nextTurn = (yield* Ref.get(capturedTurns)).at(-1)!; | | 6788 | + assert.include(nextTurn.text, "List every prime number below 300"); | | 6789 | + const stoppedTurn = afterNext.providerTurns.find( | | 6790 | + (turn) => turn.runAttemptId === stopped.activeAttemptId, | | 6791 | + ); | | 6792 | + assert.equal(stoppedTurn?.promptDropped, true); | | 6793 | + }).pipe( | | 6794 | + Effect.provide( | | 6795 | + ProviderReplayHarness.layerWithRegistry( | | 6796 | + { | | 6797 | + name: "stopped-request-dropped", | | 6798 | + runtimePolicyOverride: { | | 6799 | + cwd, | | 6800 | + approvalPolicy: "never", | | 6801 | + sandboxPolicy: { | | 6802 | + type: "readOnly", | | 6803 | + access: { type: "fullAccess" }, | | 6804 | + networkAccess: false, | | 6805 | + }, | | 6806 | + }, | | 6807 | + }, | | 6808 | + layerRegistry, | | 6809 | + ), | | 6810 | + ), | | 6811 | + ); | | 6812 | + }), | | 6813 | + ); | | 6814 | + | 6734 | 6815 | it.effect("restores a handoff that a turn cut by a restart carried from an earlier run", () => | 6735 | 6816 | Effect.gen(function* () { | 6736 | 6817 | const cwd = yield* checkpointWorkspace("carried-handoff-cut-by-restart"); | |
Collapse file Copy file name to clipboardExpand all lines: apps/web/src/components/chat/useComposerSend.ts +12Lines changed: 12 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1038,12 +1038,24 @@ export function useComposerSend(input: ComposerSendInput) { | 1038 | 1038 | .getState() | 1039 | 1039 | .getComposerDraft(composerDraftTarget); | 1040 | 1040 | sendInFlightRef.current = true; | | 1041 | + // The commands are read as they are now, which takes a round trip, so the send shows as sending. | | 1042 | + const showsWait = isCurrentRouteThread(); | | 1043 | + if (showsWait) { | | 1044 | + beginLocalDispatch({ | | 1045 | + preparingWorktree: true, | | 1046 | + submissionIntent: | | 1047 | + submissionIntent === "background" && !isLocalDraftThread | | 1048 | + ? "foreground" | | 1049 | + : submissionIntent, | | 1050 | + }); | | 1051 | + } | 1041 | 1052 | const layoutApproval = await ensureWorktreeLayoutApproved({ | 1042 | 1053 | environmentId, | 1043 | 1054 | projectId: activeProject.id, | 1044 | 1055 | projectTitle: activeProject.title, | 1045 | 1056 | }).finally(() => { | 1046 | 1057 | sendInFlightRef.current = false; | | 1058 | + if (showsWait && isCurrentRouteThread()) resetLocalDispatch(); | 1047 | 1059 | }); | 1048 | 1060 | if (layoutApproval.status === "cancelled") return; | 1049 | 1061 | if (layoutApproval.status === "blocked") { | |
Collapse file Copy file name to clipboardExpand all lines: packages/provider-core/src/server/ProviderAdapter.ts +2-3Lines changed: 2 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -795,9 +795,8 @@ export interface ProviderAdapterV2SessionRuntime { | 795 | 795 | ) => number | undefined; | 796 | 796 | readonly canReuseContextUsage?: (previous: ModelSelection, next: ModelSelection) => boolean; | 797 | 797 | /** | 798 | | - * False when the provider will not see a cancelled or stopped turn's request again: the native | 799 | | - * session no longer holds it, and this session runtime does not carry it into the next turn. | 800 | | - * Set only by providers that can drop one, so the turn is settled like a failed one. | | 798 | + * False when the native session no longer holds a cancelled turn's request. Set only by | | 799 | + * providers that can drop one, so a turn a restart cut off is settled like a Stop. | 801 | 800 | */ | 802 | 801 | readonly nativeTurnKept?: (input: { | 803 | 802 | readonly providerThread: OrchestrationV2ProviderThread; | |
Collapse file Copy file name to clipboardExpand all lines: packages/provider-cursor/src/server/adapter.test.ts +5-13Lines changed: 5 additions & 13 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1416,20 +1416,12 @@ describe("CursorAdapterV2", () => { | 1416 | 1416 | ); | 1417 | 1417 | assert(started.type === "provider_turn.updated"); | 1418 | 1418 | yield* runtime.interruptTurn({ providerThread, providerTurnId: started.providerTurn.id }); | 1419 | | - const stoppedRun = { providerThread, nativeTurnId: "native-cursor-run-1" }; | 1420 | 1419 | assert.isTrue( | 1421 | | - yield* runtime.nativeTurnKept!(stoppedRun), | 1422 | | - "the session that saw the Stop sends its request with the next turn", | 1423 | | - ); | 1424 | | - const reopened = yield* adapter.openSession({ | 1425 | | - threadId, | 1426 | | - providerSessionId: ProviderSessionId.make("cursor-steer-session-reopened"), | 1427 | | - modelSelection, | 1428 | | - runtimePolicy, | 1429 | | - }); | 1430 | | - assert.isFalse( | 1431 | | - yield* reopened.nativeTurnKept!(stoppedRun), | 1432 | | - "a session opened after the Stop has nothing to send it with", | | 1420 | + yield* runtime.nativeTurnKept!({ | | 1421 | + providerThread, | | 1422 | + nativeTurnId: started.providerTurn.nativeTurnRef!.nativeId!, | | 1423 | + }), | | 1424 | + "a live session replays the stopped request itself, so the server must not resend it too", | 1433 | 1425 | ); | 1434 | 1426 | yield* runtime.startTurn(turnInput(2, steerText)); | 1435 | 1427 |
| |
|