Repository navigation
fix: keep model-resolution tests inside owned state - #133240
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 6:09 AM ET / 10:09 UTC. ClawSweeper reviewWhat this changesThe branch moves model-resolution tests from fixed temporary paths to owned per-test state, guards auth and plugin discovery paths, and settles concurrent/streaming fixture work before cleanup. Merge readinessKeep this PR open for its maintainer review: its test-isolation changes are not on current main, and no introduced correctness or security defect was found. The protected Priority: P3 Review scores
Verification
How this fits togetherThe embedded agent model resolver receives agent and workspace paths while it assembles auth, model, and plugin-discovery state. These tests exercise that boundary and then remove temporary fixture state after resolution completes. flowchart LR
A[Model-resolution test] --> B[Owned test state]
B --> C[Model fixture]
C --> D[Auth store lookup]
C --> E[Plugin discovery]
D --> F[Model resolution]
E --> F
F --> G[Settled cleanup]
Decision needed
Why: The patch is a distinct current-main gap, but the protected maintainer label and unavailable latest review details require explicit maintainer handling. Before merge
Agent review detailsSecurityNone. PR surfaceSource +36, Tests +275. Total +311 across 11 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge the fixture-producer isolation repair after a maintainer confirms the latest review’s rank-up moves remain satisfied. Do we have a high-confidence way to reproduce the issue? Not applicable: this is an internal fixture-isolation repair, and the PR supplies focused native test and loopback-HTTP evidence rather than a user-facing bug reproduction. Is this the best way to solve the issue? Yes. Moving path ownership and disposal to fixture producers is the narrow, maintainable boundary and avoids adding production configuration or runtime seams. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e42bb23a8493. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Land-ready verification for head The root cause is fixture ownership: supplying discovery stores does not bypass native auth lookup, and generation/BTW setup can still discover workspace metadata. The repair gives those paths their existing canonical test-state owner, preserves omitted arguments and distinct generation/agent identities, and joins concurrent resolutions and native HTTP sources before disposal. It removes the fixed execution paths and repeated guard setup rather than adding production bypasses. Production +0/-0; tests/test support +658/-347 across eleven files. Both the worker and parent independently verified 652 passing case registrations across 13 files, zero failures or skips, including all nine affected runnable suites and the timeout/inline/idle/abort/first-event siblings. The guarded pre-fix selections fail before unowned filesystem delegation; the fixed selections pass. The rescued early-failure probe distinguishes one settled generation from both settled generations at cleanup, then restores the final source exactly. Full classified formatting/type/lint/guard checks pass after the retained unused-import correction. Fresh isolated Codex autoreview has no actionable P0 finding, and the separate exact-byte consumer audit found no omission, lifetime, generation or credential-boundary regression. The first parent multi-project command exited successfully but overwrote an earlier JSON report. We rejected that incomplete evidence, retained the verified 166-case report, and separately ran the remaining nine files. The complete 652-case result does not count missing output or reruns twice. That wrapper/report ownership issue is separate follow-up work. The actual repair checkout's five patched Vitest files also match every checked-in post-patch Git blob exactly; the separately stale canonical installation was not used for these runs. CI: run 33305158371, attempt 1 is completed/success on this exact head. Latest review and rank-up handling: I read the full completed ClawSweeper review, including its 10:00 and 10:09 UTC versions, history and rank-up moves. Neither identifies an actionable code/security defect. Exact-head checks and maintainer handling are satisfied. Explicit skip: the recursive request to check unspecified filtered prior rank-up moves identifies no additional concrete item; the retained earlier review and current full review have been checked. No source finding is being waived. The native suite commands and runtime versions are in the PR body's Evidence section. The final classified check used: node scripts/check-changed.mjs --base 6b68a4a42a011514487ebfdae9016f5010eee8e2 --head HEAD --timed -- src/agents/btw.test.ts src/agents/command/cli-compaction.test.ts src/agents/embedded-agent-runner/model.forward-compat.test.ts src/agents/embedded-agent-runner/model.generation-scope.test-support.ts src/agents/embedded-agent-runner/model.generation-scope.test.ts src/agents/embedded-agent-runner/model.provider-hooks.timeout.test.ts src/agents/embedded-agent-runner/model.skip-agent-discovery-hooks.test.ts src/agents/embedded-agent-runner/model.test.ts src/agents/harness/selection.test.ts src/agents/tools/image-tool.test.ts src/agents/embedded-agent-runner/model.fixture.test-support.tsNative review-artifact validation and preparation both completed successfully: scripts/pr review-validate-artifacts 133240OPENCLAW_TESTBOX=1 scripts/pr prepare-run 133240Preparation reused the successful hosted exact-head gates, verified the remote tree against the prepared head, and needed no rebase or additional push. This was hosted-CI reuse, not a newly executed Testbox run. Proof is synthetic fixture and owned loopback HTTP execution, not live provider, Codex, Gateway or channel verification. No production, configuration, schema, protocol, dependency pin, baseline, timeout or live-state change is included. |
|
Merged via squash.
|
Additional instructions
Keep Allow edits from maintainers enabled. This branch is in the upstream repository.
Related: #133209 (shared embedded-run fixture ownership).
What Problem This Solves
Resolves a problem where model-resolution tests could inspect auth or workspace data outside their owned fixtures even when model discovery was mocked. This affected the main resolver, forward compatibility, skipped discovery, prepared generation and timeout suites; BTW setup also performed a real workspace scan through a fixed path.
A failed concurrent-generation resolution could leave its sibling waiting while cleanup removed their state. Several model/image fixture allocations also lacked scoped disposal.
Why This Change Was Made
Keep the repair at the fixture producers. Canonical
OpenClawTestStatenow owns explicit paths and default-resolution state, and transparent lexical guards reject unowned requests before native auth or workspace discovery. Valid native calls and auth options still pass through unchanged. Discovery mocks are not broadened, and no env-only auth mode or production seam is added.The generation helper takes explicit execution directories and publishes the supplied workspace across all five consumers. Omitted config/agent-directory arguments, distinct agent identities, A/B generation ownership and metadata-only plugin descriptors remain intact. Concurrent resolutions are released and both joined in
finally; HTTP timeout fixtures abort their own fetch, join the actual source generator and verify body unlock before cleanup. Existing timeout values are unchanged.User Impact
No shipped runtime, provider, configuration, database schema, protocol or dependency behavior changes. Developers get isolated, reproducible model-resolution tests without reading unrelated temporary auth state or leaving fixture work alive after teardown.
Production LOC: +0/-0. Tests and test support: +658/-347, net +311. The eleven changed files comprise ten existing test/support files and one shared native-boundary guard. The guard replaces repeated setup rather than adding a production API. The nearby MiniMax fixture cleanup is included without changing its environment semantics.
Evidence
Both the coding worker and the parent ran and verified the final fixture family: 652 passing case registrations across 13 files, zero failures or skips. This covers all 500 cases in the nine affected runnable suites, plus the original 159-case timeout/inline/idle/abort/first-event matrix, with seven timeout cases counted once. Parameterized Vitest display names can repeat, so evidence uses each file's ordered registrations rather than treating display names as unique IDs. Separate native project reports avoid counting overwritten JSON or reruns twice.
Safe pre-fix guards captured four main-resolver failures, four synchronous forward-compatibility failures, five generation failures, BTW setup failure, and the skipped-discovery workspace/auth failures. Guards stopped those requests before native filesystem delegation. Identical fixed selections passed, followed by the complete suites. Filtered cases and setup failures are distinguished from executed passing assertions.
A temporary early-failure probe made generation A fail before the shared gate while B remained pending. Before the cleanup fix, only A had settled at the cleanup boundary; after release/join, both had settled. Both probe variants included an unconditional rescue join, and the probe was removed byte-for-byte before final validation. No duplicate permanent test was added.
The complete classified changed gate passed after removing one introduced unused import. Its earlier lint failure is retained. Fresh canonical isolated Codex autoreview found no actionable P0 issue, and an exact-byte source/consumer audit confirmed omission, generation, metadata lifetime and credential-acquisition boundaries. API-key-only synthetic seeds and explicit acquisition mocks do not reach external CLI/Keychain readers; this is not inferred merely from private HOME or
allowKeychainPrompt:false.Native test commands below ran with Node 24.15.0, pinned pnpm 12.1.0 and clean-whitelist private HOME/state/config/workspace/XDG/TMP namespaces outside Git. Reporter/output-path arguments are omitted here; exact launch receipts and separate native JSON reports are retained locally.
This is synthetic fixture and owned loopback HTTP proof, not live model, Codex, Gateway or channel verification. No live state or service operation is included.