@@ -66,6 +66,7 @@ import { resolveAgentMainSessionKey } from "../../config/sessions/main-session.j
6666import {
6767 applySessionPatchProjection ,
6868 createSessionEntryWithTranscript ,
69+ readTranscriptTailLines ,
6970 trimSessionTranscriptForManualCompact ,
7071} from "../../config/sessions/session-accessor.js" ;
7172import type { OpenClawConfig } from "../../config/types.openclaw.js" ;
@@ -107,7 +108,6 @@ import {
107108import { reactivateCompletedSubagentSession } from "../session-subagent-reactivation.js" ;
108109import {
109110 readRecentSessionMessagesWithStatsAsync ,
110- readRecentSessionTranscriptLines ,
111111 readSessionMessageCountAsync ,
112112 readSessionPreviewItemsFromTranscript ,
113113} from "../session-transcript-readers.js" ;
@@ -1385,12 +1385,12 @@ function summarizeDiagnose(params: {
13851385 } ;
13861386}
13871387
1388- function buildDiagnoseResult ( params : {
1388+ async function buildDiagnoseResult ( params : {
13891389 cfg : OpenClawConfig ;
13901390 context : GatewayRequestContext ;
13911391 p : DiagnoseParams ;
13921392 target : DiagnoseTarget ;
1393- } ) : SessionsDiagnoseResult {
1393+ } ) : Promise < SessionsDiagnoseResult > {
13941394 const { cfg, context, p, target } = params ;
13951395 const now = Date . now ( ) ;
13961396 const defaultAgentId = resolveDefaultAgentId ( cfg ) ;
@@ -1451,7 +1451,7 @@ function buildDiagnoseResult(params: {
14511451 } ;
14521452 const lane = getCommandLaneSnapshot ( resolveSessionLane ( target . key ) ) ;
14531453 const tail = target . entry . sessionId
1454- ? readRecentSessionTranscriptLines ( {
1454+ ? await readTranscriptTailLines ( {
14551455 sessionId : target . entry . sessionId ,
14561456 storePath : target . storePath ,
14571457 sessionFile : target . entry . sessionFile ,
@@ -1863,7 +1863,7 @@ export const sessionsHandlers: GatewayRequestHandlers = {
18631863 ) ;
18641864 return ;
18651865 }
1866- respond ( true , buildDiagnoseResult ( { cfg, context, p, target } ) , undefined ) ;
1866+ respond ( true , await buildDiagnoseResult ( { cfg, context, p, target } ) , undefined ) ;
18671867 } catch ( error ) {
18681868 respond ( false , undefined , errorShape ( ErrorCodes . INVALID_REQUEST , formatErrorMessage ( error ) ) ) ;
18691869 }
0 commit comments