Skip to content

fix(rendering): honor suppressWarnings in settled build output#470

Open
JoshKappler wants to merge 1 commit into
getsentry:mainfrom
JoshKappler:fix/suppress-warnings-in-domain-result-text
Open

fix(rendering): honor suppressWarnings in settled build output#470
JoshKappler wants to merge 1 commit into
getsentry:mainfrom
JoshKappler:fix/suppress-warnings-in-domain-result-text

Conversation

@JoshKappler

Copy link
Copy Markdown

suppressWarnings was only applied to the streaming compiler-warning fragments. The settled text rendered from the domain result calls createStandardDiagnosticSections directly, 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 renderDomainResultTextItems and one regression test at the renderCliTextTranscript level, 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 suppressWarnings never reaches the renderer, since bootstrapRuntime only hydrates config sessionDefaults when runtime is mcp. Changing that would affect every session default in the CLI, so I left it out of this fix.

Fixes #447.

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}):`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: suppressWarnings doesn't work

1 participant