Skip to content

fix: keep model-resolution tests inside owned state - #133240

Merged
steipete merged 1 commit into
mainfrom
steipete/test-provider-timeout-fixture-fixed-main-20260830
Aug 30, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/test-provider-timeout-fixture-fixed-main-20260830

Conversation

@steipete

Copy link
Copy Markdown
Contributor
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 OpenClawTestState now 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.

node scripts/run-vitest.mjs 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/embedded-agent-runner/model.forward-compat.test.ts src/agents/embedded-agent-runner/model.generation-scope.test.ts
node scripts/run-vitest.mjs src/agents/btw.test.ts
node scripts/run-vitest.mjs src/agents/command/cli-compaction.test.ts src/agents/harness/selection.test.ts
node scripts/run-vitest.mjs src/agents/tools/image-tool.test.ts
node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/llm-idle-timeout.test.ts src/agents/embedded-agent-runner/run/llm-idle-timeout.abort.test.ts
node scripts/run-vitest.mjs packages/ai/src/utils/stream-first-event-timeout.test.ts
node scripts/run-vitest.mjs src/agents/embedded-agent-runner/model.inline-provider.test.ts

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.

@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Aug 30, 2026
@steipete steipete self-assigned this Aug 30, 2026
@steipete
steipete marked this pull request as ready for review August 30, 2026 09:53
@clawsweeper

clawsweeper Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 6:09 AM ET / 10:09 UTC.

ClawSweeper review

What this changes

The 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 readiness

⚠️ Ready for maintainer review - 3 items remain

Keep 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 maintainer label prevents automated cleanup.

Priority: P3
Reviewed head: ee13bb9e99bb4df1c9abfeefa11032defdbd7536
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is a focused producer-boundary test repair with targeted cleanup coverage and no actionable review finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored test-only PR changes fixture state and cleanup; its body records native suite runs and owned loopback HTTP exercise, while no user-facing runtime behavior changed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored test-only PR changes fixture state and cleanup; its body records native suite runs and owned loopback HTTP exercise, while no user-facing runtime behavior changed.
Evidence reviewed 6 items Introduced fixture boundary: The new shared guard rejects auth-store and plugin-discovery requests outside the test-state root before the native owner can read those paths.
Resolver owner boundary: Current resolver behavior derives agent/workspace inputs, selects prepared discovery state, and executes resolution in the prepared plugin-generation scope; the PR changes only tests around that behavior.
Current-main necessity: Current main does not contain the new fixture guard, and the PR head is not an ancestor of the fetched main revision; the work is not already implemented there.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Decision needed

Question Recommendation
Should this maintainer-labeled model-fixture isolation repair merge after the latest ClawSweeper rank-up moves are checked? Confirm and merge: Confirm that the latest rank-up moves are satisfied, then merge the test-only isolation repair.

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

  • Resolve merge risk (P1) - The latest ClawSweeper review comment was filtered from the supplied discussion and could not be re-fetched, so its rank-up moves must be checked before merge.
  • Complete next step (P2) - A maintainer should review the protected PR and its latest rank-up moves; no discrete automated repair is identified.
Agent review details

Security

None.

PR surface

Source +36, Tests +275. Total +311 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 2 42 6 +36
Tests 9 616 341 +275
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 658 347 +311

Review metrics

Metric Value Why it matters
Production versus test LOC production +0/-0; tests and test support +658/-347 The sizeable diff is contained to test fixtures and cleanup assertions, with no shipped runtime surface added.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Merge the fixture-producer isolation repair after a maintainer confirms the latest review’s rank-up moves remain satisfied.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best 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.

Labels

Label justifications:

  • P3: This PR improves internal test isolation and cleanup without changing a user-facing runtime path.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored test-only PR changes fixture state and cleanup; its body records native suite runs and owned loopback HTTP exercise, while no user-facing runtime behavior changed.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Check the latest ClawSweeper comment’s filtered rank-up moves before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-30T09:53:50.857Z sha ee13bb9 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-30T10:00:02.784Z sha ee13bb9 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 30, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready verification for head ee13bb9e99bb4df1c9abfeefa11032defdbd7536.

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.ts

Native review-artifact validation and preparation both completed successfully:

scripts/pr review-validate-artifacts 133240
OPENCLAW_TESTBOX=1 scripts/pr prepare-run 133240

Preparation 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.

@steipete
steipete merged commit d498334 into main Aug 30, 2026
241 checks passed
@steipete
steipete deleted the steipete/test-provider-timeout-fixture-fixed-main-20260830 branch August 30, 2026 10:27
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant