mirror of
https://github.com/usestrix/strix.git
synced 2026-09-15 23:31:27 +00:00
Refines browser state handling and healthcheck
Enhances browser command robustness by gracefully handling cases where the DOM state is not yet available, returning an informative error instead of asserting. Updates the container healthcheck to directly probe Chromium's internal CDP port, simplifying the check by removing previous indirection.
This commit is contained in:
parent
bbf6e08bab
commit
f99b7ebd4f
2 changed files with 6 additions and 5 deletions
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
# Healthcheck script for the strix sandbox container.
|
||||
# Checks: tool server, Caido proxy, Chromium CDP (via socat).
|
||||
# Checks: tool server, Caido proxy, Chromium CDP.
|
||||
# Exit 0 = healthy, exit 1 = unhealthy.
|
||||
|
||||
set -e
|
||||
|
|
@ -21,9 +21,9 @@ if ! curl -sf --max-time 3 -o /dev/null "http://127.0.0.1:${CAIDO_PORT}/graphql/
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# 3. Chromium CDP must be reachable (via socat forwarder)
|
||||
if ! curl -sf --max-time 3 "http://127.0.0.1:${CDP_PORT}/json/version" | grep -q "webSocketDebuggerUrl"; then
|
||||
echo "UNHEALTHY: Chromium CDP not responding on port ${CDP_PORT}"
|
||||
# 3. Chromium CDP must be reachable (probe internal port directly — no auth needed inside the container)
|
||||
if ! curl -sf --max-time 3 "http://127.0.0.1:${CDP_INTERNAL_PORT:-19222}/json/version" | grep -q "webSocketDebuggerUrl"; then
|
||||
echo "UNHEALTHY: Chromium CDP not responding on internal port ${CDP_INTERNAL_PORT:-19222}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -244,7 +244,8 @@ async def _cmd_screenshot(
|
|||
|
||||
async def _cmd_state(bs: Any) -> dict[str, Any]:
|
||||
state = await bs.get_browser_state_summary()
|
||||
assert state.dom_state is not None
|
||||
if state.dom_state is None:
|
||||
return {"error": "Browser state has no DOM — the page may still be loading"}
|
||||
state_text = state.dom_state.llm_representation()
|
||||
if state.page_info:
|
||||
pi = state.page_info
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue