Repository navigation
improve: reduce disk allocation in Local AI lifecycle tests - #1647
Conversation
Preserve catalog-sized logical files and per-test mutations while avoiding model-sized fixture allocation on Windows. Co-authored-by: Copilot App <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 6, 2026, 1:41 AM ET / 05:41 UTC. ClawSweeper reviewWhat this changesThe PR creates sparse model-sized files for Local AI lifecycle tests and adds checks for allocation, readable zeros, isolation, overwrite refusal, and cleanup. Merge readiness✅ Ready for maintainer review This remains a useful, focused test improvement absent from current main. No actionable correctness or security defect was found, and the supplied Windows measurements directly support the allocation reduction. Priority: P3 Review scores
Verification
How this fits togetherLocal AI lifecycle tests create temporary model installations to exercise runtime startup, shutdown, and ownership behavior. The changed fixture helper supplies those installations with full-length zero-filled files while reducing physical disk allocation. flowchart TD
A[Model catalog size] --> B[Temporary model fixture]
B --> C{Windows host?}
C -->|Yes| D[Mark file sparse]
C -->|No| E[Extend logical length]
D --> E
E --> F[Lifecycle and isolation checks]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Keep fixture allocation optimization confined to tests while preserving catalog-sized files, independent mutations, and existing production validation. Do we have a high-confidence way to reproduce the issue? Not applicable as a product bug; the supplied matched Windows runs and direct allocation probes demonstrate the test-fixture resource problem and its improvement. Is this the best way to solve the issue? Yes. Marking the test file sparse before extending it preserves existing size and isolation semantics without weakening production checks or introducing shared mutable fixtures. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2e5e219ade50. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
What Problem This Solves
Local AI lifecycle tests repeatedly provision a 22,663,387,424-byte zero-filled fake model with ordinary file extension, reserving model-sized storage for each fixture.
User Impact
No product-visible change. Connection tests retain real catalog-sized, independently mutable fixtures without model-sized Windows allocation. No tests are removed or disabled.
Why This Change Was Made
A test-local helper marks the new file sparse through its existing
SafeFileHandlebefore the unchangedSetLength. Windows errors remain explicit with no allocating fallback; Unix retainsSetLengthhole semantics. Catalog/receipt metadata, production size/hash checks, and startup/stop/ownership assertions are unchanged. No packages, project configuration, product code, or workflows change.Evidence
One matched local full-suite pair: native Windows ARM64 10.0.28000, .NET SDK 10.0.401, Debug, no coverage, identical isolated TEMP/environment. Both builds include the same three added helper tests; only lifecycle provisioning differs.
Single-pair local observations are not a statistical performance guarantee. Summed test durations are not wall time; reported allocation is not bytes written. Three interleaved provisioning probes measured 0.859/0.867/1.197 ms before versus 0.776/0.322/0.330 ms after; sampled reads and cleanup succeeded. No model downloads or full-model reads occurred.
Current-head hosted proof: Build and Test run 37419643864 succeeded. Core and CLI tests passed in 2m58s. Its Connection step took 25 seconds; downloaded
test-results-coreTRX shows 1568 passed, 1 existing skip, 0 failed, all 3 helper tests passed, and 113 lifecycle results totaling 14.057 seconds. Earlier separately hosted observations were 463 seconds for the Connection step and 449.95 seconds summed for 109 lifecycle cases, and 477.193 seconds summed for 113 lifecycle cases without coverage. These historical comparisons are not controlled same-host pairs, but the current hosted execution directly confirms the optimized behavior. Coverage alone did not explain the earlier slow runs.Initial local baselines exposed environment preconditions: long isolated TEMP paths broke existing
mklink; a shorter drive-root TEMP inherited unsuitable ACLs. Failed runs were retained separately. Final clean before/after runs both used short user-ownedC:\Users\scottha\s2dd1c196; no unrelated code or skips were changed. Task-owned temporary roots were cleaned.Change Type
Scope
Required proof pools
none: test-fixture-only storage change; no application UI, gateway, node capability, installer, or custom device behavior changes.Validation
Source validated and committed unchanged as
412d325b70923e1e7700acf9be13e93a59607463:dotnet build .\tests\OpenClaw.Connection.Tests\OpenClaw.Connection.Tests.csproj --configuration Debug --verbosity quiet: pass with zero warnings/errors, baseline and after.dotnet test .\tests\OpenClaw.Connection.Tests\OpenClaw.Connection.Tests.csproj --no-build --no-restore --configuration Debug --logger "trx;LogFileName=connection.trx" --results-directory <baseline-or-after>: both 1564 passed, 5 existing skips, 0 failed, 1569 total..\build.ps1: all projects passed, native win-arm64.dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore: 4232 passed, 36 existing skips, 0 failed.dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore: 3899 passed, 0 skipped/failed.OPENCLAW_REPO_ROOTand isolated tray data were set.SetLengthbehavior. CLI autoreview's isolated Git config interpreted unrelated CRLF files as a broad patch, and the parent confirmed Codex CLI absent; authorized app-native review was used without tool/config changes.Real Behavior Proof
412d325b70923e1e7700acf9be13e93a59607463.test-results-coreartifact and parsed Connection TRX. Raw local TRX/log/CSV and failed environment attempts retained in session artifacts.Security Impact
Compatibility and Migration
Review Conversations