mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
Rollback automatic diagnostics debugging for now
This commit is contained in:
@@ -26,7 +26,6 @@ import { findLast, findLastIndex, formatContentBlockToMarkdown } from "./utils"
|
||||
import { truncateHalfConversation } from "./utils/context-management"
|
||||
import { extractTextFromFile } from "./utils/extract-text"
|
||||
import { regexSearchFiles } from "./utils/ripgrep"
|
||||
import DiagnosticsMonitor from "./integrations/DiagnosticsMonitor"
|
||||
|
||||
const SYSTEM_PROMPT =
|
||||
async () => `You are Claude Dev, a highly skilled software developer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.
|
||||
@@ -65,8 +64,6 @@ RULES
|
||||
- Feel free to use markdown as much as you'd like in your responses. When using code blocks, always include a language specifier.
|
||||
- When presented with images, utilize your vision capabilities to thoroughly examine them and extract meaningful information. Incorporate these insights into your thought process as you accomplish the user's task.
|
||||
- At the end of each user message, you will automatically receive environment_details. This information is not written by the user themselves, but is auto-generated to provide potentially relevant context about the project structure and environment. While this information can be valuable for understanding the project context, do not treat it as a direct part of the user's request or response. Use it to inform your actions and decisions, but don't assume the user is explicitly asking about or referring to this information unless they clearly do so in their message. When using environment_details, explain your actions clearly to ensure the user understands, as they may not be aware of these details.
|
||||
- You will automatically receive workspace error diagnostics in environment_details. Be mindful that this may include issues beyond the scope of your task or the user's request. Focus on addressing errors and warnings relevant to your work, and avoid fixing pre-existing or unrelated issues unless the user specifically instructs you to do so.
|
||||
- If you are unable to resolve errors provided in environment_details after a few attempts, consider using ask_followup_question to ask the user for additional information, such as the latest documentation related to a problematic framework, to help you make progress on the task.
|
||||
- CRITICAL: When editing files with write_to_file, ALWAYS provide the COMPLETE file content in your response. This is NON-NEGOTIABLE. Partial updates or placeholders like '// rest of code unchanged' are STRICTLY FORBIDDEN. You MUST include ALL parts of the file, even if they haven't been modified. Failure to do so will result in incomplete or broken code, severely impacting the user's project.
|
||||
|
||||
====
|
||||
@@ -252,7 +249,6 @@ export class ClaudeDev {
|
||||
readonly taskId: string
|
||||
private api: ApiHandler
|
||||
private terminalManager: TerminalManager
|
||||
private diagnosticsMonitor: DiagnosticsMonitor
|
||||
private didEditFile: boolean = false
|
||||
private customInstructions?: string
|
||||
private alwaysAllowReadOnly: boolean
|
||||
@@ -278,7 +274,6 @@ export class ClaudeDev {
|
||||
this.providerRef = new WeakRef(provider)
|
||||
this.api = buildApiHandler(apiConfiguration)
|
||||
this.terminalManager = new TerminalManager()
|
||||
this.diagnosticsMonitor = new DiagnosticsMonitor()
|
||||
this.customInstructions = customInstructions
|
||||
this.alwaysAllowReadOnly = alwaysAllowReadOnly ?? false
|
||||
|
||||
@@ -679,7 +674,6 @@ export class ClaudeDev {
|
||||
abortTask() {
|
||||
this.abort = true // will stop any autonomously running promises
|
||||
this.terminalManager.disposeAll()
|
||||
this.diagnosticsMonitor.dispose()
|
||||
}
|
||||
|
||||
async executeTool(toolName: ToolName, toolInput: any): Promise<[boolean, ToolResponse]> {
|
||||
@@ -1858,24 +1852,25 @@ ${this.customInstructions.trim()}
|
||||
|
||||
const busyTerminals = this.terminalManager.getTerminals(true)
|
||||
const inactiveTerminals = this.terminalManager.getTerminals(false)
|
||||
const allTerminals = [...busyTerminals, ...inactiveTerminals]
|
||||
// const allTerminals = [...busyTerminals, ...inactiveTerminals]
|
||||
|
||||
if (busyTerminals.length > 0 || this.didEditFile) {
|
||||
await delay(300) // delay after saving file to let terminals/diagnostics catch up
|
||||
if (busyTerminals.length > 0 && this.didEditFile) {
|
||||
// || this.didEditFile
|
||||
await delay(300) // delay after saving file to let terminals catch up
|
||||
}
|
||||
|
||||
let terminalWasBusy = false
|
||||
if (allTerminals.length > 0) {
|
||||
// let terminalWasBusy = false
|
||||
if (busyTerminals.length > 0) {
|
||||
// wait for terminals to cool down
|
||||
// note this does not mean they're actively running just that they recently output something
|
||||
terminalWasBusy = allTerminals.some((t) => this.terminalManager.isProcessHot(t.id))
|
||||
await pWaitFor(() => allTerminals.every((t) => !this.terminalManager.isProcessHot(t.id)), {
|
||||
// terminalWasBusy = allTerminals.some((t) => this.terminalManager.isProcessHot(t.id))
|
||||
await pWaitFor(() => busyTerminals.every((t) => !this.terminalManager.isProcessHot(t.id)), {
|
||||
interval: 100,
|
||||
timeout: 15_000,
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
// we want to get diagnostics AFTER terminal cools down for a few reasons: terminal could be scaffolding a project, dev servers (compilers like webpack) will first re-compile and then send diagnostics, etc
|
||||
/*
|
||||
let diagnosticsDetails = ""
|
||||
const diagnostics = await this.diagnosticsMonitor.getCurrentDiagnostics(this.didEditFile || terminalWasBusy) // if claude ran a command (ie npm install) or edited the workspace then wait a bit for updated diagnostics
|
||||
for (const [uri, fileDiagnostics] of diagnostics) {
|
||||
@@ -1890,7 +1885,8 @@ ${this.customInstructions.trim()}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.didEditFile = false // reset, this lets us know when to wait for saved files to update diagnostics
|
||||
*/
|
||||
this.didEditFile = false // reset, this lets us know when to wait for saved files to update terminals
|
||||
|
||||
// waiting for updated diagnostics lets terminal output be the most up-to-date possible
|
||||
let terminalDetails = ""
|
||||
@@ -1928,12 +1924,12 @@ ${this.customInstructions.trim()}
|
||||
}
|
||||
}
|
||||
|
||||
details += "\n\n# VSCode Workspace Errors"
|
||||
if (diagnosticsDetails) {
|
||||
details += diagnosticsDetails
|
||||
} else {
|
||||
details += "\n(No errors detected)"
|
||||
}
|
||||
// details += "\n\n# VSCode Workspace Errors"
|
||||
// if (diagnosticsDetails) {
|
||||
// details += diagnosticsDetails
|
||||
// } else {
|
||||
// details += "\n(No errors detected)"
|
||||
// }
|
||||
|
||||
if (terminalDetails) {
|
||||
details += terminalDetails
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
/*
|
||||
import * as vscode from "vscode"
|
||||
import deepEqual from "fast-deep-equal"
|
||||
|
||||
type FileDiagnostics = [vscode.Uri, vscode.Diagnostic[]][]
|
||||
|
||||
/*
|
||||
|
||||
About Diagnostics:
|
||||
The Problems tab shows diagnostics that have been reported for your project. These diagnostics are categorized into:
|
||||
Errors: Critical issues that usually prevent your code from compiling or running correctly.
|
||||
@@ -30,7 +31,10 @@ Notes on diagnostics:
|
||||
- linter diagnostics are only captured for open editors
|
||||
- this works great for us since when claude edits/creates files its through vscode's textedit api's and we get those diagnostics for free
|
||||
- some tools might require you to save the file or manually refresh to clear the problem from the list.
|
||||
*/
|
||||
|
||||
System Prompt
|
||||
- You will automatically receive workspace error diagnostics in environment_details. Be mindful that this may include issues beyond the scope of your task or the user's request. Only address errors relevant to your work, and avoid fixing pre-existing or unrelated issues unless the user specifically instructs you to do so.
|
||||
- If you are unable to resolve errors provided in environment_details after two attempts, consider using ask_followup_question to ask the user for additional information, such as the latest documentation related to a problematic framework, to help you make progress on the task. If the error remains unresolved after this step, proceed with your task while disregarding the error.
|
||||
|
||||
class DiagnosticsMonitor {
|
||||
private diagnosticsChangeEmitter: vscode.EventEmitter<void> = new vscode.EventEmitter<void>()
|
||||
@@ -46,19 +50,18 @@ class DiagnosticsMonitor {
|
||||
}
|
||||
|
||||
public async getCurrentDiagnostics(shouldWaitForChanges: boolean): Promise<FileDiagnostics> {
|
||||
const currentDiagnostics = this.getDiagnostics() // get all diagnostics for files open in workspace (not just errors/warnings so our did update check is more likely to detect updated diagnostics)
|
||||
const currentDiagnostics = this.getDiagnostics()
|
||||
if (!shouldWaitForChanges) {
|
||||
this.lastDiagnostics = currentDiagnostics
|
||||
return currentDiagnostics
|
||||
}
|
||||
|
||||
// it doesn't matter if we don't even have all the diagnostics yet, since claude will get the rest in the next request. as long as somethings changed, he can react to that in this request.
|
||||
if (!deepEqual(this.lastDiagnostics, currentDiagnostics)) {
|
||||
this.lastDiagnostics = currentDiagnostics
|
||||
return currentDiagnostics
|
||||
}
|
||||
|
||||
let timeout = 300
|
||||
let timeout = 300 // only way this happens is if theres no errors
|
||||
|
||||
// if diagnostics contain existing errors (since the check above didn't trigger) then it's likely claude just did something that should have fixed the error, so we'll give a longer grace period for diagnostics to catch up
|
||||
const hasErrors = currentDiagnostics.some(([_, diagnostics]) =>
|
||||
@@ -66,7 +69,7 @@ class DiagnosticsMonitor {
|
||||
)
|
||||
if (hasErrors) {
|
||||
console.log("Existing errors detected, extending timeout", currentDiagnostics)
|
||||
timeout = 5_000
|
||||
timeout = 10_000
|
||||
}
|
||||
|
||||
return this.waitForUpdatedDiagnostics(timeout)
|
||||
@@ -101,8 +104,12 @@ class DiagnosticsMonitor {
|
||||
|
||||
private getDiagnostics(): FileDiagnostics {
|
||||
const allDiagnostics = vscode.languages.getDiagnostics()
|
||||
// for our deep comparison concept to work, we can't be comparing when new open files with 0 diagnostics to report are added to the list
|
||||
return allDiagnostics.filter(([_, diagnostics]) => diagnostics.length > 0)
|
||||
return allDiagnostics
|
||||
.filter(([_, diagnostics]) => diagnostics.some((d) => d.severity === vscode.DiagnosticSeverity.Error))
|
||||
.map(([uri, diagnostics]) => [
|
||||
uri,
|
||||
diagnostics.filter((d) => d.severity === vscode.DiagnosticSeverity.Error),
|
||||
])
|
||||
}
|
||||
|
||||
public dispose() {
|
||||
@@ -113,3 +120,4 @@ class DiagnosticsMonitor {
|
||||
}
|
||||
|
||||
export default DiagnosticsMonitor
|
||||
*/
|
||||
|
||||
@@ -428,11 +428,11 @@ export class TerminalProcess extends EventEmitter<TerminalProcessEvents> {
|
||||
|
||||
this.emitRemainingBufferIfListening()
|
||||
|
||||
// even though the command is finished, we still want to consider it 'hot' in case so that api request stalls to let diagnostics catch up
|
||||
// if (this.hotTimer) {
|
||||
// clearTimeout(this.hotTimer)
|
||||
// }
|
||||
// this.isHot = false
|
||||
// for now we don't want this delaying requests since we don't send diagnostics automatically anymore (previous: "even though the command is finished, we still want to consider it 'hot' in case so that api request stalls to let diagnostics catch up")
|
||||
if (this.hotTimer) {
|
||||
clearTimeout(this.hotTimer)
|
||||
}
|
||||
this.isHot = false
|
||||
|
||||
this.emit("completed")
|
||||
this.emit("continue")
|
||||
|
||||
@@ -32,12 +32,20 @@ const Announcement = ({ version, hideAnnouncement }: AnnouncementProps) => {
|
||||
🎉{" "}New in v{version}
|
||||
</h3>
|
||||
<p style={{ margin: "5px 0px" }}>
|
||||
Commands now run directly in your terminal thanks to VSCode 1.93's new shell integration updates! Plus a
|
||||
new 'Proceed While Running' button to let Claude continue working while commands run, sending him new
|
||||
output along the way (i.e. letting him react to server errors as he edits files).{" "}
|
||||
<VSCodeLink style={{ display: "inline" }} href="https://x.com/sdrzn/status/1833316974518014072">
|
||||
See a demo here.
|
||||
</VSCodeLink>
|
||||
</p>
|
||||
{/* <p style={{ margin: "5px 0px" }}>
|
||||
Claude can now monitor workspace problems to keep updated on linter/compiler/build issues, letting him
|
||||
proactively fix errors on his own! (adding missing imports, fixing type errors, etc.)
|
||||
<VSCodeLink style={{ display: "inline" }} href="https://x.com/sdrzn/status/1835100787275419829">
|
||||
See a demo here.
|
||||
</VSCodeLink>
|
||||
</p>
|
||||
</p> */}
|
||||
{/*<ul style={{ margin: "0 0 8px", paddingLeft: "12px" }}>
|
||||
<li>
|
||||
OpenRouter now supports prompt caching! They also have much higher rate limits than other providers,
|
||||
|
||||
Reference in New Issue
Block a user