Skip to content

fix(core): gate fork_session_for_plugin behind the opencode-plugin-host feature - #2576

Open
1688mengdie wants to merge 1 commit into
GCWing:mainfrom
BitFun-SIG:fix/ci-warning-core-feature-gate
Open

fix(core): gate fork_session_for_plugin behind the opencode-plugin-host feature#2576
1688mengdie wants to merge 1 commit into
GCWing:mainfrom
BitFun-SIG:fix/ci-warning-core-feature-gate

Conversation

@1688mengdie

Copy link
Copy Markdown

Summary

Fixes #2570

Gate CoreProductAgentRuntime::fork_session_for_plugin (src/crates/assembly/core/src/product_runtime.rs:614) behind #[cfg(feature = "opencode-plugin-host")].

The function's only consumer is the plugin host HTTP routes implementation, which the crate compiles under the opencode-plugin-host feature gate in lib.rs. Test builds that do not enable the feature — notably the sdk-host test compilation unit in the upstream CI CLI Tests jobs on ubuntu/macos — therefore reported the function as dead code (see issue #2570 for the run evidence with file:line and rule names).

Type and Areas

Type: bug fix (build warnings cleanup)

Areas: Rust core

Motivation / Impact

No direct user-facing change. The plugin-host build keeps the function available for its single consumer; feature-less test builds stop emitting the dead_code warning. This also makes the declaration's scope match the existing feature gate around its consumer.

Verification

  • cargo check --locked -p bitfun-core on Windows: exit 0, no dead_code warning for fork_session_for_plugin.
  • cargo check --locked -p bitfun-core --features opencode-plugin-host on Windows: exit 0 (the gated symbol is still available to the plugin-host build).
  • The exact failing configuration (sdk-host test profile on ubuntu/macos) depends on the CI ubuntu/macos runners: the CLI Tests jobs should confirm the warning is gone there (n/a locally — no Linux/macOS machine available; the platform matrix in CI is exactly the place this gets verified).

Reviewer Notes

  • Single file, +1 attribute line, zero deletions, zero behavior change.
  • No #[allow] suppression is introduced.
  • AI-assisted change, lightly tested (cargo check with and without the feature on Windows; the ubuntu/macos test-profile surface is verified by CI).

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable. (n/a — no user-facing change)

feature

CoreProductAgentRuntime::fork_session_for_plugin is consumed only by the
plugin host HTTP routes (plugin_host_http_routes_impl.rs), which the crate
compiles under the `opencode-plugin-host` feature (lib.rs). Test builds
that do not enable the feature — notably the sdk-host test compilation
unit in the upstream CI `CLI Tests` jobs on ubuntu/macos — therefore
report the function as dead code.

Gate the function with #[cfg(feature = "opencode-plugin-host")] so
feature-less test builds stop emitting the dead_code warning while the
plugin host build keeps it available.

Adopted-from: taiji 4c1ac80 (product_runtime.rs cfg gate hunk; the
other hunks of that commit are taiji-side test-construction adaptations
that upstream already carries and are not part of this fix).

Test: cargo check --locked -p bitfun-core exit 0 with no dead_code warning
for fork_session_for_plugin; cargo check -p bitfun-core --features
opencode-plugin-host exit 0 (gate keeps the symbol available for the
plugin host build).
AI: implemented with AI assistance, lightly tested (cargo check only).
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]: dead_code warning for fork_session_for_plugin in feature-less core test builds

1 participant