fix: add missing cfg guard for code-mode feature in reply_parts.rs#8127
Closed
soilSpoon wants to merge 1 commit into
Closed
fix: add missing cfg guard for code-mode feature in reply_parts.rs#8127soilSpoon wants to merge 1 commit into
soilSpoon wants to merge 1 commit into
Conversation
The `if code_execution_active` block references `code_execution::get_tool_disclosure()` and `pctx_code_mode::config::ToolDisclosure` variants without a `#[cfg(feature = "code-mode")]` guard. When `code-mode` is disabled, the `code_execution` module and `pctx_code_mode` crate are not available, causing compilation to fail with 4 errors. The existing guards correctly set `code_execution_active = false` when the feature is off, but the compiler still needs to resolve the types inside the if-block. Adding the cfg attribute to the if-block itself ensures the entire block is excluded from compilation when code-mode is disabled. Verified: `cargo check -p goose --no-default-features --features rustls-tls` now succeeds. Signed-off-by: DaeHee Lee <lee111dae11@proton.me>
f72d7de to
2571b89
Compare
DOsinga
approved these changes
Mar 26, 2026
Collaborator
DOsinga
left a comment
There was a problem hiding this comment.
LGTM — the guard on the block is the correct fix. The unguarded block causes type-checking errors on types even when the feature is disabled.
Contributor
|
#8111 same fix was merged before, I think its fine to close this |
Collaborator
|
thanks @r0x0d - so many incoming. And thanks @soilSpoon for helping out! |
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.
Summary
The
if code_execution_active { ... }block inreply_parts.rsreferencescode_execution::get_tool_disclosure()andpctx_code_mode::config::ToolDisclosurevariants without a#[cfg(feature = "code-mode")]guard. Whencode-modeis disabled, thecode_executionmodule andpctx_code_modecrate are not available, causing 4 compilation errors.The existing guards correctly set
code_execution_active = falsewhen the feature is off, but the compiler still needs to resolve the types inside the if-block at compile time. Adding the cfg attribute to the if-block itself ensures the entire block is excluded from compilation when code-mode is disabled.Follows the same pattern established in #7976 (
local-inferencefeature gate) and #8080 (aws-providersfeature gate).Changes:
crates/goose/src/agents/reply_parts.rs— Add#[cfg(feature = "code-mode")]to theif code_execution_activeblock (1 line addition)Testing
cargo check -p goose --no-default-features --features rustls-tls— now succeeds (previously failed with 4 errors)cargo check -p goose— compiles with all defaults (no behavior change)Related Issues
N/A
Screenshots/Demos (for UX changes)
N/A (backend-only change, no UI impact)