Skip to content

fix: keep embedded-run tests inside owned state - #133209

Merged
steipete merged 1 commit into
mainfrom
steipete/test-shared-run-fixture-20260830
Aug 30, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/test-shared-run-fixture-20260830

Conversation

@steipete

Copy link
Copy Markdown
Contributor
Additional instructions

Keep Allow edits from maintainers enabled. This branch is in the upstream repository.

Related: #133131 (prepared-model fixture ownership).

What Problem This Solves

Resolves a problem where running the shared embedded-agent tests could inspect a fixed workspace outside the test's temporary state, despite downstream runtime work being mocked. Timeout cases also treated the caller's timeout rejection as completion even when an ignored-cancellation backend was still using the fixture.

This is a maintainer-requested test-isolation repair, not a change to shipped agent behavior.

Why This Change Was Made

Replace the path-bearing module constant with createOverflowRunParams(state) and migrate the complete consumer family to canonical OpenClawTestState lifetimes. Keep config, agent-directory and session-file omissions, stable logical IDs, generation identity, real SQLite/reopen assertions and the original sixteen-module aggregate order. Warmup owns disposable state without resetting its environment, and the shared loader retains only the loaded runner.

Cleanup now joins actual queued callbacks after an early timeout, releases held attempts in finally, and settles deferred fast-mode work before removing state. Lexical guards reject unowned paths before native metadata/repository readers and retain violations even when discovery swallows an exception. No broader filesystem/auth mock, production drain API, new runtime flag, or larger timeout is introduced. Nearby cleanup removes an exact duplicate provider predicate and reuses canonical lexical containment.

User Impact

No production behavior, configuration, database schema, protocol or dependency changes. Developers can run these tests without the shared fixture selecting an unrelated workspace or deleting state beneath still-running test work. Synthetic harness assertions remain synthetic; this PR makes no live provider, Codex, Gateway or channel verification claim.

Production LOC: +0/-0. All changed lines are tests or test support, including the .harness.ts file that the automated lane classifier treats as core production. The growth is fixture acquisition/cleanup, failure-safe finally blocks and boundary regression evidence, not new runtime machinery.

Evidence

  • Safe pre-fix regression: the existing auth-failover case failed at the real workspace boundary and independently recorded the rejected path before filesystem delegation. Shared-loader warmup also failed in beforeAll; its 79 cases were not executed in that RED run. A diagnostic run with an incorrect old-signature argument is retained separately and is not counted as intended regression evidence.
  • Final parent-run proof: 104 unique passing tests across all seven entrypoints, zero failures or skips. The aggregate contributed 79 cases in the original sixteen-suite order. The same complete entrypoint family also passed in the coding worker before final cleanup.
  • The timeout cases assert that actual backend work remains pending after the early outer timeout, then release and join it before state cleanup. Projection retry retains real SQLite reconciliation, durable reopen, scoped handle closure and fixture-removal checks.
  • Complete classified changed checks passed, including core types, every core-test type shard, all scoped lint batches and applicable guards. After three bounded cleanup edits, the parent reran all 104 cases, final scoped lint and whitespace checks.
  • Fresh canonical isolated Codex autoreview: exit 0, no actionable P0 findings. A separate source-only consumer check found no missing migration or changed omission/identity contract. Neither review is claimed as execution proof.

Native test targets, all run with Node 24.15.0, pinned pnpm 12.1.0 and clean-whitelist private HOME/state/config/XDG/TMP roots outside Git. Reporter/output-path arguments are omitted here; separate native JSON reports and exact launch receipts are retained locally.

node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run.harness-auth-failover.test.ts src/agents/embedded-agent-runner/run.session-permissions.test.ts
node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run.shared-integration.test.ts
node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run.inherited-auth-owner.test.ts
node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run.prepared-harness-credentials.test.ts
node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run.prepared-harness-source-delivery.integration.test.ts
node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run.terminal-timeout-delivery.integration.test.ts

The parent's first formatter launch failed during package-manager version preflight because it inherited a different checkout's working directory. Binding the launcher to this task checkout fixed the preflight; no source formatter or test ran in that failed attempt. It is not a product failure or a dependency change.

@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:04
@steipete
steipete requested a review from a team as a code owner August 30, 2026 09:04
@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
@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

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

ClawSweeper review

What this changes

The PR replaces a fixed embedded-run test workspace with per-test owned state and ensures delayed queued test work settles before fixture cleanup.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open for routine maintainer handling. This is a coherent test-only isolation repair, no blocking defect was found in the introduced change, and current main does not already contain the branch’s changed test files; the maintainer-owned item and protected label rule out automated cleanup closure.

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

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch uses the existing state owner at the producer boundary and adds focused lifecycle coverage without introducing production behavior.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-owned PR changes only internal test fixtures and supplies native test-run evidence in its body; it makes no changed user-facing, provider, channel, or runtime behavior claim.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-owned PR changes only internal test fixtures and supplies native test-run evidence in its body; it makes no changed user-facing, provider, channel, or runtime behavior claim.
Evidence reviewed 7 items Prior unsafe fixture: The previous shared parameter constant supplied a fixed workspace path; the PR replaces it with a workspace taken from the owned test state.
Canonical fixture binding: The new parameter factory derives workspaceDir from OpenClawTestState, preserving the existing logical run identifiers without adding runtime behavior.
Boundary regression coverage: The added guard intercepts the real metadata and repository consumers, rejects paths outside the fixture root before delegation, and verifies both consumers were exercised.
Findings None None.
Security None None.

