Repository navigation
fix: keep prepared-model tests inside owned state - #133131
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 3:01 AM ET / 07:01 UTC. ClawSweeper reviewWhat this changesThe PR routes prepared-model tests through owned fixture state, drains deferred test work before cleanup, and adds native file/SQLite containment checks. Merge readinessKeep this PR open. It is a focused, maintainer-authored test-isolation repair with no blocking introduced defect found; current main has not absorbed the branch, and exact-head CI is still completing. Priority: P3 Review scores
Verification
How this fits togetherPrepared-model runtime preparation builds agent model snapshots used by agent runs, Gateway metadata, and the embedded TUI. Test inputs reach native flowchart LR
A[Test suites] --> B[Owned test state]
B --> C[Shared prepared-model harness]
C --> D[Native model file capture]
C --> E[Read-only catalog database]
D --> F[Prepared runtime snapshot]
E --> F
F --> G[Gateway and TUI tests]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +26, Tests +415. Total +441 across 12 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Retain the state-owned fixture approach and land it after the exact-head CI gate completes successfully. Do we have a high-confidence way to reproduce the issue? Yes—source establishes that the former harness supplied arbitrary temporary paths to native file and catalog readers; this read-only review did not execute the reported RED case. Is this the best way to solve the issue? Yes. Supplying the existing owned test state to the shared fixture producer repairs the source of the leak, rather than masking native reads or changing production behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 357078cf7087. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Maintainer verification is complete for head The root cause is the shared test producer supplying fabricated agent paths to real native model-file capture and read-only catalog readers. The repair keeps directory allocation and lifetime in the existing test-state owner across all eleven consumers, with no production changes or broader filesystem mocks. Timeout coverage joins actual build completion before fixture cleanup. The three guarded pre-fix failures and fixed containment proof are retained; final native proof passed 171/171 affected tests, zero skips, plus the existing real-SQLite catalog-content case. The complete classified changed checks passed after normal pinned dependency provisioning, with the reviewed patch unchanged. Exact native test/check selections and the initial dependency-topology failures are documented in the PR Evidence section. Independent isolated Codex P0 review had no findings. Exact-head CI run 33297995323, attempt 1 is completed and successful. Native review artifacts validated, and this command completed with hosted gates passing and the same prepared/remote head: OPENCLAW_TESTBOX=1 scripts/pr prepare-run 133131The latest ClawSweeper review has no actionable findings; its remaining next step was exact-head CI completion, now satisfied. No additional re-review is needed for an unchanged head. Production +0/-0; tests +1605/-1190; test support +35/-9. This is test isolation and cleanup proof, not live provider, channel, or deployment verification. Proceeding through the native pinned-head merge gate. |
|
Merged via squash.
|
What Problem This Solves
Resolves a problem where prepared-model runtime tests could read shared temporary files even though model discovery was mocked. Native
models.jsoncapture and the read-only SQLite catalog reader still consumed fabricated agent-directory paths, allowing unrelated filesystem contents to influence tests. Fixture teardown could also run before a timed-out build actually finished.This is a maintainer-requested test-isolation repair discovered during broader QA, not a production behavior change or an attempt to hide a failing assertion.
Why This Change Was Made
The shared harness now takes the existing
OpenClawTestStateowner, and all eleven consuming suites use its canonical agent paths. This preserves the intentionaldefaultagent identity, explicit shared-directory cases, exact model-file bytes, and OAuth hook-generation identities. Deferred tests release and join their actual work before cleanup; timeout coverage waits for build completion rather than treating the public timeout rejection as a drain. Failed tests retain their fixture namespace conservatively.The regression guards real native file capture and the read-only database entry point before delegation. Broader filesystem mocks and production guards would conceal the fixture producer defect, so neither was added. Existing lifetime cases were moved into the catalog-owner suite rather than adding line-limit suppressions.
User Impact
No production, configuration, schema, protocol, dependency, or user-visible behavior changes. Developers can run the prepared-model test family without its agent-directory fixtures pointing at shared temporary locations.
Production LOC: +0/-0. Tests: +1605/-1190; test support: +35/-9. Much of the test churn is existing cases moved between suites and
try/finallysettlement around existing assertions. No test-only production API was introduced.Evidence
models.jsonpath; the catalog case reached the unowned agent database path. The non-ENOENTPREPARED_FIXTURE_ESCAPEguard caused each failure.reads only named catalog rows without running migration or repairalso passed (one selected case, 31 intentionally unselected), preserving actual catalog-content coverage without duplicating it.pakotype-resolution failures. A normal frozen-lockfile install of the repository-pinned pnpm 12.1.0 resolved both; the aggregate and all 171 affected tests then passed again with the patch byte-identical.cfddfc2f700ea456c66b887d70716b83d3ac0ea2. Changed files and relevant runtime owners were also compared with fetched main136eab023035dd5943818f791d3c3db7d92e4491; those source blobs were unchanged.Commands below use the native repository wrappers. Local report-output arguments are omitted. Each invocation used Node 24.15.0, one worker, private fixture roots outside Git, and no live credentials or channel calls.
node scripts/run-vitest.mjs src/agents/plugin-model-catalog.test.ts -t 'reads only named catalog rows without running migration or repair'Hosted exact-head CI remains a landing prerequisite. This test-only change does not claim a live runtime, provider, channel, or deployment verification.