Repository navigation
perf(core): box async fns compiled into several distinct copies - #7159
Conversation
Adds a fetch path that bypasses the cache when retrieving connected Composio integrations, so callers can force a fresh read when cached data may be stale. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Several large async functions were being re-instantiated in every crate or codegen unit that awaited them, bloating compile times and binary size. Each is now wrapped in an #[inline(never)] function that returns a boxed future, so the state machine is compiled once in its defining crate. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
The Ok arm of the active workspace snapshot match now builds its tuple on a single line instead of a block, with no change in behaviour. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
The boxed wrapper and body of the tinyagents turn runner now live in a dedicated turn_runner_boxed module, with the body made visible to its parent so the existing call sites keep working. This isolates the large async state machine in one compilation unit without changing behaviour. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Tiny Sweeper reviewTiny Sweeper reviewed this change across 6 lane(s) and found 0 active actionable finding(s). Detailed lane evidence and any incomplete work are listed below. State: Reviewing pending checks Review snapshot
Completeness: Complete What changedThe review could not produce a supported behavioral summary; inspect the cited changed surface and lane details below. FeaturesNone identified with supported citations. TestsNo supported feature-to-test mapping was produced. Test execution is not inferred. FindingsNo active actionable findings. Pending checks: Rust E2E (mock backend), Build Playwright E2E Artifact, E2E (Playwright / web lane), Desktop E2E (full suite, 3 OS) Before merge
How this fits togetherflowchart LR
n0["notify_pending_approval"]:::impacted
n1["format"]:::impacted
n2["assemble_turn_harness"]:::impacted
n3["run_flow_body"]:::impacted
n4["fetch_connected_integrations_uncached"]:::impacted
n5["run_turn_via_tinyagents_shared"]:::impacted
n0 -->|calls| n1
n2 -->|calls| n1
n3 -->|calls| n0
n3 -->|calls| n1
n4 -->|calls| n1
n5 -->|calls| n1
classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Agent review detailscritique
security
tests
commits
description
e2e
Evidence and run details
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
tinysweeper found nothing blocking. Approving.
$0.0074 · 157,096 in / 8,383 out · 15,480 cached (10%) · gpt-5.6-luna, glm-5.3-flash
critique: $0.0037 · 62,840 in / 4,231 out · 8,228 cached (13%) · gpt-5.6-luna
security: $0.0035 · 67,857 in / 2,380 out · 7,252 cached (11%) · gpt-5.6-luna
tests: $0.0001 · 6,612 in / 507 out · 0 cached (0%) · glm-5.3-flash
description: $0.0001 · 7,163 in / 198 out · 0 cached (0%) · glm-5.3-flash
e2e: $0.0001 · 7,480 in / 131 out · 0 cached (0%) · glm-5.3-flash
Summary
#[inline(never)]free fn returningBoxFuture, body renamed to a private*_inner/*_body)..textofopenhuman-core(product features): 81,029,408 -> 79,874,528 bytes (-1,154,880 B, about -1.1 MiB, -1.4%)..await.Problem
An
async fnbody is re-instantiated in every crate / codegen unit that awaits it. These four are large and awaited from several places (core CGUs,openhuman-rpc,-embed,-tinyhumans), so each leaves several copies thatmold --icf=safecannot fold.Solution
Boxed at the nearest fn that callers await, so one copy is compiled in the core crate:
fetch_connected_integrations_uncached(integrations/composio/connected_integrations/fetch_uncached.rs)ApprovalGate::intercept_audited_inner(security/approval/gate_intercept.rs; body nowintercept_audited_inner_body)run_flow_body(flows/ops/execution.rs;'static, all params owned)run_turn_via_tinyagents_inner(agent/tinyagents/turn_runner.rs; body nowrun_turn_via_tinyagents_body). The boxed wrapper lives in a newturn_runner_boxed.rsbecauseturn_runner.rswould otherwise exceed the 750-line layout limit. Bothrun_turn_via_tinyagents_sharedandrun_root_turn_via_hosted_agentgo through it.None skipped; all futures are
Send.Measurement (release,
strip=false, product features; per-fn numbers are distinct addresses of<fn>::{{closure}}text symbols in the mold--icf=saferelink, excluding drop_in_place):.text(cargo-bloattext-section-size): 81,029,408 -> 79,874,528 B.Submission Checklist
Impact
.text. One extra heap allocation per call of these (already coarse-grained, long-running) fns.Related
AI Authored PR Metadata
Linear Issue
Commit & Branch
Validation Run
pnpm --filter openhuman-app format:check: N/A (no frontend change)pnpm typecheck: N/ARUST_MIN_STACK=16777216 scripts/ci-cancel-aware.sh cargo test -p openhuman --lib --no-default-features --features <product>: 8684 passed, 1 failed (mcp::registry::tools::tests::list_tools_errors_for_unconnected_server, order-dependent; passes in isolation, unrelated to this change)rustfmt --edition 2021on changed files; clippy on core with product features (--all-targets) clean except the pre-existingvoice/live/ws_tests.rsunused-import warnings;cargo checkOK foropenhuman-cli --tests(product features),openhuman-embed --tests --features inference,mcp,skills, andcrates/openhuman-app/Cargo.toml;node scripts/ci/check-openhuman-rust-layout.mjspasses;node scripts/ci/check-agent-runtime-boundary.mjspassescargo checkaboveValidation Blocked
command:N/Aerror:N/Aimpact:N/ABehavior Changes
Parity Contract
.awaitcall sitesDuplicate / Superseded PR Handling
Summary by CodeRabbit