Skip to content

Commit aa6ddbd

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 48fc8b4 commit aa6ddbd

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
@@ -914,7 +914,6 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
914914

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

919918
const contextCondense: ContextCondense = { summary, cost, newContextTokens, prevContextTokens }
920919
await this.say(
@@ -1146,11 +1145,6 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
11461145
)
11471146
if (gpt5Messages.length > 0) {
11481147
const lastGpt5Message = gpt5Messages[gpt5Messages.length - 1] as any
1149-
console.log(
1150-
`[Task#${this.taskId}] Found ${gpt5Messages.length} messages with GPT-5 response IDs. Last ID: ${lastGpt5Message.metadata.gpt5.previous_response_id}`,
1151-
)
1152-
} else {
1153-
console.log(`[Task#${this.taskId}] No GPT-5 response IDs found in message history`)
11541148
}
11551149

11561150
// Remove any resume messages that may have been added before
@@ -2407,11 +2401,6 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
24072401
// Use the previous_response_id from the last assistant message for this request
24082402
previousResponseId = ((this.clineMessages[idx] as any).metadata.gpt5.previous_response_id ||
24092403
undefined) as string | undefined
2410-
console.log(
2411-
`[Task#${this.taskId}] Retrieved stored GPT-5 response ID from message history: ${previousResponseId}`,
2412-
)
2413-
} else {
2414-
console.log(`[Task#${this.taskId}] No stored GPT-5 response ID found in message history`)
24152404
}
24162405
} else if (this.skipPrevResponseIdOnce) {
24172406
console.log(
@@ -2603,7 +2592,6 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
26032592
instructions: this.lastUsedInstructions,
26042593
reasoning_summary: (reasoningMessage ?? "").trim() || undefined,
26052594
}
2606-
console.log(`[Task#${this.taskId}] Persisted GPT-5 response ID to message metadata: ${lastResponseId}`)
26072595
}
26082596
} catch (error) {
26092597
console.error(`[Task#${this.taskId}] Error persisting GPT-5 metadata:`, error)

0 commit comments

Comments
 (0)