Repository navigation
fix(tests): cut Foundry cache eviction test runtime - #154223
Conversation
|
🦞👀 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 September 20, 2026, 9:41 PM ET / September 21, 2026, 01:41 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR speeds up Foundry token-cache eviction coverage by replacing repeated CLI launches with mocked cache seeding while retaining one real subprocess refresh. Merge readiness✅ Ready for maintainer review This remains a useful, focused test-performance improvement absent from current main. No actionable correctness or security findings remain, consistent with the previous review. Priority: P3 Review scores
Verification
How this fits togetherMicrosoft Foundry authentication turns a selected account profile into a cached bearer token, refreshing through Azure CLI when necessary. This change reduces the cost of testing that eviction and refresh path. flowchart LR
A[Synthetic account profiles] --> B[Registered Foundry provider]
B --> C{Token cached?}
C -->|Yes| F[Prepared bearer token]
C -->|Evicted| D[Azure CLI adapter]
D --> E[Synthetic CLI subprocess]
E --> F
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests -53. Total -53 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep eviction semantics covered at the registered provider boundary while reserving real subprocess work for the refresh contract. Do we have a high-confidence way to reproduce the issue? Not applicable to a product defect; the test-cost problem has recorded before/after measurements, and source confirms the repeated subprocess work being removed. Is this the best way to solve the issue? Yes. The change reuses existing fixtures, preserves focused cache invariants and one real CLI refresh, and adds no production seam. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 20eebbd5c7bf. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
…f 130 CLI spawns (openclaw#154223) The Foundry cache-eviction boundary test spent over a minute booting a cold source runtime and launching 130 synthetic Azure CLI subprocesses. Seed cache pressure through the existing mocked CLI boundary, load the shared runtime once, and keep one real subprocess refresh for the evicted tenant. Preserve assertions for the tenant-bound bearer token, Azure CLI arguments, and subsequent cache reuse. Existing provider tests continue to cover LRU recency, expired-token reclamation, and in-flight refresh ownership. Production code and user-visible behavior are unchanged; the test diff is +87/-140 lines. Recorded proof: all 97 tests passed before and after; eviction-test execution fell from 65.061 s to 0.232 s. Linux Testbox proof passed all 97 tests in 640 ms of test execution, with an 18.63 s command wall time. Disabling capacity pruning made the replacement fail its bearer-token assertion. Exact-head CI passed, and the scoped review plus ClawSweeper review found no actionable defects. Related: openclaw#127216
Related: #127216
What Problem This Solves
Foundry token-cache eviction coverage took over a minute in the provider test shard because one test booted a cold source runtime and launched 130 synthetic Azure CLI subprocesses.
User Impact
No user-visible behavior changes. Provider tests retain cache-eviction coverage with substantially less test execution time. Production code is unchanged.
Why This Change Was Made
The registered provider already has fast tests for LRU recency, expired-token reclamation, and in-flight refresh ownership. The boundary test now seeds cache pressure through the existing mocked CLI boundary, then uses one real subprocess running a synthetic
azexecutable to refresh the evicted tenant. It verifies the tenant-bound bearer token, CLI arguments, and subsequent cache reuse. Source modules load once in the file's shared runtime instead of in a second cold child.Production LOC: 0. Test LOC: +87 / -140 (net -53). No new production seam, dependency, configuration, timeout increase, or skipped test.
Evidence
Standalone command before and after:
node scripts/run-vitest.mjs extensions/microsoft-foundry/index.test.ts --maxWorkers=1.All 97 tests passed in both runs. The baseline's instrumented account loop took 17.432 s; the remaining 47.629 s included cold-child startup/source imports and surrounding overhead. The loop combined profile writes and 130 subprocess refreshes; those costs were not independently timed. Shared transform/compiler preparation dominates the remaining command wall time on the loaded host.
P1 autoreview: scoped-clean, no accepted/actionable findings. Formatting and
git diff --checkpassed.node scripts/check-changed.mjspassed every selected step except the extension-lint bootstrap, which hit the documented nested-checkout host error:Declaration input escapes checkoutthrough ancestornode_modules/@types/events. Extension-test typechecking and all three unused-export scans passed. The local dependency installation was preserved.The approved lint substitute was run against the changed file:
A temporary
debugger;canary proved that the command inspected the file and enforced lint rules. It was then removed, and the reviewed file's SHA-256 was restored exactly:Hosted extension lint remains the authority for the complete declaration-boundary preparation.
A fresh Linux Testbox authenticated and synchronized successfully, then passed all 97 tests: 640 ms total test time, 29.5 ms for the eviction test, and 18.63 s command wall time. The first lease had failed SSH authentication before executing tests.
A temporary negative control removed capacity pruning and made the new test fail at its bearer-token assertion, confirming that it still catches unbounded cache retention. The runtime was restored byte-for-byte. The diagnostic wrapper then failed because it searched JSON failure messages for literal token values; Vitest emits a summarized stack and redacts token values in its formatted diff. Local inspection confirmed the expected assertion failure (150 ms test time). This diagnostic error stopped the one-shot remote command before the 73-file replay and remote changed checks. Those broader results are not claimed here; hosted CI supplies the remaining shard evidence.
Maintainer review disposition
ClawSweeper reviewed head
9a9360eca5faba319bf54f5c6dfd4c086bae6091at 2026-09-21 01:00 UTC and reported no findings, no security concerns, and no before-merge actions. The latest review contains no Rank-up moves or additional proof requests, so none were skipped. The campaign review of record is scoped-clean; no semantic changes were made during landing.