@@ -78,11 +78,15 @@ import (
7878// @Description [{"port":0,"status":"string","process":"string","forward_id":"string?","access_url":"string?","label":"string?","error_message":"string?","whitelist_ips":["string"]}]
7979// @Description ```
8080// @Description
81- // @Description ### Type=call, Kind=restart — 重启任务(无 call-response 返回)
81+ // @Description ### Type=call, Kind=restart — 重启任务
8282// @Description 请求 Data:
8383// @Description ```json
8484// @Description {"request_id":"string?","load_session":true}
8585// @Description ```
86+ // @Description 响应 Data:
87+ // @Description ```json
88+ // @Description {"id":"uuid","request_id":"string?","success":true,"message":"string","session_id":"string"}
89+ // @Description ```
8690// @Description
8791// @Description ### Type=sync-my-ip — 同步 Web 客户端真实 IP
8892// @Description 请求 Data:
@@ -92,7 +96,7 @@ import (
9296// @Description
9397// @Description ## 下行消息
9498// @Description
95- // @Description - Type=call-response: 同步请求响应(Kind 与请求一致,restart 除外 )。失败时 Data 为:
99+ // @Description - Type=call-response: 同步请求响应(Kind 与请求一致)。失败时 Data 为:
96100// @Description ```json
97101// @Description {"error":"string"}
98102// @Description ```
@@ -238,6 +242,7 @@ func (h *TaskHandler) controlReadMessages(ctx context.Context, wsConn *ws.Websoc
238242 logger .WarnContext (ctx , "failed to unmarshal control message" , "error" , err , "data" , string (d ))
239243 continue
240244 }
245+ h .logger .With ("task req" , m , "task_id" , task .ID ).DebugContext (ctx , "recv task message" )
241246
242247 switch m .Type {
243248 case consts .TaskStreamTypeCall :
@@ -252,24 +257,20 @@ func (h *TaskHandler) controlReadMessages(ctx context.Context, wsConn *ws.Websoc
252257func (h * TaskHandler ) handleControlCall (ctx context.Context , wsConn * ws.WebsocketManager , logger * slog.Logger , task * domain.Task , m domain.TaskStream ) {
253258 taskID := task .ID .String ()
254259
255- // restart 是 fire-and-forget,无响应
256- if m .Kind == "restart" {
260+ var result any
261+ var err error
262+
263+ switch m .Kind {
264+ case "restart" :
257265 var req taskflow.RestartTaskReq
258266 if err := json .Unmarshal (m .Data , & req ); err != nil {
259267 logger .WarnContext (ctx , "failed to unmarshal restart task" , "error" , err )
260268 return
261269 }
270+ h .logger .With ("restart" , req , "task_id" , task .ID ).DebugContext (ctx , "recv restart call" )
262271 req .ID = task .ID
263- if err := h .taskflow .TaskManager ().Restart (ctx , req ); err != nil {
264- logger .WarnContext (ctx , "failed to restart task" , "error" , err )
265- }
266- return
267- }
272+ result , err = h .taskflow .TaskManager ().Restart (ctx , req )
268273
269- var result any
270- var err error
271-
272- switch m .Kind {
273274 case "repo_file_diff" :
274275 var req taskflow.RepoFileDiffReq
275276 if err := json .Unmarshal (m .Data , & req ); err != nil {
0 commit comments