don't block chat when collecting instructions fail#306161
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes chat input submission resilient to failures during automatic instruction collection, so users can continue chatting even if prompt/instruction discovery or parsing encounters errors.
Changes:
- Wrap automatic instruction computation/collection in a
try/catchto prevent errors from aborting chat submission. - Log failures from automatic instruction computation instead of propagating them.
| const computer = this.instantiationService.createInstance(ComputeAutomaticInstructions, this.input.currentModeKind, enabledTools, enabledSubAgents, sessionResource); | ||
| await computer.collect(attachedContext, CancellationToken.None); | ||
| } catch (err) { | ||
| this.logService.error(`ChatWidget#_autoAttachInstructions: failed to compute automatic instructions`, err); |
There was a problem hiding this comment.
This catch makes instruction collection best-effort (non-fatal), but it logs at error level on every send attempt when failures persist (e.g. file locator/read issues). Consider downgrading this to warn (similar to _checkForAgentInstructionFiles earlier in this file) and/or rate-limit/log-once per widget/session to avoid noisy logs while still capturing the failure context.
Suggested change
| this.logService.error(`ChatWidget#_autoAttachInstructions: failed to compute automatic instructions`, err); | |
| this.logService.warn(`ChatWidget#_autoAttachInstructions: failed to compute automatic instructions`, err); |
DonJayamanne
approved these changes
Mar 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.