Skip to content

Commit

Permalink
Ignore file edit limit when in agent mode (#238914)
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens authored Jan 28, 2025
1 parent d3673ef commit ffa60d8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ export class ChatEditingService extends Disposable implements IChatEditingServic
private _editingSessionFileLimitPromise: Promise<number>;
private _editingSessionFileLimit: number | undefined;
get editingSessionFileLimit() {
if (this._chatAgentService.toolsAgentModeEnabled) {
return Number.MAX_SAFE_INTEGER;
}

return this._editingSessionFileLimit ?? defaultChatEditingMaxFileLimit;
}

Expand All @@ -102,6 +106,7 @@ export class ChatEditingService extends Disposable implements IChatEditingServic
@IFileService private readonly _fileService: IFileService,
@ILifecycleService private readonly lifecycleService: ILifecycleService,
@IWorkbenchAssignmentService private readonly _workbenchAssignmentService: IWorkbenchAssignmentService,
@IChatAgentService private readonly _chatAgentService: IChatAgentService,
@IStorageService storageService: IStorageService,
@ILogService logService: ILogService,
@IExtensionService extensionService: IExtensionService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { MultiDiffEditor } from '../../../multiDiffEditor/browser/multiDiffEdito
import { MultiDiffEditorInput } from '../../../multiDiffEditor/browser/multiDiffEditorInput.js';
import { isNotebookEditorInput } from '../../../notebook/common/notebookEditorInput.js';
import { INotebookService } from '../../../notebook/common/notebookService.js';
import { IChatAgentService } from '../../common/chatAgents.js';
import { ChatEditingSessionChangeType, ChatEditingSessionState, ChatEditKind, getMultiDiffSourceUri, IChatEditingSession, IModifiedFileEntry, WorkingSetDisplayMetadata, WorkingSetEntryRemovalReason, WorkingSetEntryState } from '../../common/chatEditingService.js';
import { IChatResponseModel } from '../../common/chatModel.js';
import { IChatService } from '../../common/chatService.js';
Expand Down Expand Up @@ -178,6 +179,7 @@ export class ChatEditingSession extends Disposable implements IChatEditingSessio
@IChatService private readonly _chatService: IChatService,
@INotebookService private readonly _notebookService: INotebookService,
@ITextFileService private readonly _textFileService: ITextFileService,
@IChatAgentService private readonly _chatAgentService: IChatAgentService,
) {
super();
}
Expand Down Expand Up @@ -713,8 +715,10 @@ export class ChatEditingSession extends Disposable implements IChatEditingSessio
}

private async _acceptTextEdits(resource: URI, textEdits: TextEdit[], isLastEdits: boolean, responseModel: IChatResponseModel): Promise<void> {
if (!this._entriesObs.get().find(e => isEqual(e.modifiedURI, resource)) && this._entriesObs.get().length >= (await this.editingSessionFileLimitPromise)) {
// Do not create files in a single editing session that would be in excess of our limit
if (!this._chatAgentService.toolsAgentModeEnabled && !this._entriesObs.get().find(e => isEqual(e.modifiedURI, resource)) && this._entriesObs.get().length >= (await this.editingSessionFileLimitPromise)) {
// Do not create files in a single editing session that would be in excess of our limit.
// TODO- The agent mode check is done weirdly here because we don't know whether agent mode is enabled or not at the moment the chat editing session is created when the window is loading.
// Expecting that the limit will be removed soon anyway...
return;
}

Expand Down

0 comments on commit ffa60d8

Please sign in to comment.