@@ -1004,37 +1004,121 @@ async def start_anonymous_indexing(
10041004@router .get (
10051005 "/index/{job_id}" ,
10061006 summary = "Check indexing job status" ,
1007- description = "Poll this endpoint to check the status of an indexing job." ,
1007+ description = """
1008+ Poll this endpoint to check the status of an anonymous indexing job.
1009+
1010+ **Status values:**
1011+ - `queued` - Job is waiting to start
1012+ - `cloning` - Repository is being cloned from GitHub
1013+ - `processing` - Files are being parsed and indexed
1014+ - `completed` - Indexing finished, `repo_id` available for search
1015+ - `failed` - Error occurred, check `error` and `error_message` fields
1016+
1017+ **Polling recommendation:** Every 2-3 seconds until completed/failed.
1018+
1019+ **TTL:** Job metadata expires after 1 hour.
1020+ """ ,
10081021 responses = {
10091022 200 : {
10101023 "description" : "Job status" ,
10111024 "content" : {
10121025 "application/json" : {
10131026 "examples" : {
10141027 "queued" : {
1028+ "summary" : "Job queued" ,
10151029 "value" : {
10161030 "job_id" : "idx_abc123" ,
10171031 "status" : "queued" ,
1018- "message" : "Job is queued for processing"
1032+ "message" : "Job is queued for processing" ,
1033+ "created_at" : "2025-12-26T10:00:00Z" ,
1034+ "updated_at" : "2025-12-26T10:00:00Z" ,
1035+ "repository" : {
1036+ "owner" : "pallets" ,
1037+ "name" : "flask" ,
1038+ "branch" : "main" ,
1039+ "github_url" : "https://github.com/pallets/flask"
1040+ }
1041+ }
1042+ },
1043+ "cloning" : {
1044+ "summary" : "Cloning repository" ,
1045+ "value" : {
1046+ "job_id" : "idx_abc123" ,
1047+ "status" : "cloning" ,
1048+ "message" : "Cloning repository..." ,
1049+ "created_at" : "2025-12-26T10:00:00Z" ,
1050+ "updated_at" : "2025-12-26T10:00:05Z" ,
1051+ "repository" : {
1052+ "owner" : "pallets" ,
1053+ "name" : "flask" ,
1054+ "branch" : "main" ,
1055+ "github_url" : "https://github.com/pallets/flask"
1056+ }
10191057 }
10201058 },
10211059 "processing" : {
1060+ "summary" : "Indexing in progress" ,
10221061 "value" : {
10231062 "job_id" : "idx_abc123" ,
10241063 "status" : "processing" ,
1064+ "message" : "Indexing files..." ,
1065+ "created_at" : "2025-12-26T10:00:00Z" ,
1066+ "updated_at" : "2025-12-26T10:00:30Z" ,
1067+ "repository" : {
1068+ "owner" : "pallets" ,
1069+ "name" : "flask" ,
1070+ "branch" : "main" ,
1071+ "github_url" : "https://github.com/pallets/flask"
1072+ },
10251073 "progress" : {
10261074 "files_processed" : 50 ,
10271075 "files_total" : 100 ,
10281076 "functions_found" : 250 ,
1029- "percent_complete" : 50
1077+ "percent_complete" : 50 ,
1078+ "current_file" : "src/flask/app.py"
1079+ }
1080+ }
1081+ },
1082+ "processing_partial" : {
1083+ "summary" : "Partial indexing in progress" ,
1084+ "value" : {
1085+ "job_id" : "idx_abc123" ,
1086+ "status" : "processing" ,
1087+ "message" : "Indexing files..." ,
1088+ "partial" : True ,
1089+ "max_files" : 200 ,
1090+ "created_at" : "2025-12-26T10:00:00Z" ,
1091+ "updated_at" : "2025-12-26T10:00:30Z" ,
1092+ "repository" : {
1093+ "owner" : "facebook" ,
1094+ "name" : "react" ,
1095+ "branch" : "main" ,
1096+ "github_url" : "https://github.com/facebook/react"
1097+ },
1098+ "progress" : {
1099+ "files_processed" : 100 ,
1100+ "files_total" : 200 ,
1101+ "functions_found" : 450 ,
1102+ "percent_complete" : 50 ,
1103+ "current_file" : "packages/react/src/React.js"
10301104 }
10311105 }
10321106 },
10331107 "completed" : {
1108+ "summary" : "Indexing completed" ,
10341109 "value" : {
10351110 "job_id" : "idx_abc123" ,
10361111 "status" : "completed" ,
1112+ "message" : "Indexing completed successfully" ,
10371113 "repo_id" : "anon_idx_abc123" ,
1114+ "created_at" : "2025-12-26T10:00:00Z" ,
1115+ "updated_at" : "2025-12-26T10:01:00Z" ,
1116+ "repository" : {
1117+ "owner" : "pallets" ,
1118+ "name" : "flask" ,
1119+ "branch" : "main" ,
1120+ "github_url" : "https://github.com/pallets/flask"
1121+ },
10381122 "stats" : {
10391123 "files_indexed" : 100 ,
10401124 "functions_found" : 500 ,
@@ -1043,18 +1127,53 @@ async def start_anonymous_indexing(
10431127 }
10441128 },
10451129 "failed" : {
1130+ "summary" : "Indexing failed" ,
10461131 "value" : {
10471132 "job_id" : "idx_abc123" ,
10481133 "status" : "failed" ,
1134+ "message" : "Repository not found or access denied" ,
10491135 "error" : "clone_failed" ,
1050- "error_message" : "Repository not found"
1136+ "error_message" : "Repository not found or access denied" ,
1137+ "created_at" : "2025-12-26T10:00:00Z" ,
1138+ "updated_at" : "2025-12-26T10:00:10Z" ,
1139+ "repository" : {
1140+ "owner" : "user" ,
1141+ "name" : "private-repo" ,
1142+ "branch" : "main" ,
1143+ "github_url" : "https://github.com/user/private-repo"
1144+ }
10511145 }
10521146 }
10531147 }
10541148 }
10551149 }
10561150 },
1057- 404 : {"description" : "Job not found or expired" }
1151+ 400 : {
1152+ "description" : "Invalid job ID format" ,
1153+ "content" : {
1154+ "application/json" : {
1155+ "example" : {
1156+ "detail" : {
1157+ "error" : "invalid_job_id" ,
1158+ "message" : "Invalid job ID format"
1159+ }
1160+ }
1161+ }
1162+ }
1163+ },
1164+ 404 : {
1165+ "description" : "Job not found or expired" ,
1166+ "content" : {
1167+ "application/json" : {
1168+ "example" : {
1169+ "detail" : {
1170+ "error" : "job_not_found" ,
1171+ "message" : "Job not found or has expired. Jobs expire after 1 hour."
1172+ }
1173+ }
1174+ }
1175+ }
1176+ }
10581177 }
10591178)
10601179async def get_indexing_status (
0 commit comments