@@ -4390,7 +4390,12 @@ heartbeat_elapsed="\${BASH_REMATCH[1]}"
43904390
43914391 expectTextToIncludeAll ( scenario , [
43924392 'command_timeout="${OPENCLAW_DOCKER_DOCTOR_SWITCH_COMMAND_TIMEOUT:-900s}"' ,
4393- 'openclaw_test_state_create "$account_home" empty\n unset OPENCLAW_HOME OPENCLAW_STATE_DIR OPENCLAW_CONFIG_PATH' ,
4393+ [
4394+ 'openclaw_test_state_create "$account_home" empty' ,
4395+ ' export HOME="$account_home"' ,
4396+ ' export USERPROFILE="$account_home"' ,
4397+ " unset OPENCLAW_HOME OPENCLAW_STATE_DIR OPENCLAW_CONFIG_PATH" ,
4398+ ] . join ( "\n" ) ,
43944399 "create_default_service_state" ,
43954400 'openclaw_e2e_maybe_timeout "$command_timeout" bash -c "$install_cmd"' ,
43964401 'openclaw_e2e_maybe_timeout "$command_timeout" bash -c "$doctor_cmd"' ,
@@ -4401,9 +4406,28 @@ heartbeat_elapsed="\${BASH_REMATCH[1]}"
44014406 expect (
44024407 scenario . match ( / u n s e t O P E N C L A W _ H O M E O P E N C L A W _ S T A T E _ D I R O P E N C L A W _ C O N F I G _ P A T H / gu) ,
44034408 ) . toHaveLength ( 1 ) ;
4409+ expect ( scenario . match ( / e x p o r t U S E R P R O F I L E = " \$ a c c o u n t _ h o m e " / gu) ) . toHaveLength ( 1 ) ;
44044410 expect ( scenario ) . not . toMatch ( / ^ \s * i f ! t i m e o u t " \$ c o m m a n d _ t i m e o u t " / mu) ;
44054411 } ) ;
44064412
4413+ it ( "uses the account home for upgrade survivor auto-auth state" , ( ) => {
4414+ const runner = readFileSync ( UPGRADE_SURVIVOR_RUN_SCRIPT , "utf8" ) ;
4415+
4416+ expectTextToIncludeAll ( runner , [
4417+ 'if [ "$UPDATE_RESTART_MODE" = "auto-auth" ]; then' ,
4418+ 'account_home="$(getent passwd "$(id -u)" | cut -d: -f6)"' ,
4419+ 'if [ -z "$account_home" ]; then' ,
4420+ 'export HOME="$account_home"' ,
4421+ 'export USERPROFILE="$account_home"' ,
4422+ 'export OPENCLAW_STATE_DIR="$account_home/.openclaw"' ,
4423+ 'export OPENCLAW_CONFIG_PATH="$OPENCLAW_STATE_DIR/openclaw.json"' ,
4424+ ] ) ;
4425+
4426+ expect (
4427+ runner . indexOf ( 'export OPENCLAW_CONFIG_PATH="$OPENCLAW_STATE_DIR/openclaw.json"' ) ,
4428+ ) . toBeLessThan ( runner . indexOf ( "node scripts/e2e/lib/upgrade-survivor/assertions.mjs seed" ) ) ;
4429+ } ) ;
4430+
44074431 it ( "bounds doctor install switch command log diagnostics" , ( ) => {
44084432 const scenario = readFileSync ( DOCTOR_SWITCH_SCENARIO_PATH , "utf8" ) ;
44094433
0 commit comments