@@ -215,16 +215,57 @@ describe("OpenClaw performance workflow", () => {
215215 } ) ;
216216
217217 it ( "keeps live credentials away from custom Kova refs" , ( ) => {
218+ const resolveTarget = findStep ( "Resolve OpenClaw target ref" , "resolve_target" ) ;
218219 const decideLane = findStep ( "Decide lane" ) ;
219220 const configureLiveAuth = findStep ( "Configure live OpenAI auth" ) ;
220221 const runKova = findStep ( "Run Kova" ) ;
221222 const root = mkdtempSync ( join ( realpathSync ( tmpdir ( ) ) , "openclaw-kova-live-ref-" ) ) ;
222- const output = join ( root , "output" ) ;
223+ const trustedRef = "1fe2f4081877bb12b7f7ed355349f98b8a0a6882" ;
224+ const compatibleUntrustedRef = "0f9e678e239b45db46d2bd930b7983203580df78" ;
223225 const decideLaneRun = ( decideLane . run ?? "" )
224226 . replaceAll ( "${{ github.event_name }}" , "workflow_dispatch" )
225227 . replaceAll ( "${{ inputs.deep_profile || 'false' }}" , "false" )
226228 . replaceAll ( "${{ inputs.live_openai_candidate || 'false' }}" , "true" ) ;
227229
230+ const runBoundary = ( kovaRef : string , name : string ) => {
231+ const resolveOutput = join ( root , `${ name } -resolve-output` ) ;
232+ const laneOutput = join ( root , `${ name } -lane-output` ) ;
233+ const resolve = spawnSync ( "bash" , [ "-c" , resolveTarget . run ?? "" ] , {
234+ encoding : "utf8" ,
235+ env : {
236+ ...process . env ,
237+ GITHUB_OUTPUT : resolveOutput ,
238+ GITHUB_REF_NAME : "fix/kova-runtime-major-baseline" ,
239+ KOVA_CANONICAL_CONFIG_REF : compatibleUntrustedRef ,
240+ KOVA_CONFIG_CONTRACT_INPUT : "canonical" ,
241+ KOVA_LEGACY_LIST_CONFIG_REF : compatibleUntrustedRef ,
242+ KOVA_REF_INPUT : kovaRef ,
243+ KOVA_TRUSTED_LIVE_REF : trustedRef ,
244+ TARGET_CHECKOUT_DIR : process . cwd ( ) ,
245+ TARGET_REF_INPUT : "test-head" ,
246+ } ,
247+ } ) ;
248+ expect ( resolve . status , resolve . stderr ) . toBe ( 0 ) ;
249+ const resolved = Object . fromEntries (
250+ readFileSync ( resolveOutput , "utf8" )
251+ . trim ( )
252+ . split ( "\n" )
253+ . map ( ( line ) => line . split ( "=" , 2 ) ) ,
254+ ) ;
255+ const lane = spawnSync ( "bash" , [ "-c" , decideLaneRun ] , {
256+ encoding : "utf8" ,
257+ env : {
258+ ...process . env ,
259+ GITHUB_OUTPUT : laneOutput ,
260+ GITHUB_STEP_SUMMARY : join ( root , `${ name } -summary` ) ,
261+ KOVA_REF_TRUSTED_FOR_LIVE : resolved . kova_ref_trusted_for_live ,
262+ LANE_ID : "live-openai-candidate" ,
263+ SECRET_ELIGIBLE : "true" ,
264+ } ,
265+ } ) ;
266+ return { lane, laneOutput, resolved } ;
267+ } ;
268+
228269 expect ( decideLane . run ) . toContain (
229270 'if [[ "$LANE_ID" == "live-openai-candidate" && "$run_lane" == "true" && "$KOVA_REF_TRUSTED_FOR_LIVE" != "true" ]]; then' ,
230271 ) ;
@@ -245,33 +286,18 @@ describe("OpenClaw performance workflow", () => {
245286 ) ;
246287
247288 try {
248- const rejected = spawnSync ( "bash" , [ "-c" , decideLaneRun ] , {
249- encoding : "utf8" ,
250- env : {
251- ...process . env ,
252- GITHUB_OUTPUT : output ,
253- KOVA_REF_TRUSTED_FOR_LIVE : "false" ,
254- LANE_ID : "live-openai-candidate" ,
255- SECRET_ELIGIBLE : "true" ,
256- } ,
257- } ) ;
258- expect ( rejected . status ) . toBe ( 1 ) ;
259- expect ( rejected . stdout ) . toContain (
289+ const rejected = runBoundary ( compatibleUntrustedRef , "untrusted" ) ;
290+ expect ( rejected . resolved . kova_ref_trusted_for_live ) . toBe ( "false" ) ;
291+ expect ( rejected . lane . status ) . toBe ( 1 ) ;
292+ expect ( rejected . lane . stdout ) . toContain (
260293 "The live OpenAI lane only executes a reviewed immutable Kova default." ,
261294 ) ;
295+ expect ( existsSync ( rejected . laneOutput ) ) . toBe ( false ) ;
262296
263- const accepted = spawnSync ( "bash" , [ "-c" , decideLaneRun ] , {
264- encoding : "utf8" ,
265- env : {
266- ...process . env ,
267- GITHUB_OUTPUT : output ,
268- KOVA_REF_TRUSTED_FOR_LIVE : "true" ,
269- LANE_ID : "live-openai-candidate" ,
270- SECRET_ELIGIBLE : "true" ,
271- } ,
272- } ) ;
273- expect ( accepted . status ) . toBe ( 0 ) ;
274- expect ( readFileSync ( output , "utf8" ) ) . toContain ( "run=true\n" ) ;
297+ const accepted = runBoundary ( trustedRef , "trusted" ) ;
298+ expect ( accepted . resolved . kova_ref_trusted_for_live ) . toBe ( "true" ) ;
299+ expect ( accepted . lane . status ) . toBe ( 0 ) ;
300+ expect ( readFileSync ( accepted . laneOutput , "utf8" ) ) . toContain ( "run=true\n" ) ;
275301 } finally {
276302 rmSync ( root , { force : true , recursive : true } ) ;
277303 }
0 commit comments