Repository navigation
perf(sdk): hash an unchanged bundle once per deployment - #12894
Merged
Merged
Conversation
Every Deployment operation hashed every bundle file, about 350 MB, before running. In the deployment end-to-end tests that was 171 verifications taking 32 s, about 6.5% of the module's time, and a long-lived caller paid it on every plan, apply, export, or destroy. A Deployment, and its clones, now remembers the verified bundle with the metadata of the manifest and every file it lists: length, modification time, and on Unix the device, inode, and inode change time, which a writer cannot set back. The next operation hashes again only when that metadata changes, and a failed verification is not remembered. The CLI runs one operation per process and is unchanged. Part of #12882.
Contributor
cv
added a commit
that referenced
this pull request
Oct 9, 2026
Part of #12876. ## Failure Tests overlapped across layers, and nothing measured or limited how long they ran. On `v1` before this PR: - On `linux_amd64` the `test` step took 78 s wall for 620 s of tests. - The lifecycle step took 744 s wall for 2,948 s of tests. - Three end-to-end modules accounted for 82% of the lifecycle time. - Many end-to-end tests repeated full deployments to cover variants that the SDK already proves equivalent. ## Decision Make test time visible first. Then move each group of tests to the layer that owns its behavior, keeping one end-to-end check per behavior. - **Timing report (#12877):** after the test, lifecycle, and live steps, `cargo ci` prints where the time went: wall and summed time, time per binary and module, and the slowest tests. It also writes the report to the GitHub job summary. Each lifecycle partition reports its own tests. The report reads nextest's JUnit output with `quick-junit`, and the `test` step's JUnit report is now uploaded. - **`deployment`:** - Each configuration variant deploys once: `web_search`, `execution_settings`, `tool_disclosure`, and `provider_definitions` ran 15 lifecycles and now run 6. - `cli_redaction` checks each redaction rule once through the CLI. - The SDK tests that own each dropped variant are named in the commits. - **`remote_service`:** - The Hermes lifecycle without authentication repeated the OpenClaw one, so it is removed. - Pi stops after admission and refused sandbox changes. - Refused changes export once instead of eight times. - **`opentofu_openshell`:** the reference graph surfaces each gateway capability failure kind once through OpenTofu, in 14 runs instead of 23. `nemoclaw-openshell` observation tests own the reasons. - **`fabric_deployment`:** every harness applies, reapplies, exports, and destroys. Only OpenClaw and Pi also run the harness-independent model change and refusals. - **`inference_discovery`:** each catalog response is planned once. `nemoclaw-discovery` owns the classification. - **Optimized dependencies:** dependencies build at `opt-level` 2 in development and test builds, and workspace crates stay unoptimized. Unoptimized JSON Schema validation dominated the onboarding journeys. - **Onboarding wizard (#12901, merged into this branch):** the wizard resolves an unchanged journey once. ## Validation Measured in CI run [37916518035](https://github.com/NVIDIA/NemoClaw/actions/runs/37916518035), with cold dependency caches: | linux_amd64 | Before | After | |---|---|---| | `test` step | 78 s wall, 620 s summed | 24 s wall, 189 s summed | | Lifecycle, summed | 2,948 s | 1,898 s | | Lifecycle shards, wall | 744 s unsharded | 309 s and 262 s | | `deployment` | 1,331 s | 922 s | | `remote_service` | 697 s | 433 s | | `fabric_deployment` | 379 s | 164 s | | `opentofu_openshell` | 230 s | 155 s | `linux_arm64` follows the same pattern: the `test` step went from 44 s to 19 s wall, and lifecycle from 2,642 s to 1,845 s summed. - **Cost:** optimizing dependencies lengthens a cold build. "Build test executables" took 315 s instead of 118–155 s on the previous cold run. Only `v1` pushes save the dependency cache, and `.cargo/config.toml` is part of its key, so pull request runs build cold until this merges. - **Local checks for each commit:** each changed test passes against a rebuilt bundle. Workspace clippy at `-D warnings` and fmt are clean. A new `nemoclaw-build` test covers the timing report. ## Follow-ups - #12894 hashes an unchanged bundle once per deployment. - `deployment` is still 922 s summed across about 31 distinct failure and recovery scenarios. The remaining cost is each OpenTofu operation, which a follow-up will address. - Enforcing the per-layer budgets remains in #12877.
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.
Part of #12882.
Failure
Every
Deploymentoperation hashed every bundle file before running, about 350 MB onlinux_arm64. Ine2e deployment, profiling found 171 verifications taking 32 s, about 6.5% of the module's time. Each one re-hashed a bundle whose files had not changed. Long-lived SDK callers pay the same cost on every plan, apply, export, or destroy.Decision
Deployment, and its clones, remembers the verified bundle together with the metadata ofmanifest.jsonand every file the manifest lists: length, modification time, and on Unix the device, inode, and inode change time. A writer can set the modification time back, but not the inode change time.bundle.verifytiming event is still reported for every operation. The CLI runs one operation per process and is unaffected.docs/build.mdstates when a deployment verifies its bundle.Validation
VerifiedBundleexisted.deployment::web_search_cli_export_reapply_and_destroytakes 100 s locally instead of 109 s. It runs 48 SDK operations across 6 lifecycles, each lifecycle creating its own deployment.nemoclaw-sdktests pass (573), and workspace clippy at-D warningsand fmt are clean.