Skip to content

Commit 54a4ceb

Browse files
authored
fix(lmtool): reframe timeout messages as transient + retry-friendly to nudge model retries (#1652)
* fix(lmtool): reframe timeout messages as transient + retry-friendly The two timeout-path response messages previously led with '❌ Debug session failed to start' and listed root-cause hypotheses (compilation errors, ClassNotFoundException, ...) as 'This usually indicates a problem'. Telemetry shows that interpretation is wrong: - 30d retry analysis: success rate climbs from 17.7% (1 invoke) to 64.9% (6-10 invokes) — a 3.7x lift - Started latency P95 = 100s vs the 45s / 15s thresholds — many timeouts are just slow-starting JVMs that DO eventually attach - 66% of users invoke only once, suggesting the model treats the ❌ wording as a permanent failure and gives up Rewrite both timeout messages to: 1. Lead with ⏳ (transient) instead of ❌ / ⚠️ (terminal) 2. State explicitly 'this is often transient' 3. Cite the retry-success pattern 4. Put 'call debug_java_application again' as the first recommended action 5. Keep the diagnostic checklist as a fallback (steps 3-4) for genuinely broken cases No behavior change in the extension — only the natural-language string returned to the language model is changed. This is a targeted nudge for the model's retry policy. Companion PR #1650 will give us per-invoke retry telemetry (retryCount / previousOutcome) to verify the lift after this lands. * review: clarify JSON object syntax for waitForSession in smart-polling timeout message
1 parent 9df1acb commit 54a4ceb

1 file changed

Lines changed: 27 additions & 20 deletions

File tree

src/languageModelTool.ts

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -275,17 +275,21 @@ async function debugJavaApplication(
275275
resolve({
276276
success: false,
277277
status: 'timeout',
278-
message: `❌ Debug session failed to start within ${CONSTANTS.SESSION_WAIT_TIMEOUT / 1000} seconds for ${targetInfo}.\n\n` +
279-
`This usually indicates a problem:\n` +
280-
`• Compilation errors preventing startup\n` +
281-
`• ClassNotFoundException or NoClassDefFoundError\n` +
282-
`• Application crashed during initialization\n` +
283-
`• Incorrect main class or classpath configuration\n\n` +
284-
`Action required:\n` +
285-
`1. Check terminal '${terminal.name}' for error messages\n` +
286-
`2. Verify the target class name is correct\n` +
287-
`3. Ensure the project is compiled successfully\n` +
288-
`4. Use get_debug_session_info() to confirm session status${warningNote}`,
278+
message: `⏳ Debug session not yet detected for ${targetInfo} after `
279+
+ `${CONSTANTS.SESSION_WAIT_TIMEOUT / 1000} seconds.\n\n`
280+
+ `This is often transient — the JVM may still be starting up (large `
281+
+ `projects, cold class-loading, or remote workspaces can need additional `
282+
+ `time). Telemetry shows that retrying a timed-out launch succeeds for `
283+
+ `the majority of cases.\n\n`
284+
+ `Recommended next actions (in order):\n`
285+
+ `1. Call debug_java_application again — most timeout cases recover on retry.\n`
286+
+ `2. Call get_debug_session_info() to check whether the session has since `
287+
+ `become active.\n`
288+
+ `3. If retrying still times out, inspect terminal '${terminal.name}' for `
289+
+ `compilation errors, ClassNotFoundException, NoClassDefFoundError, or `
290+
+ `other startup failures.\n`
291+
+ `4. Verify the target class name and classpath are correct, then retry.`
292+
+ `${warningNote}`,
289293
terminalName: terminal.name
290294
});
291295
}
@@ -335,15 +339,18 @@ async function debugJavaApplication(
335339
return {
336340
success: true,
337341
status: 'timeout',
338-
message: `⚠️ Debug command sent for ${targetInfo}, but session not detected within ${CONSTANTS.SMART_POLLING_MAX_WAIT / 1000} seconds.\n\n` +
339-
`Possible reasons:\n` +
340-
`• Application is still starting (large projects may take longer)\n` +
341-
`• Compilation errors (check terminal '${terminal.name}' for errors)\n` +
342-
`• Application may have started and already terminated\n\n` +
343-
`Next steps:\n` +
344-
`• Use get_debug_session_info() to check if session is now active\n` +
345-
`• Check terminal '${terminal.name}' for error messages\n` +
346-
`• If starting slowly, wait a bit longer and check again${warningNote}`,
342+
message: `⏳ Debug command sent for ${targetInfo}; session not yet detected within `
343+
+ `${CONSTANTS.SMART_POLLING_MAX_WAIT / 1000} seconds.\n\n`
344+
+ `This is often transient — the application may still be starting in terminal `
345+
+ `'${terminal.name}'. Telemetry shows that retrying or polling for status is more `
346+
+ `likely to succeed than treating this as a permanent failure.\n\n`
347+
+ `Recommended next actions (in order):\n`
348+
+ `1. Call get_debug_session_info() to check whether the session has since become active.\n`
349+
+ `2. Call debug_java_application again — most timeout cases recover on retry. `
350+
+ `In the input arguments, set "waitForSession": true (JSON object syntax) to `
351+
+ `extend the wait window for slow-starting apps.\n`
352+
+ `3. If retrying still times out, inspect terminal '${terminal.name}' for compilation `
353+
+ `errors or startup failures, then retry.${warningNote}`,
347354
terminalName: terminal.name
348355
};
349356
}

0 commit comments

Comments
 (0)