Skip to content

Commit a5754d8

Browse files
committed
Revert "Add transcript line count to compaction summary (#4811)"
This reverts commit d105bd2.
1 parent f015e58 commit a5754d8

3 files changed

Lines changed: 4 additions & 30 deletions

File tree

src/extension/chat/vscode-node/sessionTranscriptService.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ interface IActiveSession {
3838
readonly buffer: string[];
3939
/** Chain of flush operations to serialize writes. */
4040
flushPromise: Promise<void>;
41-
/** Running count of lines in the transcript (flushed + buffered). */
42-
lineCount: number;
4341
}
4442

4543
export class SessionTranscriptService implements ISessionTranscriptService {
@@ -91,7 +89,6 @@ export class SessionTranscriptService implements ISessionTranscriptService {
9189
lastEntryId: null,
9290
buffer: [],
9391
flushPromise: Promise.resolve(),
94-
lineCount: 0,
9592
};
9693
this._activeSessions.set(sessionId, session);
9794

@@ -105,12 +102,7 @@ export class SessionTranscriptService implements ISessionTranscriptService {
105102
}
106103

107104
if (fileAlreadyExists) {
108-
// Session file exists — we're resuming; count existing lines so getLineCount stays accurate
109-
try {
110-
const content = await fs.promises.readFile(fileUri.fsPath, 'utf-8');
111-
session.lineCount = content.split('\n').filter(l => l.length > 0).length;
112-
} catch {
113-
}
105+
// Session file exists — we're resuming; no need to replay history
114106
return;
115107
}
116108

@@ -224,10 +216,6 @@ export class SessionTranscriptService implements ISessionTranscriptService {
224216
return this._activeSessions.get(sessionId)?.uri;
225217
}
226218

227-
getLineCount(sessionId: string): number | undefined {
228-
return this._activeSessions.get(sessionId)?.lineCount;
229-
}
230-
231219
isTranscriptUri(uri: URI): boolean {
232220
const dir = this._getTranscriptsDir();
233221
if (!dir) {
@@ -364,7 +352,6 @@ export class SessionTranscriptService implements ISessionTranscriptService {
364352
} as TranscriptEntry;
365353

366354
session.lastEntryId = id;
367-
session.lineCount++;
368355
session.buffer.push(JSON.stringify(fullEntry) + '\n');
369356
}
370357

src/extension/prompts/node/agent/summarizedConversationHistory.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ class ConversationHistory extends PromptElement<SummarizedAgentHistoryProps> {
248248
}
249249

250250
if (summaryForCurrentTurn) {
251-
history.push(<SummaryMessageElement endpoint={this.props.endpoint} summaryText={summaryForCurrentTurn} transcriptPath={this.props.transcriptPath} transcriptLineCount={this.props.transcriptLineCount} />);
251+
history.push(<SummaryMessageElement endpoint={this.props.endpoint} summaryText={summaryForCurrentTurn} transcriptPath={this.props.transcriptPath} />);
252252

253253
return (<PrioritizedList priority={this.props.priority} descending={false} passPriority={true}>
254254
{history.reverse()}
@@ -308,7 +308,7 @@ class ConversationHistory extends PromptElement<SummarizedAgentHistoryProps> {
308308

309309
if (summaryForTurn) {
310310
// We have a summary for a tool call round that was part of this turn
311-
turnComponents.push(<SummaryMessageElement endpoint={this.props.endpoint} summaryText={summaryForTurn.text} transcriptPath={this.props.transcriptPath} transcriptLineCount={this.props.transcriptLineCount} />);
311+
turnComponents.push(<SummaryMessageElement endpoint={this.props.endpoint} summaryText={summaryForTurn.text} transcriptPath={this.props.transcriptPath} />);
312312
} else if (!turn.isContinuation) {
313313
turnComponents.push(<AgentUserMessage flexGrow={1} {...getUserMessagePropsFromTurn(turn, this.props.endpoint, {
314314
userQueryTagName: this.props.userQueryTagName,
@@ -410,8 +410,6 @@ export interface SummarizedAgentHistoryProps extends BasePromptElementProps, Age
410410
readonly summarizationSource?: 'background' | 'foreground';
411411
/** Path to the conversation transcript JSONL file, used to inform the model after summarization */
412412
readonly transcriptPath?: string;
413-
/** Number of lines in the transcript at the time of compaction */
414-
readonly transcriptLineCount?: number;
415413
}
416414

417415
/**
@@ -460,15 +458,13 @@ export class SummarizedConversationHistory extends PromptElement<SummarizedAgent
460458

461459
// Resolve transcript path and flush to disk so the model can read the up-to-date file
462460
let transcriptPath: string | undefined;
463-
let transcriptLineCount: number | undefined;
464461
if (transcriptLookupEnabled) {
465462
const sessionId = this.props.promptContext.conversation?.sessionId;
466463
if (sessionId) {
467464
const transcriptUri = this.sessionTranscriptService.getTranscriptPath(sessionId);
468465
if (transcriptUri) {
469466
await this.sessionTranscriptService.flush(sessionId);
470467
transcriptPath = transcriptUri.fsPath;
471-
transcriptLineCount = this.sessionTranscriptService.getLineCount(sessionId);
472468
}
473469
}
474470
}
@@ -479,7 +475,6 @@ export class SummarizedConversationHistory extends PromptElement<SummarizedAgent
479475
{...this.props}
480476
promptContext={promptContext}
481477
transcriptPath={transcriptPath}
482-
transcriptLineCount={transcriptLineCount}
483478
enableCacheBreakpoints={this.props.enableCacheBreakpoints} />
484479
</>;
485480
}
@@ -1007,7 +1002,6 @@ interface SummaryMessageProps extends BasePromptElementProps {
10071002
readonly summaryText: string;
10081003
readonly endpoint: IChatEndpoint;
10091004
readonly transcriptPath?: string;
1010-
readonly transcriptLineCount?: number;
10111005
}
10121006

10131007
class SummaryMessageElement extends PromptElement<SummaryMessageProps> {
@@ -1016,7 +1010,7 @@ class SummaryMessageElement extends PromptElement<SummaryMessageProps> {
10161010
<Tag name='conversation-summary'>
10171011
{this.props.summaryText}
10181012
</Tag>
1019-
{this.props.transcriptPath && <><br />If you need specific details from before compaction (such as exact code snippets, error messages, tool results, or content you previously generated), use the {ToolName.ReadFile} tool to look up the full uncompacted conversation transcript at: "{this.props.transcriptPath}"{this.props.transcriptLineCount !== undefined && <><br />At the time of this request, the transcript has {this.props.transcriptLineCount} lines.</>}<br />Example usage: {ToolName.ReadFile}(filePath: "{this.props.transcriptPath}")</>}
1013+
{this.props.transcriptPath && <><br />If you need specific details from before compaction (such as exact code snippets, error messages, tool results, or content you previously generated), use the {ToolName.ReadFile} tool to look up the full uncompacted conversation transcript at: {this.props.transcriptPath}</>}
10201014
{this.props.endpoint.family === 'gpt-4.1' && <Tag name='reminderInstructions'>
10211015
<DefaultOpenAIKeepGoingReminder />
10221016
</Tag>}

src/platform/chat/common/sessionTranscriptService.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,6 @@ export interface ISessionTranscriptService {
237237
*/
238238
getTranscriptPath(sessionId: string): URI | undefined;
239239

240-
/**
241-
* Get the current number of lines in the transcript for a session.
242-
* Returns `undefined` if the session is not active.
243-
*/
244-
getLineCount(sessionId: string): number | undefined;
245-
246240
/**
247241
* Remove transcript files for sessions that are no longer active,
248242
* keeping at most `maxRetained` most-recent ended sessions.
@@ -269,7 +263,6 @@ export class NullSessionTranscriptService implements ISessionTranscriptService {
269263
async flush(): Promise<void> { }
270264
async endSession(): Promise<void> { }
271265
getTranscriptPath(): URI | undefined { return undefined; }
272-
getLineCount(): number | undefined { return undefined; }
273266
async cleanupOldTranscripts(): Promise<void> { }
274267
isTranscriptUri(): boolean { return false; }
275268
}

0 commit comments

Comments
 (0)