How this fits together

Embedded-agent integration tests call the runner using fixture workspace, state, and session paths. The runner may invoke native metadata and repository discovery even when later attempt behavior is mocked, so the fixture must own those inputs until queued work settles.

flowchart LR
  Suites[Embedded-run test suites] --> Fixture[Owned test state]
  Fixture --> Params[Runner parameters]
  Params --> Runner[Embedded agent runner]
  Runner --> Readers[Metadata and repository readers]
  Runner --> Queue[Queued test work]
  Queue --> Cleanup[Fixture cleanup]
Loading

Decision needed

Question Recommendation
After exact-head checks finish, should this maintainer-owned test-isolation repair be merged? Merge after checks: Land the focused isolation repair when the remaining exact-head required checks are green.

Why: The patch is test-only and has no supported correctness blocker, but the current maintainer label and author association require explicit maintainer handling rather than automated closure.

Before merge

None.

Agent review details

Security

None.

PR surface

Source +275, Tests +74. Total +349 across 25 files.

View PR surface stats
Area Files Added Removed Net
Source 19 573 298 +275
Tests 6 131 57 +74
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 25 704 355 +349

Review metrics

Metric Value Why it matters
Production versus test delta production +0/-0; tests and test support +704/-355 All introduced changes are fixture or integration-test coverage; no shipped runtime path is modified.

Stored data model

Persistent data-model change detected: vector/embedding metadata: src/agents/embedded-agent-runner/run.workspace-ownership.test-support.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Retain the single owned-state fixture flow and land it once the exact-head required checks complete successfully.

Do we have a high-confidence way to reproduce the issue?

Not applicable: the reported failure is test-fixture ownership, and the PR supplies source-level boundary coverage rather than a user-facing defect reproduction.

Is this the best way to solve the issue?

Yes. Binding the existing parameter factory and warmup to OpenClawTestState fixes ownership at the fixture producer, while the guard and queue join cover the native-reader and delayed-work paths without production seams.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8243cc8a361c.

Labels

Label changes:

  • add P3: This is a bounded internal test-isolation repair without a claimed user-facing behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-owned PR changes only internal test fixtures and supplies native test-run evidence in its body; it makes no changed user-facing, provider, channel, or runtime behavior claim.

Label justifications:

  • P3: This is a bounded internal test-isolation repair without a claimed user-facing behavior change.
  • 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-owned PR changes only internal test fixtures and supplies native test-run evidence in its body; it makes no changed user-facing, provider, channel, or runtime behavior claim.

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)

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.

@steipete

Copy link
Copy Markdown
Contributor Author

Maintainer review is complete for head 5ce7518f720a2ce9af8ebde7642010b4083c8ecd. CI run 33303152919, attempt 1, completed successfully on that exact head. Native OPENCLAW_TESTBOX=1 scripts/pr prepare-run 133209 also completed without changing the head or needing another push. The PR body records the native test commands, Node/pnpm versions, private-environment setup and proof limits.

The final parent run passed 104 tests across all seven entrypoints, zero failures or skips. Its 79-case aggregate executed all sixteen imported suites in their original order. Safe original auth and shared-warmup failures were captured before unowned filesystem delegation. Real SQLite reconciliation/reopen, scoped handle cleanup, pending-backend assertions and failure-safe deferred-work joins remain covered. Complete classified checks passed; after bounded cleanup, the parent reran all 104 cases and scoped lint. Canonical isolated Codex P0 review and the independent consumer-contract check found no actionable issue.

ClawSweeper's requested maintainer handling and green-check conditions are satisfied. Its separate stored-data warning is a false positive: run.workspace-ownership.test-support.ts is a 57-line Vitest pass-through guard. Production is +0/-0; tests are +131/-57 and test support +573/-298. No schema, table, index, retention, migration or production persistence behavior changes, so there is no material store design to approve or migrate. The detector mismatch is recorded as a separate ClawSweeper follow-up, not worked around in OpenClaw's storage rules.

The 25-file fixture scope and nine critical owner/entrypoint paths were unchanged between tested base 6b68a4a42a01 and inspected main 8243cc8a361c. No source rebase, larger deadline, broader native mock, production seam or compatibility path was introduced. The original fixed workspace literal traces to 53df7ff86d19100b7cab90c7dddcc2b94bce5269, authored and committed by @gumadeiras on 2026-03-18. This identifies fixture origin, not the first later change that made every native reader reachable.

This remains synthetic fixture proof. No live provider, Codex, Gateway or channel behavior changed or was claimed verified. Proceeding through repository-native merge enforcement under the existing repair-and-land request.

@steipete
steipete merged commit eb06db6 into main Aug 30, 2026
241 checks passed
@steipete
steipete deleted the steipete/test-shared-run-fixture-20260830 branch August 30, 2026 09:29
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit to openclaw/clawsweeper that referenced this pull request Aug 30, 2026
Recognize colocated test-support files at the shared persistence and SQLite classifier boundary while preserving production, rename, and incomplete-evidence warnings. Regress the exact 57-line fixture from openclaw/openclaw#133209; production LOC remains net zero.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 31, 2026
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