fix(rendering): honor suppressWarnings in settled build output#470
Open
JoshKappler wants to merge 1 commit into
Open
fix(rendering): honor suppressWarnings in settled build output#470JoshKappler wants to merge 1 commit into
JoshKappler wants to merge 1 commit into
Conversation
suppressWarnings was only applied to streaming compiler-warning fragments. The settled text rendered from the domain result called createStandardDiagnosticSections directly, which always emitted the Warnings section, so warnings still reached the final MCP tool response and filled agent context. Thread the flag from the renderer into the build, build-run, and test diagnostic paths. Errors are still rendered when it is set. Other result kinds are unchanged, since the option covers warnings from the build tools. Fixes getsentry#447.
Comment on lines
270
to
276
| ), | ||
| ); | ||
| } | ||
| if (diagnostics.warnings.length > 0) { | ||
| if (!suppressWarnings && diagnostics.warnings.length > 0) { | ||
| sections.push( | ||
| createSection( | ||
| `Warnings (${diagnostics.warnings.length}):`, |
Contributor
There was a problem hiding this comment.
Bug: The suppressWarnings flag is not passed to createSpecialCaseItems, causing warnings to be displayed for install-result, launch-result, and stop-result failures even when suppression is requested.
Severity: MEDIUM
Suggested Fix
Extract the suppressWarnings option from the options object at the beginning of the renderDomainResultTextItems function, before createSpecialCaseItems is called. Then, pass the suppressWarnings flag through the call chain to createSpecialCaseItems and subsequently to createFailureStatusWithDiagnostics to ensure it is respected.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: src/utils/renderers/domain-result-text.ts#L270-L276
Potential issue: The `suppressWarnings` option is not honored for certain failure types,
such as `install-result`, `launch-result`, and `stop-result`. This occurs because the
`renderDomainResultTextItems` function calls `createSpecialCaseItems` to handle these
results before it extracts the `suppressWarnings` flag from its options. Consequently,
`createSpecialCaseItems` calls `createFailureStatusWithDiagnostics` without the flag,
leading to `createStandardDiagnosticSections` rendering warnings even when
`suppressWarnings: true` is specified. This behavior contradicts the intended
functionality of suppressing all tool and build warnings.
Did we get this right? 👍 / 👎 to inform future reviews.
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.
suppressWarningswas only applied to the streaming compiler-warning fragments. The settled text rendered from the domain result callscreateStandardDiagnosticSectionsdirectly, which always emitted the Warnings section, so warnings still reached the final MCP tool response.This threads the flag into the build, build-run, and test diagnostic paths. Errors still render when it is set, and other result kinds are unchanged since the option covers warnings from the build tools.
Tested with two unit tests on
renderDomainResultTextItemsand one regression test at therenderCliTextTranscriptlevel, which is the surface the issue reports. That regression test fails on main and passes here.tsc --noEmit, eslint, and prettier are clean.The issue also notes that in the CLI runtime
suppressWarningsnever reaches the renderer, sincebootstrapRuntimeonly hydrates configsessionDefaultswhen runtime ismcp. Changing that would affect every session default in the CLI, so I left it out of this fix.Fixes #447.