agentHostPullRequestOperationHandler.ts ×10

Frontier kind: Code frontier

unlabeled · c_54aa72ff43ca

2 tests · 24486 LOC · 105 files · introduces 0 tests · 57 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
10 ranges57 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2209 ranges24486 lines · 105 files · Browse complete extent
All tests (intent)
2 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 57 introduced LOC across 10 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/agentHostPullRequestOperationHandler.ts 57 introduced LOC · 10 ranges

Open complete file

355 return undefined;
356 }
358 > const conversation = buildConversationContext(sessionState.turns, { maxChars: MAX_PR_CONVERSATION_CONTEXT_CHARS });
359 > const changeSummary = this._summarizeDiffsForPrompt(branchChanges);
360 if (!conversation && !changeSummary) {
361 return undefined;
362 }
364 > try {
365 > const raw = await this._copilotApiService.utilityChatCompletion(copilotToken, {
366 > messages: this._buildTitleAndDescriptionPrompt(branchName, base, conversation, changeSummary),
367 > }, { signal });
368 this._throwIfCancelled(token);
369 return this._parseTitleAndDescription(raw);
371 if (token.isCancellationRequested) {
372 return undefined;
378
379 private _buildTitleAndDescriptionPrompt(branchName: string, base: string, conversation: string | undefined, changeSummary: string): ICopilotUtilityChatMessage[] {
380 > const userSections: string[] = [ agentHostPullRequestOperationHandler.ts
381 > `Branch: ${branchName}`,
382 > `Base branch: ${base}`,
383 > ];
384 > if (changeSummary) {
385 > userSections.push(`Changed files:\n${changeSummary}`);
386 > }
387 > if (conversation) {
388 userSections.push(`Conversation (the request that produced these changes):\n${conversation}`);
389 }
391 > {
392 > role: 'system',
393 > content: [
394 > 'You write clear, concise GitHub pull request titles and descriptions.',
395 > 'The first line of your reply is the PR title: a short imperative summary under 72 characters, with no "Title:" prefix, no surrounding quotes, and no markdown heading.',
396 > 'After the title, add one blank line, then write the PR description in GitHub-flavored markdown.',
397 > 'Summarize what changed and why, grounded in the conversation and changed files. Use a short paragraph and/or bullet points.',
398 > 'Do not invent changes that are not supported by the provided context, and do not wrap the whole reply in code fences.',
399 > ].join(' '),
400 > },
401 > {
402 > role: 'user',
403 > content: userSections.join('\n\n'),
404 > },
405 > ];
406 > }
407
408 private _summarizeDiffsForPrompt(diffs: readonly ISessionFileDiff[]): string {
409 > const lines: string[] = []; agentHostPullRequestOperationHandler.ts
410 > let length = 0;
411 > for (const diff of diffs) {
412 > const before = diff.before?.uri;
413 > const after = diff.after?.uri;
414 > const path = after ?? before ?? '(unknown)';
415 > let kind = 'Edit';
416 > if (!before && after) {
417 > kind = 'Create';
418 > } else if (before && !after) {
419 kind = 'Delete';
420 } else if (before && after && before !== after) {
421 kind = 'Rename';
422 }
423 > const line = `- ${kind}: ${this._displayUri(path)} (+${diff.diff?.added ?? 0} -${diff.diff?.removed ?? 0})`; agentHostPullRequestOperationHandler.ts
424 > lines.push(line);
425 > // `+ 1` accounts for the newline that joins this line to the previous one.
426 > length += line.length + (lines.length > 1 ? 1 : 0);
427 > if (length > MAX_PR_CHANGE_SUMMARY_CHARS) {
428 lines.push('[file list truncated]');
429 break;
430 }
432 > return lines.join('\n');
433 > }
434
435 private _displayUri(uri: string): string {
437 > const parsed = URI.parse(uri);
438 > return parsed.scheme === 'file' ? parsed.fsPath : parsed.path || uri;
439 > } catch {
440 return uri;
441 }
443
444 private _parseTitleAndDescription(raw: string): { title: string; description: string } | undefined {