1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Windows版Codex AppでスマホからRemote Controlできない時に、app-serverを手動起動して回避したメモ

1
Last updated at Posted at 2026-06-20

はじめに

Windows版のCodex Appを使って、ChatGPTモバイルアプリからPC上のCodexを操作しようとしたところ、PC側のCodex Appは起動しているのに、スマホ側にPCが表示されない問題に遭遇しました。

最終的には、Windows側で codex app-server を --remote-control 付きで手動起動することで接続できました。

この記事は、正式手順というより、現時点での検証メモです。CodexのRemote Control / app-server周りはexperimentalな要素があり、今後のバージョンアップで挙動が変わる可能性があります。

環境

  • OS: Windows 11
  • Codex App: Microsoft Store版
  • Codex CLI: npm版 @openai/codex
  • 認証: codex login でChatGPTログイン済み
  • モデル実行先: Azure OpenAI / APIM経由
  • スマホ: ChatGPTアプリのCodexタブ

最初に確認したこと

まず、Codex AppとCLIのバージョンを確認しました。

codex --version
Get-AppxPackage *Codex* | Select-Object Name, Version, PackageFullName

ログイン状態も確認します。

codex login status

自分の環境では、ChatGPTログイン自体は成功していました。

Logged in using ChatGPT

また、Codex Appの設定画面も確認しましたが、期待していた Set up Codex mobile や Allow other devices to connect のような入口が見当たりませんでした。

ハマったポイント1: remote_connections は今のCLIではUnknownだった

ネット上の情報を参考に config.toml に以下のようなfeature flagを書いていました。

[features]
remote_connections = true
remote_control = true

しかし、自分のCLIでは remote_connections は認識されませんでした。

codex features enable remote_connections

結果:

Error: Unknown feature flag: remote_connections

一方で、remote_control は有効化できました。

codex features enable remote_control

ただし、Codex Appを起動すると config.toml から remote_control = true が消える挙動も確認しました。ここで、config.toml に手で書き戻し続ける方針はやめました。

ハマったポイント2: codex remote-control はWindowsで失敗した

次に codex remote-control を試しました。

codex remote-control

結果:

Starting app-server with remote control enabled...
Error: codex app-server daemon lifecycle is only supported on Unix platforms

つまり、自分のWindows環境では codex remote-control によるdaemon起動は使えませんでした。

ポイントは、Windowsではdaemon lifecycleに頼らず、socketパスを明示してapp-serverを直接起動することです。

最終的に動いたコマンド

まず、既存のapp-serverプロセスがあれば止めます。

Get-CimInstance Win32_Process |
  Where-Object { $_.CommandLine -match "codex.*app-server" } |
  ForEach-Object { Stop-Process -Id $_.ProcessId -Force }

次に、socket用のディレクトリを作成します。

$SockDir = "$env:USERPROFILE\.codex\app-server-control"
New-Item -ItemType Directory -Force $SockDir | Out-Null

$SockPath = "$SockDir\npm-test.sock"
Remove-Item $SockPath -Force -ErrorAction SilentlyContinue

$SockUri = "unix://" + ($SockPath -replace "\\", "/")

そして、--remote-control 付きでapp-serverを起動します。

codex.cmd app-server --remote-control --listen $SockUri

自分の環境では、展開すると以下のような形です。

codex.cmd app-server --remote-control --listen unix://C:/Users/<your-user>/.codex/app-server-control/npm-test.sock

このPowerShellは閉じないでください。閉じるとapp-serverも止まります。

起動確認

別のPowerShellで、--remote-control 付きのapp-serverが起動しているか確認します。

Get-CimInstance Win32_Process |
  Where-Object { $_.CommandLine -match "codex.*app-server" } |
  Select-Object ProcessId, CommandLine

CommandLine に以下が含まれていれば、少なくともremote-control付きでapp-serverが起動しています。

app-server --remote-control --listen

この状態でスマホ側のChatGPTアプリを開き、Codexタブを確認したところ、PC側に接続できるようになりました。

注意点

この方法は、現時点での回避策です。

  • codex remote-control はWindowsで失敗する場合がある
  • remote_control = true が config.toml から消えることがある
  • remote_connections はCLIでUnknownになる場合がある
  • app-server --remote-control を起動しているPowerShellを閉じると止まる
  • Codex AppやCLIのアップデートで挙動が変わる可能性がある
  • configやログを公開する場合は、APIキー、APIMエンドポイント、MCPトークン、ユーザー名、社内URLを必ずマスクする

APIM / Azure OpenAI設定との関係

自分の環境では、Codexのモデル実行先はAPIM / Azure OpenAI経由にしています。

この場合、config.toml の model_provider や env_http_headers は維持したままで問題ありませんでした。スマホからPCを見つけるためのChatGPTログインと、モデル呼び出し先としてのAPIM設定は役割が違います。

ざっくり言うと、以下の整理です。

ChatGPTログイン:
  Codex App / mobile / workspace / remote control のため

APIMキー:
  モデル呼び出しをAPIM / Azure OpenAI経由にするため

まとめ

Windows版Codex Appでスマホ側にPCが出ない場合、config.toml のfeature flagだけを追いかけても解決しないことがあります。

今回の環境では、codex remote-control はWindowsでdaemon lifecycle未対応のエラーになりましたが、以下のようにapp-serverを手動起動することで接続できました。

codex.cmd app-server --remote-control --listen unix://C:/Users/<your-user>/.codex/app-server-control/npm-test.sock

正式な対応が入れば不要になる回避策だと思いますが、同じところで詰まっている人の参考になれば幸いです。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?