fix: improve error handling and logging in summary and transcript processing
- Enhanced error handling in summary generation by using fallback messages for missing assistant messages. - Updated the `buildSummaryPrompt` function to streamline the retrieval of the last assistant message. - Improved the `extractLastMessage` function to log errors when transcript files are missing or empty, and to ensure proper handling of messages without content. - Added checks to ensure that messages of the specified role are found in the transcript, with appropriate logging for missing messages. - Refactored the logging mechanism to provide clearer insights into processing failures and successes.
This commit is contained in:
+2
-2
@@ -177,10 +177,10 @@ export function buildObservationPrompt(obs: Observation): string {
|
||||
* Build prompt to generate progress summary
|
||||
*/
|
||||
export function buildSummaryPrompt(session: SDKSession): string {
|
||||
const lastAssistantMessage = happy_path_error__with_fallback(
|
||||
const lastAssistantMessage = session.last_assistant_message || happy_path_error__with_fallback(
|
||||
'Missing last_assistant_message in session for summary prompt',
|
||||
session,
|
||||
session.last_assistant_message || ''
|
||||
''
|
||||
);
|
||||
|
||||
return `PROGRESS SUMMARY CHECKPOINT
|
||||
|
||||
Reference in New Issue
Block a user