diff --git a/api/wevia-sse-orchestrator.php b/api/wevia-sse-orchestrator.php index 1d9e85417..d2357751e 100644 --- a/api/wevia-sse-orchestrator.php +++ b/api/wevia-sse-orchestrator.php @@ -185,17 +185,20 @@ if (!empty($msg)) { if (!$__sd_safe) continue; // DOCTRINE-215 opus-phase74 - inject MSG env for cmd extraction $__sd_env = 'MSG=' . escapeshellarg($__sd_msg) . ' '; - // DOCTRINE-216 opus-phase75 - async long intents to bypass CF 504 + // DOCTRINE-216 opus-phase75 + DOCTRINE-217 opus-phase76 - async long intents via temp script + setsid $__sd_long_intents = ['wevia_gemini_ux_apply', 'wevia_gemini_ux_fix', 'wevia_playwright_ux_overlap_gemini_audit']; if (in_array($__sd_info['name'] ?? '', $__sd_long_intents)) { - // Background exec + return task_id immediate $__sd_task_id = 'task_' . bin2hex(random_bytes(5)); + @mkdir('/tmp/wevia-tasks', 0777, true); $__sd_task_out = "/tmp/wevia-tasks/{$__sd_task_id}.out"; $__sd_task_flag = "/tmp/wevia-tasks/{$__sd_task_id}.flag"; - @mkdir('/tmp/wevia-tasks', 0777, true); - $__sd_full_cmd = $__sd_env . 'timeout 180 bash -c ' . escapeshellarg($__sd_cmd); - @exec("nohup bash -c " . escapeshellarg("$__sd_full_cmd > $__sd_task_out 2>&1; touch $__sd_task_flag") . " > /dev/null 2>&1 &"); - $__sd_out = "ASYNC_LAUNCHED task_id=$__sd_task_id\nPoll: /api/wevia-async-exec.php?poll=$__sd_task_id\nIntent {$__sd_info['name']} running in background (90-180s)."; + $__sd_task_script = "/tmp/wevia-tasks/{$__sd_task_id}.sh"; + // DOCTRINE-217: write exec to temp script, then setsid detach - avoid double escaping + $__sd_script_body = "#!/bin/bash\nexport MSG=" . escapeshellarg($__sd_msg) . "\ntimeout 180 bash -c " . escapeshellarg($__sd_cmd) . " > $__sd_task_out 2>&1\ntouch $__sd_task_flag\n"; + @file_put_contents($__sd_task_script, $__sd_script_body); + @chmod($__sd_task_script, 0755); + @exec("setsid bash $__sd_task_script > /dev/null 2>&1 < /dev/null &"); + $__sd_out = "ASYNC_LAUNCHED task_id=$__sd_task_id\nPoll: /api/wevia-async-exec.php?poll=$__sd_task_id\nIntent {$__sd_info['name']} running in background (90-180s).\nScript: $__sd_task_script"; } else { $__sd_out = @shell_exec($__sd_env . 'timeout 90 bash -c ' . escapeshellarg($__sd_cmd) . ' 2>&1'); } diff --git a/products/researchflow.html b/products/researchflow.html index 6871aee46..d0abbeaf6 100644 --- a/products/researchflow.html +++ b/products/researchflow.html @@ -112,6 +112,387 @@ footer{padding:2.5rem 4% 1.5rem;max-width:1180px;margin:2rem auto 0;border-top:1 @media (max-width:768px){#weval-bot-widget{bottom:100px !important;right:16px !important;z-index:10001 !important}#weval-bot-btn{width:48px !important;height:48px !important}#weval-bot-btn svg{width:22px !important;height:22px !important}#footer_banner,.footer-banner,[class*="footer-bandeau"]{z-index:9990 !important}} + + + +