Skip to content
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

Ignore file edit limit when in agent mode #238914

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading