@@ -19,6 +19,7 @@ import {
1919 getRuntimeConfigSnapshot ,
2020 setRuntimeConfigSnapshot ,
2121} from "../config/runtime-snapshot.js" ;
22+ import { deleteExecApprovalsConfigRow } from "../infra/exec-approvals-sqlite.js" ;
2223import { testing as execApprovalsStoreTesting } from "../infra/exec-approvals-store.test-support.js" ;
2324import type { SystemRunApprovalPlan } from "../infra/exec-approvals.js" ;
2425import {
@@ -30,8 +31,10 @@ import {
3031import type { ExecAutoReviewer } from "../infra/exec-auto-review.js" ;
3132import type { ExecHostResponse } from "../infra/exec-host.js" ;
3233import { formatExecCommand } from "../infra/system-run-command.js" ;
33- import { closeOpenClawStateDatabaseForTest } from "../state/openclaw-state-db.js" ;
34- import { resolveOpenClawStateSqlitePath } from "../state/openclaw-state-db.paths.js" ;
34+ import {
35+ closeOpenClawStateDatabaseForTest ,
36+ openOpenClawStateDatabase ,
37+ } from "../state/openclaw-state-db.js" ;
3538import { withEnvAsync } from "../test-utils/env.js" ;
3639import { buildSystemRunApprovalPlan } from "./invoke-system-run-plan.js" ;
3740import { handleSystemRunInvoke } from "./invoke-system-run.js" ;
@@ -58,6 +61,7 @@ describe("handleSystemRunInvoke mac app exec host routing", () => {
5861 const sharedRuntimeBins = new Set < string > ( ) ;
5962
6063 beforeAll ( ( ) => {
64+ closeOpenClawStateDatabaseForTest ( ) ;
6165 sharedFixtureRoot = fs . realpathSync (
6266 fs . mkdtempSync ( path . join ( os . tmpdir ( ) , "openclaw-node-host-fixtures-" ) ) ,
6367 ) ;
@@ -68,6 +72,7 @@ describe("handleSystemRunInvoke mac app exec host routing", () => {
6872 } ) ;
6973
7074 afterAll ( ( ) => {
75+ closeOpenClawStateDatabaseForTest ( ) ;
7176 if ( sharedFixtureRoot ) {
7277 fs . rmSync ( sharedFixtureRoot , { recursive : true , force : true } ) ;
7378 }
@@ -82,14 +87,13 @@ describe("handleSystemRunInvoke mac app exec host routing", () => {
8287 beforeEach ( ( ) => {
8388 previousOpenClawHome = process . env . OPENCLAW_HOME ;
8489 process . env . OPENCLAW_HOME = sharedOpenClawHome ;
85- closeOpenClawStateDatabaseForTest ( ) ;
86- fs . rmSync ( resolveOpenClawStateSqlitePath ( ) , { force : true } ) ;
8790 execApprovalsStoreTesting . reset ( ) ;
91+ // Cases isolate the canonical policy row, not shared-state schema bootstrap.
92+ deleteExecApprovalsConfigRow ( openOpenClawStateDatabase ( ) . db ) ;
8893 clearRuntimeConfigSnapshot ( ) ;
8994 } ) ;
9095
9196 afterEach ( ( ) => {
92- closeOpenClawStateDatabaseForTest ( ) ;
9397 execApprovalsStoreTesting . reset ( ) ;
9498 clearRuntimeConfigSnapshot ( ) ;
9599 if ( previousOpenClawHome === undefined ) {
0 commit comments