Skip to content

Commit 03cf158

Browse files
committed
fix: remove debug logging statements from GPT-5 implementation
- Remove console.log statements from openai-native.ts - Remove console.log statements from Task.ts related to GPT-5 response IDs - Remove console.log statement for manual condense operation - Clean up debugging artifacts from PR #7067
1 parent 050e316 commit 03cf158

File tree

2 files changed

+0
-34
lines changed

2 files changed

+0
-34
lines changed

src/api/providers/openai-native.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ export class OpenAiNativeHandler extends BaseProvider implements SingleCompletio
8989
private resolveResponseId(responseId: string | undefined): void {
9090
if (responseId) {
9191
this.lastResponseId = responseId
92-
console.log(`[OpenAI-Native] Stored response ID: ${responseId}`)
9392
}
9493
// Resolve the promise so the next request can use this ID
9594
if (this.responseIdResolver) {
@@ -125,15 +124,8 @@ export class OpenAiNativeHandler extends BaseProvider implements SingleCompletio
125124
// This handles the race condition with fast nano model responses
126125
let effectivePreviousResponseId = metadata?.previousResponseId
127126

128-
if (metadata?.previousResponseId) {
129-
console.log(`[OpenAI-Native] Using previous_response_id from metadata: ${metadata.previousResponseId}`)
130-
}
131-
132127
// Check if we should suppress previous response ID (e.g., after condense or message edit)
133128
if (metadata?.suppressPreviousResponseId) {
134-
console.log(
135-
`[OpenAI-Native] Suppressing previous_response_id due to suppressPreviousResponseId flag (likely after condense or edit)`,
136-
)
137129
// Clear the stored lastResponseId to prevent it from being used in future requests
138130
this.lastResponseId = undefined
139131
effectivePreviousResponseId = undefined
@@ -150,7 +142,6 @@ export class OpenAiNativeHandler extends BaseProvider implements SingleCompletio
150142
])
151143
if (resolvedId) {
152144
effectivePreviousResponseId = resolvedId
153-
console.log(`[OpenAI-Native] Using previous_response_id from pending promise: ${resolvedId}`)
154145
}
155146
} catch {
156147
// Non-fatal if promise fails
@@ -160,21 +151,13 @@ export class OpenAiNativeHandler extends BaseProvider implements SingleCompletio
160151
// Fall back to the last known response ID if still not available
161152
if (!effectivePreviousResponseId && this.lastResponseId) {
162153
effectivePreviousResponseId = this.lastResponseId
163-
console.log(`[OpenAI-Native] Using previous_response_id from lastResponseId: ${this.lastResponseId}`)
164154
}
165155
}
166156

167157
// Format input and capture continuity id
168158
const { formattedInput, previousResponseId } = this.prepareStructuredInput(systemPrompt, messages, metadata)
169159
const requestPreviousResponseId = effectivePreviousResponseId || previousResponseId
170160

171-
if (requestPreviousResponseId) {
172-
console.log(`[OpenAI-Native] Making request with previous_response_id: ${requestPreviousResponseId}`)
173-
console.log(`[OpenAI-Native] Including updated instructions (system prompt) to ensure consistency`)
174-
} else {
175-
console.log(`[OpenAI-Native] Making request without previous_response_id (full conversation context)`)
176-
}
177-
178161
// Create a new promise for this request's response ID
179162
this.responseIdPromise = new Promise<string | undefined>((resolve) => {
180163
this.responseIdResolver = resolve
@@ -618,7 +601,6 @@ export class OpenAiNativeHandler extends BaseProvider implements SingleCompletio
618601

619602
// Store response ID for conversation continuity
620603
if (parsed.response?.id) {
621-
console.log(`[OpenAI-Native] Received response ID from stream: ${parsed.response.id}`)
622604
this.resolveResponseId(parsed.response.id)
623605
}
624606

@@ -910,9 +892,6 @@ export class OpenAiNativeHandler extends BaseProvider implements SingleCompletio
910892
} else if (parsed.type === "response.completed" || parsed.type === "response.done") {
911893
// Store response ID for conversation continuity
912894
if (parsed.response?.id) {
913-
console.log(
914-
`[OpenAI-Native] Received response ID from done event: ${parsed.response.id}`,
915-
)
916895
this.resolveResponseId(parsed.response.id)
917896
}
918897

@@ -1037,7 +1016,6 @@ export class OpenAiNativeHandler extends BaseProvider implements SingleCompletio
10371016
private async *processEvent(event: any, model: OpenAiNativeModel): ApiStream {
10381017
// Persist response id for conversation continuity when available
10391018
if (event?.response?.id) {
1040-
console.log(`[OpenAI-Native] Received response ID from SDK event: ${event.response.id}`)
10411019
this.resolveResponseId(event.response.id)
10421020
}
10431021

src/core/task/Task.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,6 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
840840

841841
// Set flag to skip previous_response_id on the next API call after manual condense
842842
this.skipPrevResponseIdOnce = true
843-
console.log(`[Task#${this.taskId}] Manual condense completed - will skip previous_response_id on next API call`)
844843

845844
const contextCondense: ContextCondense = { summary, cost, newContextTokens, prevContextTokens }
846845
await this.say(
@@ -1073,11 +1072,6 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
10731072
)
10741073
if (gpt5Messages.length > 0) {
10751074
const lastGpt5Message = gpt5Messages[gpt5Messages.length - 1] as any
1076-
console.log(
1077-
`[Task#${this.taskId}] Found ${gpt5Messages.length} messages with GPT-5 response IDs. Last ID: ${lastGpt5Message.metadata.gpt5.previous_response_id}`,
1078-
)
1079-
} else {
1080-
console.log(`[Task#${this.taskId}] No GPT-5 response IDs found in message history`)
10811075
}
10821076

10831077
// Remove any resume messages that may have been added before
@@ -2153,11 +2147,6 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
21532147
// Use the previous_response_id from the last assistant message for this request
21542148
previousResponseId = ((this.clineMessages[idx] as any).metadata.gpt5.previous_response_id ||
21552149
undefined) as string | undefined
2156-
console.log(
2157-
`[Task#${this.taskId}] Retrieved stored GPT-5 response ID from message history: ${previousResponseId}`,
2158-
)
2159-
} else {
2160-
console.log(`[Task#${this.taskId}] No stored GPT-5 response ID found in message history`)
21612150
}
21622151
} else if (this.skipPrevResponseIdOnce) {
21632152
console.log(
@@ -2349,7 +2338,6 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
23492338
instructions: this.lastUsedInstructions,
23502339
reasoning_summary: (reasoningMessage ?? "").trim() || undefined,
23512340
}
2352-
console.log(`[Task#${this.taskId}] Persisted GPT-5 response ID to message metadata: ${lastResponseId}`)
23532341
}
23542342
} catch (error) {
23552343
console.error(`[Task#${this.taskId}] Error persisting GPT-5 metadata:`, error)

0 commit comments

Comments
 (0)