diff --git a/scripts/drivers/types/codex/_session-start.sh b/scripts/drivers/types/codex/_session-start.sh index 1aa55fb9b..ca6b0e6d0 100644 --- a/scripts/drivers/types/codex/_session-start.sh +++ b/scripts/drivers/types/codex/_session-start.sh @@ -137,6 +137,17 @@ agmsg_session_start() { app_server="unix://$socket_path" fi fi + if [ -z "$app_server" ]; then + # A ws:// (TCP) app-server has no socket file to find, and codex-monitor.sh + # passes the URL to `codex --remote`, not as a `unix://` token this script can + # scrape — so none of the three probes above can see it. The port file does + # carry the URL; reuse the helper codex-record-session.sh already uses for it. + if ! command -v _agmsg_codex_app_server_url >/dev/null 2>&1; then + # shellcheck disable=SC1091 + . "$SKILL_DIR/scripts/drivers/types/codex/_app-server.sh" + fi + app_server="$(_agmsg_codex_app_server_url "$PROJECT")" + fi [ -n "$app_server" ] || exit 0 if [ "${AGMSG_CODEX_BRIDGE_LAUNCHER:-}" = "1" ]; then