Skip to content

clippy large_futures fails locally on macOS/aarch64 for build_agent_factory (CI passes on Linux, same feature matrix) #6163

Description

@bug-ops

Description

cargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing,deep-link" -- -D warnings — the exact command documented in .claude/rules/branching.md / CLAUDE.md for the local pre-commit gate, and the exact feature matrix CI's lint-clippy job uses — currently fails locally on macOS/aarch64 (Darwin) with 17 clippy::large_futures errors, all in build_agent_factory(...).await call sites:

error: large future with a size of 16456 bytes
    --> src/serve/agent_factory.rs:1848:27
    --> src/serve/agent_factory.rs:1904:27
    --> src/serve/agent_factory.rs:1979:27
    --> src/serve/handlers.rs:64:9
(17 total across these two files)

CI's lint-clippy (desktop-ide-server-chat-pdf-scheduler) job passed on the exact same commit (5ab24a9e) with the exact same feature set, on ubuntu-latest. This reproduces the same platform-specific pattern as the closed issue #3521 (stable-aarch64-apple-darwin): the large_futures lint's fixed 16384-byte threshold is apparently crossed on macOS/aarch64's async state-machine layout but not on Linux's, for the same source.

Reproduction Steps

  1. On macOS/aarch64 (confirmed: rustc 1.97.0 (2d8144b78 2026-07-07)), checkout origin/main at 5ab24a9e (or later) with a clean working tree.
  2. Run cargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing,deep-link" -- -D warnings.
  3. Observe 17 large_futures errors in src/serve/agent_factory.rs and src/serve/handlers.rs, all citing build_agent_factory(...).await at a reported future size of 16456 bytes (just over the 16384-byte default threshold).
  4. Compare: GitHub Actions lint-clippy job on the same commit, same feature matrix, ubuntu-latest — passes cleanly (confirmed via gh run view on the CI run for 5ab24a9e).

Expected Behavior

The documented local "Before Every Commit" clippy command should pass on any supported development platform (including macOS/aarch64, the primary dev machine for this project), matching CI's result for the same commit and feature set.

Actual Behavior

Local clippy on macOS/aarch64 fails where Linux CI passes, for code neither introduced nor touched by the commit under test — this blocks the documented pre-commit gate for any macOS contributor without an unrelated change ever entering their diff.

Root Cause (suspected, not confirmed)

Per the pattern in #3521 (previously observed and closed for a different call site: agent.run().await in src/acp.rs/crates/zeph-bench/src/runner.rs), the clippy::large_futures lint's future-size computation is sensitive to platform-specific async state-machine layout (alignment/padding differences between Linux's and macOS/aarch64's Rust ABI). build_agent_factory's future appears to sit right at the ~16KB threshold boundary, so small ABI differences tip it over on macOS but not Linux.

Suggested Fix

Same remedy as #3521's resolution: Box::pin the build_agent_factory(...) call at the flagged sites (clippy's own suggestion), which moves the large future onto the heap and should resolve the lint on both platforms regardless of the underlying size discrepancy — rather than chasing platform-specific size tuning.

Environment

Related

Metadata

Metadata

Assignees

Labels

P2High value, medium complexitybugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions