fix(web): route 初始需求 to intake and map stage 403 errors
Debug logs showed task runs used user_requirements on V0.1 while the active stage only allows intake. Prefer intake for 初始需求/摸底 phrasing and surface DOC_TASK_NOT_IN_ACTIVE_STAGE instead of SESSION_FORBIDDEN. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -26,15 +26,20 @@ export async function createTaskRun(body: CreateTaskRunBody): Promise<CreateTask
|
||||
// #endregion
|
||||
if (!res.ok) {
|
||||
let detail = '';
|
||||
let errorCode = '';
|
||||
try {
|
||||
const payload = (await res.json()) as { message?: string; error?: string; error_code?: string };
|
||||
detail = payload.message || payload.error || payload.error_code || '';
|
||||
errorCode = payload.error || payload.error_code || '';
|
||||
detail = payload.message || errorCode || '';
|
||||
} catch {
|
||||
// ignore non-json body
|
||||
}
|
||||
// #region agent log
|
||||
fetch('http://localhost:7284/ingest/86170f40-1203-4130-a0c7-f6e39ba00464',{method:'POST',headers:{'Content-Type':'application/json','X-Debug-Session-Id':'6c6caa'},body:JSON.stringify({sessionId:'6c6caa',location:'taskRuns.ts:createTaskRun',message:'create task run error body',data:{status:res.status,errorCode,detail,projectId:body.project_id,taskKey:body.task_key},timestamp:Date.now(),hypothesisId:'H6'})}).catch(()=>{});
|
||||
// #endregion
|
||||
throw Object.assign(
|
||||
new Error(`create task run failed: HTTP ${res.status}${detail ? `: ${detail}` : ''}`),
|
||||
{ httpStatus: res.status },
|
||||
{ httpStatus: res.status, errorCode, detail },
|
||||
);
|
||||
}
|
||||
return res.json();
|
||||
|
||||
Reference in New Issue
Block a user