Skip to content

perf(onboarding): resolve an unchanged journey once - #12901

Merged
cv merged 1 commit into
test/layer-budgetsfrom
perf/tui-resolution-cache
Oct 9, 2026
Merged

cv merged 1 commit into
test/layer-budgetsfrom
perf/tui-resolution-cache

Conversation

@cv

@cv cv commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #12885. Part of #12882.

Failure

The onboarding wizard resolved its journey again for each of these: the next question, each step, the review document, and every view redraw. A resolution validates the partial document against the SDK schema and parses it. Instrumenting the slowest example journey, spark_spark_inline, showed 196 resolutions across 36 answers, about 8 ms each in a debug build. This made the TUI journey tests the largest cost in the deterministic test step: 168 s summed on linux_amd64. Every redraw of the running TUI paid the same cost.

Decision

  • JourneyWizard keeps its last resolution, including a failed one, and reuses it until the state or observations change.
  • state and observations are private. Every change goes through submit, delegate, back, or remember, which clear the kept resolution. The view and terminal read them through accessors. Tests record observations through a test-only record method that also clears it.
  • The view's information notes and review document use the kept resolution.
  • JourneyState::answer still resolves internally. That code is in nemoclaw-authoring and unchanged here.

Validation

  • New test: asking for the next question and the document repeatedly resolves once. An answer, an undo, and a new observation each cause exactly one new resolution. The test was written first and failed to compile without the counter.
  • Timings: on top of test: split tests into layers with wall-clock budgets #12885's optimized dependencies, spark_spark_inline takes 0.74 s locally instead of 1.06 s. The nemoclaw-onboarding library tests take 0.92 s instead of 1.28 s.
  • Checks: all 79 library tests pass, and clippy at -D warnings and fmt are clean.

The onboarding wizard re-resolved its journey for the next question,
each step, the review document, and every view redraw. A resolution
validates the partial document against the SDK schema and parses it, so
the slowest example journey resolved 196 times across 36 answers.

JourneyWizard now keeps its last resolution until an answer, undo,
delegation, or observation changes the state it resolves. The state and
observations become private so every change goes through a method that
clears the kept resolution; the view and terminal read them through
accessors.

Part of #12882.
@cv cv added the v1 NemoClaw v1 branch label Oct 9, 2026
@cv
cv merged commit 18c44e5 into test/layer-budgets Oct 9, 2026
4 checks passed
@cv
cv deleted the perf/tui-resolution-cache branch October 9, 2026 10:13
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.
@wscurran wscurran added area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow area: performance Latency, throughput, resource use, benchmarks, or scaling refactor PR restructures code without intended behavior change labels Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow area: performance Latency, throughput, resource use, benchmarks, or scaling refactor PR restructures code without intended behavior change v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants