Skip to content

fix(test): isolate shared state between test files - #118781

Merged
vincentkoc merged 6 commits into
mainfrom
codex/beta8-session-isolation-20260803
Aug 4, 2026
Merged

vincentkoc merged 6 commits into
mainfrom
codex/beta8-session-isolation-20260803

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 3, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Resolves release-gate failures from shared test workers carrying state across files:

  • Non-isolated agent tests could retain process-global session-suspension state. A pending fire-and-forget suspension could also regain ownership after cleanup because the reset reused generation 0.
  • Three Control UI suites could inherit constructors and mocks from predecessor files because the shared UI worker reuses its module graph while jsdom creates a fresh custom-element registry.
  • The accepted workspace-wide Undici 7 resolution must remain pinned to patched release 7.29.0 for current v7 consumers.

Why This Change Was Made

The non-isolated runner now invokes the session-suspension owner's existing test reset after every file. The owner reset advances its generation before clearing state, so older pending writes cannot become current again.

The archived-sessions, memory-panel, and custom-theme UI suites now use the existing isolated UI lane. Their module mocks and custom-element registrations receive a matching fresh graph without slowing the rest of the shared UI suite.

The workspace retains the maintainer-accepted undici@7 override at 7.29.0. Current main already carries the direct Slack 7.29.0 dependency and fast-uri 4.1.2.

User Impact

No product behavior changes. Maintainers get deterministic agent and UI release-gate tests, and current Undici 7 consumers remain on the accepted patched release.

Evidence

  • Exact branch head: 3b7d8e28e5d5580b6b1832b40ae0c39d2b0204e8.
  • Exact-head Testbox check:changed passed dependency pins, package locks, typecheck, lint, dead-code, database-first, sidecar, and import-cycle guards.
  • Exact-head one-worker shared UI passed 527 files / 7,794 tests; the isolated UI project passed 21 files / 401 tests: https://github.com/openclaw/openclaw/actions/runs/30886547381
  • Fresh autoreview reported no accepted/actionable findings and patch correctness 0.98.
  • Exact-head ClawSweeper found no actionable source or security finding and rated the patch 5/6.
  • git diff --check passes.
  • Native review artifacts validate with zero findings. scripts/pr prepare-run remains the final pre-merge gate after hosted CI completes.

@vincentkoc vincentkoc self-assigned this Aug 3, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 3, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. labels Aug 3, 2026
@clawsweeper

clawsweeper Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 4, 2026, 3:12 AM ET / 07:12 UTC.

ClawSweeper review

What this changes

The branch resets session-suspension test state between shared files, isolates three stateful Control UI suites, and adds an exact Undici 7.29.0 workspace override.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

The PR is still necessary: current main retains the shared-state leak, while the branch repairs the owner boundary and routes the affected UI tests through the existing isolation mechanism. It is maintainer-authored and has an accepted dependency decision; wait for exact-head CI before merge.

Priority: P2
Reviewed head: 3b7d8e28e5d5580b6b1832b40ae0c39d2b0204e8

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) The patch uses existing ownership and isolation seams, adds focused regressions, and supplies substantial validation evidence; exact-head CI remains the final merge gate.
Proof confidence 🦞 diamond lobster (5/6) Not applicable: This is a maintainer-authored test and dependency PR, so the external-contributor proof gate does not apply; the body nevertheless links prior Testbox and CI evidence.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is a maintainer-authored test and dependency PR, so the external-contributor proof gate does not apply; the body nevertheless links prior Testbox and CI evidence.
Evidence reviewed 5 items Current-main gap and PR owner-boundary repair: Current main resets session-suspension state without advancing its generation and the shared runner does not invoke that reset; the PR increments the generation before clearing state and calls the owner’s test API after each non-isolated file.
Regression coverage follows the original cross-file path: The branch adds an ordered, real process-global state test for the non-isolated runner and a pending-write/reset race regression at the state owner.
UI isolation uses the canonical routing seam: The shared UI configuration excludes every canonical isolated path, while the isolated configuration executes that same list with isolation enabled; the added paths therefore do not create a parallel test-routing policy.
Findings None None.
Security None None.

How this fits together

OpenClaw’s shared Vitest runner reuses a worker and module graph across files, so it must reset owner-managed global state before the next file. The UI test configuration separately routes registry-sensitive tests to an isolated jsdom worker, while workspace overrides determine resolved package versions.

flowchart LR
A[Test files] --> B[Shared Vitest worker]
B --> C[After-file cleanup]
C --> D[Session suspension state owner]
C --> E[Next shared test file]
F[Stateful UI tests] --> G[Isolated UI worker]
H[Workspace override] --> I[Resolved dependency graph]
Loading

Before merge

  • Resolve merge risk (P1) - The accepted workspace-wide Undici v7 override changes resolution for existing v7 consumers; exact-head dependency and test checks should complete before merge.
  • Resolve merge risk (P1) - The PR is behind current main, so merge should be based on GitHub’s clean three-way result and an exact-head review refresh rather than assuming branch drift deletes main-only work.
  • Complete next step (P2) - This maintainer-authored, protected-label PR needs the running exact-head checks and final clean-merge review rather than an automated repair branch.
Agent review details

Security

None.

PR surface

Source +2, Tests +127, Config +1, Other +1. Total +131 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 1 3 1 +2
Tests 4 127 0 +127
Docs 0 0 0 0
Config 1 1 0 +1
Generated 0 0 0 0
Other 1 1 0 +1
Total 7 132 1 +131

Review metrics

Metric Value Why it matters
Production versus test LOC production +20/-1, tests +112/-0 Production growth is limited to the test-state ownership boundary, existing UI isolation list, and an exact dependency contract; most added lines are regression coverage.
Workspace dependency override 1 added: undici@7 → 7.29.0 The override affects all current Undici v7 consumers, so the accepted scope and exact-head resolution matter before merge.

Stored data model

Persistent data-model change detected: serialized state: src/agents/session-suspension.test.ts, serialized state: src/agents/session-suspension.ts, serialized state: test/non-isolated-runner.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Validate the accepted dependency override (recommended)
    Wait for exact-head dependency and test checks, then merge only if the clean result still resolves Undici 7.29.0 for current v7 consumers.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Wait for all exact-head checks and confirm the clean merge result preserves the accepted undici@7 override.

Technical review

Best possible solution:

Merge the clean three-way result after exact-head CI confirms the state-reset regressions and accepted Undici v7 resolution remain intact.

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

Yes: source shows the shared runner omitted this owner reset, and the added ordered runner regression plus pending-write race test establish the affected current code path without executing it in this read-only review.

Is this the best way to solve the issue?

Yes: the fix invalidates state at its owner and uses the canonical UI isolation list, avoiding consumer-side cleanup or a duplicate test-routing flow.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8393b37779d9.

Labels

Label justifications:

  • P2: This improves release-gate determinism and dependency posture without a demonstrated current user-runtime outage.
  • merge-risk: 🚨 compatibility: The workspace-wide Undici v7 override changes resolution for existing consumers despite its explicitly accepted scope.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a maintainer-authored test and dependency PR, so the external-contributor proof gate does not apply; the body nevertheless links prior Testbox and CI evidence.

Evidence

What I checked:

  • Current-main gap and PR owner-boundary repair: Current main resets session-suspension state without advancing its generation and the shared runner does not invoke that reset; the PR increments the generation before clearing state and calls the owner’s test API after each non-isolated file. (src/agents/session-suspension.ts:452, 3b7d8e28e5d5)
  • Regression coverage follows the original cross-file path: The branch adds an ordered, real process-global state test for the non-isolated runner and a pending-write/reset race regression at the state owner. (test/non-isolated-runner.test.ts:199, 3b7d8e28e5d5)
  • UI isolation uses the canonical routing seam: The shared UI configuration excludes every canonical isolated path, while the isolated configuration executes that same list with isolation enabled; the added paths therefore do not create a parallel test-routing policy. (test/vitest/vitest.ui-isolated-paths.mjs:10, 3b7d8e28e5d5)
  • Dependency scope and maintainer decision: The PR adds only an exact Undici v7 override; the lockfile already identifies Slack’s v7 consumer path and retains Undici 8.9.0. The supplied maintainer comment explicitly accepts the workspace-wide v7 scope. (pnpm-workspace.yaml:131, 7a4a6ddb87be)
  • Feature provenance: Blame ties the monotonic generation change to the PR commit and the after-file reset call to its introducing commit, both authored by Vincent Koc. (src/agents/session-suspension.ts:456, ecc4e2050246)

Likely related people:

  • Vincent Koc: Exact-line blame attributes the generation invalidation and shared-runner reset to this person’s PR commits; current-main history also shows recent work in the same files. (role: introduced the repair and recent area contributor; confidence: high; commits: 9aebfe7b6b7a, ecc4e2050246, 7a4a6ddb87be; files: src/agents/session-suspension.ts, test/non-isolated-runner.ts, pnpm-workspace.yaml)

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 (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-03T17:45:43.333Z sha f59b7c9 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-03T19:03:12.029Z sha 89c4280 :: needs changes before merge. :: [P1] Route isolated UI targets through the focused wrapper
  • reviewed 2026-08-03T19:08:52.989Z sha 89c4280 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-03T20:01:39.737Z sha 89c4280 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-03T20:13:20.089Z sha e61df17 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-03T22:21:16.318Z sha 2d601ec :: needs maintainer review before merge. :: none
  • reviewed 2026-08-03T23:06:53.384Z sha 2d601ec :: needs maintainer review before merge. :: none
  • reviewed 2026-08-04T03:19:23.979Z sha 5b540b4 :: needs maintainer review before merge. :: none

@vincentkoc
vincentkoc force-pushed the codex/beta8-session-isolation-20260803 branch from a28a0b6 to cd1faee Compare August 3, 2026 17:28
@clawsweeper clawsweeper Bot added 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. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 3, 2026
@vincentkoc
vincentkoc force-pushed the codex/beta8-session-isolation-20260803 branch from cd1faee to f59b7c9 Compare August 3, 2026 17:39
@vincentkoc vincentkoc changed the title fix(test): isolate session suspension state fix(test): stabilize the full agentic shard Aug 3, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 3, 2026
@vincentkoc
vincentkoc force-pushed the codex/beta8-session-isolation-20260803 branch 2 times, most recently from 1b136d0 to a81734a Compare August 3, 2026 18:17
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Aug 3, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc vincentkoc changed the title fix(test): stabilize the full agentic shard fix(test): isolate session suspension state between files Aug 3, 2026
@vincentkoc
vincentkoc force-pushed the codex/beta8-session-isolation-20260803 branch 3 times, most recently from ba52e58 to 89c4280 Compare August 3, 2026 18:36
@vincentkoc vincentkoc changed the title fix(test): isolate session suspension state between files fix(test): isolate shared state between test files Aug 3, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Aug 3, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Aug 3, 2026
@vincentkoc
vincentkoc requested a review from a team as a code owner August 3, 2026 20:08
@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Dependency Guard

This PR changes dependency-related files. Maintainers should confirm these changes are intentional.

Changed files:

  • pnpm-lock.yaml
  • pnpm-workspace.yaml

Maintainer follow-up:

  • Review whether the dependency changes are intentional.
  • Inspect resolved package deltas when lockfiles or workspace dependency policy changes are present.
  • Treat pnpm-lock.yaml and package-lock.json diffs as dependency security-review surfaces.
  • Run pnpm deps:changes:report -- --base-ref origin/main --markdown /tmp/dependency-changes.md --json /tmp/dependency-changes.json locally for detailed release-style evidence.

@github-actions

github-actions Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Dependency graph changes noted

This PR includes dependency graph changes. The dependency guard is informational because the PR author is a repository admin or a member of @openclaw/openclaw-secops.

  • Current SHA: 3b7d8e28e5d5580b6b1832b40ae0c39d2b0204e8
  • Trusted actor: @vincentkoc
  • Trusted role: pull request author; openclaw-secops

Security review is still recommended before merge when the dependency graph change is intentional.

@clawsweeper clawsweeper Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Aug 3, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

Maintainer decision: the workspace-wide exact undici@7 7.29.0 override is intentional and accepted. It prevents future lock refreshes from reintroducing the vulnerable Undici 7 release across current v7 consumers while leaving Undici 8 unchanged.

The other ClawSweeper rank-up move is also complete: exact-head scheduled CI for 2d601ecd0c077b5a94b45cb783b1b342a1558a7c finished with 82 successful, 0 failing checks. Fresh autoreview is clean with no accepted/actionable findings.

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 3, 2026
@vincentkoc
vincentkoc force-pushed the codex/beta8-session-isolation-20260803 branch from 5b540b4 to 3b7d8e2 Compare August 4, 2026 07:07
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. label Aug 4, 2026
@vincentkoc
vincentkoc merged commit 4564386 into main Aug 4, 2026
130 of 131 checks passed
@vincentkoc
vincentkoc deleted the codex/beta8-session-isolation-20260803 branch August 4, 2026 07:26
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 4, 2026
* origin/main:
  fix(test): isolate shared state between test files (#118781)
  fix(telegram): use monotonic polling liveness
  fix(setup): keep compatible Claude wrappers selectable
  fix(agents): gate Claude live session protocol
  fix(agents): preserve Claude fork successor on stalls
  fix(agents): preserve Claude follow-up replies after background tasks
  fix: unblock macOS release validation (#119110)
  improve(qa): cover vision channel offload (#118862)
  test(qa): cover sandboxed exec behavior (#119053)
  fix(ai): preserve Google simple completion sanitation
  fix(macos): keep setup activation within app checks
  fix(tts): use prepared completion transport
  fix(ai): prefer provider-owned completion streams
  test(setup): type provider kind fixture
  fix(setup): complete prepared model activation
  fix(protocol): regenerate Swift wizard models
  fix(ollama): activate the model selected during setup
  fix(setup): preserve the prepared model handoff
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 5, 2026
* fix(test): isolate session suspension state

* fix(test): isolate nonzero worker exit coverage

* fix(test): keep suspension reset generations monotonic

* fix(test): isolate archived session UI mocks

* fix(deps): patch fast-uri and undici advisories

* fix(test): isolate stateful UI suites
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 5, 2026
* origin/main:
  fix(test): isolate shared state between test files (openclaw#118781)
  fix(telegram): use monotonic polling liveness
  fix(setup): keep compatible Claude wrappers selectable
  fix(agents): gate Claude live session protocol
  fix(agents): preserve Claude fork successor on stalls
  fix(agents): preserve Claude follow-up replies after background tasks
  fix: unblock macOS release validation (openclaw#119110)
  improve(qa): cover vision channel offload (openclaw#118862)
  test(qa): cover sandboxed exec behavior (openclaw#119053)
  fix(ai): preserve Google simple completion sanitation
  fix(macos): keep setup activation within app checks
  fix(tts): use prepared completion transport
  fix(ai): prefer provider-owned completion streams
  test(setup): type provider kind fixture
  fix(setup): complete prepared model activation
  fix(protocol): regenerate Swift wizard models
  fix(ollama): activate the model selected during setup
  fix(setup): preserve the prepared model handoff
zyw02 pushed a commit to zyw02/openclaw that referenced this pull request Aug 5, 2026
* origin/main:
  fix: prevent live updater from leaving Gateway offline indefinitely (openclaw#119116)
  test(qa): restore memory tools primary ownership (openclaw#119142)
  fix(agents): settle yielded fanout at harness boundary (openclaw#118703)
  fix(codex): cap compaction override warning cache via createDedupeCache (openclaw#101745)
  fix(daemon): skip unlabeled launchd plists (openclaw#119091)
  test(qa): repair QA catalog integrity (openclaw#119140)
  fix(test): isolate shared state between test files (openclaw#118781)
  test(xai): cover delayed OAuth connection setup
  fix(voice): start socket timeout after auth preparation
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 6, 2026
* origin/main:
  fix: prevent live updater from leaving Gateway offline indefinitely (openclaw#119116)
  test(qa): restore memory tools primary ownership (openclaw#119142)
  fix(agents): settle yielded fanout at harness boundary (openclaw#118703)
  fix(codex): cap compaction override warning cache via createDedupeCache (openclaw#101745)
  fix(daemon): skip unlabeled launchd plists (openclaw#119091)
  test(qa): repair QA catalog integrity (openclaw#119140)
  fix(test): isolate shared state between test files (openclaw#118781)
  test(xai): cover delayed OAuth connection setup
  fix(voice): start socket timeout after auth preparation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling dependencies-changed PR changes dependency-related files maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S 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