codex-remote-orchestrator
Run the full remote execution chain through one skill.
Execution Flow
- •Validate machine readiness.
- •Choose execution mode (fast sync or async).
- •For async: submit command and capture
exec_id. - •For async: query result status and fetch logs on demand.
- •Troubleshoot automatically on errors.
Step 1: Machine Readiness
Run:
bash
codex-remote machine check --machine "$MACHINE"
If daemon_ok=false, run:
bash
codex-remote machine up --machine "$MACHINE" codex-remote machine check --machine "$MACHINE"
Abort only if SSH remains unreachable.
Step 2: Choose Mode
Fast sync mode (short commands):
bash
codex-remote exec run --machine "$MACHINE" --cmd "$CMD"
Async mode (long-running commands):
bash
codex-remote exec start --machine "$MACHINE" --cmd "$CMD"
Classification is owned by the caller; do not auto-detect inside this tool.
Step 3: Submit Command (Async Only)
Without project context:
bash
codex-remote exec start --machine "$MACHINE" --cmd "$CMD"
With project/ref:
bash
codex-remote exec start --machine "$MACHINE" --project "$PROJECT" --ref "$REF" --cmd "$CMD"
Always return exec_id to caller.
Step 4: Status Query (Async Only)
bash
codex-remote exec result --machine "$MACHINE" --id "$EXEC_ID"
Interpret:
- •
running: execution still in progress. - •
finished: readexit_code.
Step 5: Logs Query (Async Only)
Stdout:
bash
codex-remote exec logs --machine "$MACHINE" --id "$EXEC_ID" --stream stdout --tail 2000
Stderr:
bash
codex-remote exec logs --machine "$MACHINE" --id "$EXEC_ID" --stream stderr --tail 2000
Logs are JSONL. Parse line-by-line.
Step 6: Troubleshooting Triggers
On these errors, perform immediate triage:
- •
unknown machine - •
connection reset by peer - •
unauthorized - •
exec_id not found
Triage commands:
bash
codex-remote machine check --machine "$MACHINE" codex-remote exec start --machine "$MACHINE" --cmd "hostname"
Output Contract
When interacting with user or agent caller, keep this structure:
- •
machineand readiness (ssh_ok,daemon_ok) - •
mode(runorasync) - •
exec_id(async only) - •
status - •
exit_code(if finished) - •optional
stdout_tail/stderr_tail - •next action (
wait,done, orfix-config)