@@ -3,7 +3,7 @@ import fs from "node:fs";
33import os from "node:os" ;
44import path from "node:path" ;
55import { truncateUtf16Safe } from "@openclaw/normalization-core/utf16-slice" ;
6- import { afterEach , describe , expect , it } from "vitest" ;
6+ import { afterEach , describe , expect , it , vi } from "vitest" ;
77import {
88 formatLegacyAgentMediaMigrationRequiredMessage ,
99 GATEWAY_AGENT_MEDIA_MIGRATION_REQUIRED_REASON ,
@@ -35,6 +35,7 @@ const GATEWAY_BOOT_LIFECYCLE_RETENTION_MS = 24 * 60 * 60_000;
3535
3636afterEach ( ( ) => {
3737 closeOpenClawStateDatabaseForTest ( ) ;
38+ vi . unstubAllEnvs ( ) ;
3839} ) ;
3940
4041function createLifecycleDb ( ) {
@@ -386,4 +387,25 @@ describe("formatGatewayCrashLoopManualChannelStartHint", () => {
386387 formatGatewayCrashLoopManualChannelStartHint ( { channelId : "telegram" , accountId : "work" } ) ,
387388 ) . toContain ( `--params '{"channel":"telegram","accountId":"work"}'` ) ;
388389 } ) ;
390+
391+ it . each ( [
392+ { name : "default" , profile : "" , container : "" , command : "openclaw" } ,
393+ { name : "named profile" , profile : "work" , container : "" , command : "openclaw --profile work" } ,
394+ { name : "container" , profile : "" , container : "demo" , command : "openclaw --container demo" } ,
395+ {
396+ name : "container and profile" ,
397+ profile : "work" ,
398+ container : "demo" ,
399+ command : "openclaw --container demo" ,
400+ } ,
401+ ] ) ( "targets the active gateway for $name" , ( { profile, container, command } ) => {
402+ vi . stubEnv ( "OPENCLAW_PROFILE" , profile ) ;
403+ vi . stubEnv ( "OPENCLAW_CONTAINER_HINT" , container ) ;
404+
405+ expect (
406+ formatGatewayCrashLoopManualChannelStartHint ( { channelId : "telegram" , accountId : "work" } ) ,
407+ ) . toBe (
408+ `Start a channel manually with: ${ command } gateway call channels.start --params '{"channel":"telegram","accountId":"work"}'` ,
409+ ) ;
410+ } ) ;
389411} ) ;
0 commit comments