@@ -834,20 +834,23 @@ impl AgentCheckpointPreset for GithubCopilotPreset {
834834 }
835835
836836 // Required working directory provided by the extension
837+ // Accept snake_case (new) with fallback to camelCase (old) for backward compatibility
837838 let repo_working_dir: String = hook_data
838- . get ( "workspaceFolder " )
839+ . get ( "workspace_folder " )
839840 . and_then ( |v| v. as_str ( ) )
841+ . or_else ( || hook_data. get ( "workspaceFolder" ) . and_then ( |v| v. as_str ( ) ) )
840842 . ok_or_else ( || {
841843 GitAiError :: PresetError (
842- "workspaceFolder not found in hook_input for GitHub Copilot preset" . to_string ( ) ,
844+ "workspace_folder or workspaceFolder not found in hook_input for GitHub Copilot preset" . to_string ( ) ,
843845 )
844846 } ) ?
845847 . to_string ( ) ;
846848
847- // Extract dirtyFiles if available
849+ // Extract dirty_files if available (snake_case with fallback to camelCase)
848850 let dirty_files = hook_data
849- . get ( "dirtyFiles " )
851+ . get ( "dirty_files " )
850852 . and_then ( |v| v. as_object ( ) )
853+ . or_else ( || hook_data. get ( "dirtyFiles" ) . and_then ( |v| v. as_object ( ) ) )
851854 . map ( |obj| {
852855 obj. iter ( )
853856 . filter_map ( |( key, value) | {
@@ -898,21 +901,26 @@ impl AgentCheckpointPreset for GithubCopilotPreset {
898901 }
899902
900903 // Handle after_edit (AI checkpoint)
904+ // Accept snake_case (new) with fallback to camelCase (old) for backward compatibility
901905 let chat_session_path = hook_data
902- . get ( "chatSessionPath " )
906+ . get ( "chat_session_path " )
903907 . and_then ( |v| v. as_str ( ) )
908+ . or_else ( || hook_data. get ( "chatSessionPath" ) . and_then ( |v| v. as_str ( ) ) )
904909 . ok_or_else ( || {
905- GitAiError :: PresetError ( "chatSessionPath not found in hook_input for after_edit" . to_string ( ) )
910+ GitAiError :: PresetError ( "chat_session_path or chatSessionPath not found in hook_input for after_edit" . to_string ( ) )
906911 } ) ?;
907912
908913 let agent_metadata = HashMap :: from ( [
909914 ( "chat_session_path" . to_string ( ) , chat_session_path. to_string ( ) ) ,
910915 ] ) ;
911916
912- // Accept either chatSessionId (old) or sessionId (from VS Code extension)
917+ // Accept snake_case (new) with fallback to camelCase (old) for backward compatibility
918+ // Accept either chat_session_id/session_id (new) or chatSessionId/sessionId (old)
913919 let chat_session_id = hook_data
914- . get ( "chatSessionId " )
920+ . get ( "chat_session_id " )
915921 . and_then ( |v| v. as_str ( ) )
922+ . or_else ( || hook_data. get ( "session_id" ) . and_then ( |v| v. as_str ( ) ) )
923+ . or_else ( || hook_data. get ( "chatSessionId" ) . and_then ( |v| v. as_str ( ) ) )
916924 . or_else ( || hook_data. get ( "sessionId" ) . and_then ( |v| v. as_str ( ) ) )
917925 . unwrap_or ( "unknown" )
918926 . to_string ( ) ;
0 commit comments