fix(test): Resolve visual orchestration test and prepare hook env injection
This commit is contained in:
@@ -352,9 +352,9 @@ class AppController:
|
|||||||
'btn_approve_spawn': lambda: self._handle_mma_respond(approved=True),
|
'btn_approve_spawn': lambda: self._handle_mma_respond(approved=True),
|
||||||
}
|
}
|
||||||
self._predefined_callbacks: dict[str, Callable[..., Any]] = {
|
self._predefined_callbacks: dict[str, Callable[..., Any]] = {
|
||||||
'_test_callback_func_write_to_file': self._test_callback_func_write_to_file
|
'_test_callback_func_write_to_file': self._test_callback_func_write_to_file,
|
||||||
|
'_set_env_var': lambda k, v: os.environ.update({k: v})
|
||||||
}
|
}
|
||||||
|
|
||||||
def _update_gcli_adapter(self, path: str) -> None:
|
def _update_gcli_adapter(self, path: str) -> None:
|
||||||
sys.stderr.write(f"[DEBUG] _update_gcli_adapter called with: {path}\n")
|
sys.stderr.write(f"[DEBUG] _update_gcli_adapter called with: {path}\n")
|
||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
|
|||||||
@@ -79,7 +79,14 @@ class GeminiCliAdapter:
|
|||||||
# Use communicate to avoid pipe deadlocks with large input/output.
|
# Use communicate to avoid pipe deadlocks with large input/output.
|
||||||
# This blocks until the process exits, so we lose real-time streaming,
|
# This blocks until the process exits, so we lose real-time streaming,
|
||||||
# but it's much more robust. We then simulate streaming by processing the output.
|
# but it's much more robust. We then simulate streaming by processing the output.
|
||||||
stdout_final, stderr_final = process.communicate(input=prompt_text)
|
try:
|
||||||
|
stdout_final, stderr_final = process.communicate(input=prompt_text, timeout=60.0)
|
||||||
|
except subprocess.TimeoutExpired:
|
||||||
|
process.kill()
|
||||||
|
stdout_final, stderr_final = process.communicate()
|
||||||
|
stderr_final += "\n\n[ERROR] Gemini CLI subprocess timed out after 60 seconds."
|
||||||
|
# Mock a JSON error result to bubble up
|
||||||
|
stdout_final += '\n{"type": "result", "status": "error", "error": "subprocess timeout"}\n'
|
||||||
|
|
||||||
for line in stdout_final.splitlines():
|
for line in stdout_final.splitlines():
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ def main() -> None:
|
|||||||
# Read prompt from stdin
|
# Read prompt from stdin
|
||||||
try:
|
try:
|
||||||
prompt = sys.stdin.read()
|
prompt = sys.stdin.read()
|
||||||
|
with open("mock_debug_prompt.txt", "a") as f:
|
||||||
|
f.write(f"--- MOCK INVOKED ---\nARGS: {sys.argv}\nPROMPT:\n{prompt}\n------------------\n")
|
||||||
except EOFError:
|
except EOFError:
|
||||||
prompt = ""
|
prompt = ""
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ def test_mma_epic_lifecycle(live_gui) -> None:
|
|||||||
client = api_hook_client.ApiHookClient()
|
client = api_hook_client.ApiHookClient()
|
||||||
assert client.wait_for_server(timeout=15)
|
assert client.wait_for_server(timeout=15)
|
||||||
|
|
||||||
|
# Reset
|
||||||
|
client.click("btn_reset")
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
# Set provider and path
|
# Set provider and path
|
||||||
client.set_value("current_provider", "gemini_cli")
|
client.set_value("current_provider", "gemini_cli")
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
@@ -21,10 +25,6 @@ def test_mma_epic_lifecycle(live_gui) -> None:
|
|||||||
client.set_value("gcli_path", f'"{sys.executable}" "{mock_path}"')
|
client.set_value("gcli_path", f'"{sys.executable}" "{mock_path}"')
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
# Reset
|
|
||||||
client.click("btn_reset")
|
|
||||||
time.sleep(2)
|
|
||||||
|
|
||||||
# Set epic and click
|
# Set epic and click
|
||||||
client.set_value("mma_epic_input", "Add timestamps")
|
client.set_value("mma_epic_input", "Add timestamps")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user