-
Notifications
You must be signed in to change notification settings - Fork 860
fix(cursor): reuse Connect conversations from session_id #1915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -173,6 +173,7 @@ import { | |
| type RequestLogContext, | ||
| } from "../request-log"; | ||
| import { | ||
| clientThreadIdFromResponsesHeaders, | ||
| conversationIdFromResponsesRequest, | ||
| normalizeLogConversationId, | ||
| sessionIdHeaderFromRequest, | ||
|
|
@@ -1246,6 +1247,7 @@ export async function handleComboResponses( | |
| config: OcxConfig, | ||
| logCtx: RequestLogContext, | ||
| options: HandleResponsesOptions, | ||
| inboundClientThreadId = clientThreadIdFromResponsesHeaders(req.headers), | ||
| ): Promise<Response> { | ||
| const requestedModel = typeof (rawBody as { model?: unknown } | null)?.model === "string" | ||
| ? (rawBody as { model: string }).model | ||
|
|
@@ -1263,7 +1265,7 @@ export async function handleComboResponses( | |
| // Expand previous_response_id before image policy and child dispatch so a | ||
| // continuation that only references prior images still fails closed when | ||
| // imageInput is disabled (and so targets see the full replayed input). | ||
| const body = expandPreviousResponseInput(rawBody); | ||
| const body = expandPreviousResponseInput(rawBody, inboundClientThreadId); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win Add a focused combo continuation regression test. The implementation now passes Add a Bun test that seeds response state under a client thread, sends a combo continuation with As per path instructions, a server behavior change in 🤖 Prompt for AI AgentsSource: Path instructions |
||
| if (previousResponseReplayFailure(body)) { | ||
| return formatErrorResponse( | ||
| 400, | ||
|
|
@@ -1641,6 +1643,7 @@ async function handleResponsesInner( | |
| } | ||
| return decodeRequestErrorResponse(err, "responses"); | ||
| } | ||
| const inboundClientThreadId = clientThreadIdFromResponsesHeaders(req.headers); | ||
| const comboId = !options.comboAttempt ? comboIdFromRawBody(body, config) : null; | ||
| if (comboId && Object.hasOwn(config.combos ?? {}, comboId)) { | ||
| options.onRequestBodyRead?.(); | ||
|
|
@@ -1649,12 +1652,11 @@ async function handleResponsesInner( | |
| // The original request body was accepted above. Combo children are synthetic | ||
| // replays and must not repeat the caller-owned timeout transition. | ||
| onRequestBodyRead: undefined, | ||
| }); | ||
| }, inboundClientThreadId); | ||
| } | ||
| let unreadableEncryptedAgentTask = hasUnreadableEncryptedAgentTask( | ||
| (body as { input?: unknown } | undefined)?.input, | ||
| ); | ||
| const inboundClientThreadId = req.headers.get("x-codex-parent-thread-id")?.trim() || undefined; | ||
| const originalBody = body; | ||
| body = expandPreviousResponseInput(body, inboundClientThreadId); | ||
| if (previousResponseScopeMismatch(body)) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.