feat: evaluate review area options#325
Conversation
EclipseSourceAI
left a comment
There was a problem hiding this comment.
Note
Autonomous AI review. Generated automatically, so it may contain mistakes; feel free to ignore any comment you disagree with (noting why helps future reviews).
An approval here does not mean the change is free of architectural issues; the overall architecture and design should still be reviewed by a human.
To get an updated review after pushing changes, re-request a review from this account.
Adds an AI Review view to the AI First perspective: reviews the git worktree change set, groups changes into "Areas", annotates files with per-hunk editor decorations, and accepts an optional "Intent" input. Solid draft: clean provider abstraction (ReviewChangeSetProvider via ContributionProvider), reuse of @theia/scm DiffComputer for hunks, and good test coverage (tests + lint pass).
Focus areas for a human: (1) review-diff-decorator.ts leaks decorations for diff editors, since clearDecorations can't reach decorations applied via applyToMonacoDiffEditor, so re-reviews accumulate stale annotations; (2) review-summary-agent.ts registers a prompt fragment it never uses and calls the model outside the Agent framework under an unregistered agent id, so its model/prompt aren't configurable; (3) the review storage preference is unregistered and ignores workspace scope. Remaining notes are i18n gaps and a minor filename-truncation bug. Nothing here blocks the draft, but the decoration leak is worth addressing before this is refined further.
| } | ||
| } | ||
| this.appliedDecorations.clear(); | ||
| } |
There was a problem hiding this comment.
clearDecorations can't clear diff-editor decorations. getDecorationTarget returns undefined for MonacoDiffEditor, and applyToMonacoDiffEditor stores IDs under a diff-modified:* key that never matches decorationKey(target). So the map is emptied but the monaco decorations stay on the modified editor, and the next applyToMonacoDiffEditor reads oldDecorations: [], leaving the old ones orphaned. Result: stale/duplicated annotations on re-review with a diff open (the common path).
| return undefined; | ||
| } | ||
| return editor; | ||
| } |
There was a problem hiding this comment.
This 15-line stream-of-consciousness comment describing what MonacoDiffEditor does internally should be trimmed to one line. The method just returns undefined for diff editors.
| this.promptService.addBuiltInPromptFragment({ | ||
| id: REVIEW_SUMMARY_PROMPT_ID, | ||
| template: reviewSummaryPromptTemplate.template, | ||
| }); |
There was a problem hiding this comment.
This fragment is registered on every review but never used: buildPrompt sets systemMessage to reviewSummaryPromptTemplate.template directly, so PromptService and this call are dead. Either resolve the system prompt through the prompt service (so it becomes customizable) or drop the registration and the injection.
|
|
||
| async reviewChangeSet(cs: ReviewChangeSet, intents?: ReviewIntent[]): Promise<ReviewResult> { | ||
| const diffs = this.collectDiffs(cs); | ||
| const model = await this.languageModelRegistry.selectLanguageModel({ agent: 'review-summary', purpose: 'chat', identifier: 'default/code' }); |
There was a problem hiding this comment.
agent: 'review-summary' refers to an agent that is never registered (this service is bound only toSelf, not as Agent), so its model and prompt aren't configurable in AI settings the way the sibling pr-reviewer agent is (
theia/packages/ai-ide/src/browser/review/pr-review-agent.ts
Lines 26 to 41 in 5459778
Agent so it fits the framework. The file is also named *-agent.ts but exports ReviewSummaryService.
| return undefined; | ||
| } | ||
| const values = this.preferenceService.inspect(REVIEW_STORAGE_DIRECTORY_PREF); | ||
| const configuredPath = values?.globalValue ?? values?.defaultValue ?? REVIEW_STORAGE_DEFAULT_DIR; |
There was a problem hiding this comment.
ai-features.review.storageDirectory isn't registered in any preference schema, so it can't be discovered/set via settings, and reading globalValue ?? defaultValue skips a workspace-level value. Register it in the schema and use preferenceService.get(REVIEW_STORAGE_DIRECTORY_PREF) which resolves scope precedence.
|
|
||
| protected reviewFilename(id: string): string { | ||
| const sanitized = id.replace(/[^\p{L}\p{N}]/ug, '-').replace(/^-+|-+$/g, ''); | ||
| const truncated = sanitized.length > 32 ? sanitized.slice(0, sanitized.indexOf('-', 32) || 32) : sanitized; |
There was a problem hiding this comment.
sanitized.indexOf('-', 32) || 32 returns -1 when there is no dash past index 32, so slice(0, -1) drops the last character instead of truncating to 32. Guard the -1 case.
| })); | ||
| changeSets.push({ | ||
| id: `git-worktree:${repo.provider.rootUri}`, | ||
| label: 'Working tree changes', |
There was a problem hiding this comment.
'Working tree changes' is user-facing but not localized. Wrap with nls.localize.
| <div className='ai-review-changeset-header' onClick={() => this.toggleExpand(cs.id)}> | ||
| <span className={codicon(isExpanded ? 'chevron-down' : 'chevron-right')} /> | ||
| <span className='ai-review-changeset-label'>{cs.label}</span> | ||
| <span className='ai-review-changeset-badge'>{cs.files.length} {cs.files.length === 1 ? 'file' : 'files'}</span> |
There was a problem hiding this comment.
'file'/'files' are hardcoded. Localize the count label (nls supports plural placeholders).
What it does
How to test
Follow-ups
Breaking changes
Attribution
Review checklist
nlsservice (for details, please see the Internationalization/Localization section in the Coding Guidelines)Reminder for reviewers