KB-7A5C rev 2

Codex VPS Workflow Progress

5 min read Revision 2
codex-vpsvpsworkflowreport2026-05-21

Codex VPS Workflow Progress

Date: 2026-05-21 10:25:25 +07 Agent: Codex Mission: Set up an idempotent codex-vps command from MacBook to VPS-hosted Codex CLI.

Step 0 - Foundation

  • Read .claude/skills/incomex-rules.md.
  • Read OR via Agent Data: knowledge/dev/ssot/operating-rules.md v7.58 (2026-05-01).
  • Read Constitution via Agent Data: knowledge/dev/laws/constitution.md v4.6.3.
  • Read VPS rules via Agent Data: knowledge/dev/ssot/vps/vps-operating-rules.md v1.0.

3 Câu Tuyên Ngôn

  1. Vĩnh viễn: create a reusable command wrapper and install Codex CLI on the VPS, not a one-off SSH command.
  2. Nhầm được không: detect the SSH alias from ~/.ssh/config; if not certain, stop and ask one question before mutating anything.
  3. 100% tự động: codex-vps ... forwards arguments to the VPS Codex process and lands in a default project directory automatically.

Design Check

  • Goal: one local terminal command opens Codex CLI running on the target VPS.
  • Method: verify SSH alias, verify/install Node/npm/Codex on VPS, then create a local executable wrapper with backups before shell config edits.
  • Preconditions: SSH already works; target alias must be unambiguous; write permission or approved escalation is needed for /usr/local/bin or shell rc edits.
  • Roadmap: read-only discovery -> VPS install/verify -> local wrapper creation -> final tests -> report.

TODO / Evidence

  • Identify VPS alias in ~/.ssh/config.
    • Evidence: Host contabo 38.242.240.89, HostName 38.242.240.89, User root, IdentityFile ~/.ssh/contabo_vps.
  • Identify Mac shell and PATH directories.
    • Evidence: SHELL=/bin/zsh; PATH contains /Users/nmhuyen/bin, /Users/nmhuyen/.local/bin, /opt/homebrew/bin, /usr/local/bin, /usr/bin, /bin.
    • Evidence: /Users/nmhuyen/bin exists; /usr/local/bin exists but is owned by root:wheel.
  • SSH to VPS and verify OS/CPU/Node/npm.
    • Evidence before install: USER=root, HOME=/root, SHELL=/bin/bash, OS=Ubuntu 24.04.4 LTS, ARCH=x86_64; no node, npm, or codex output.
  • Install or update Codex CLI on VPS.
    • Evidence: installed NodeSource Node 22.x apt source and nodejs package; then ran npm install -g @openai/codex.
    • npm output: added 2 packages in 8s.
  • Verify node -v, npm -v, codex --version on VPS.
    • Evidence: node -v -> v22.22.2; npm -v -> 10.9.7; command -v codex -> /usr/bin/codex; codex --version -> codex-cli 0.132.0.
  • Check Codex auth status without exposing secrets.
    • Evidence: codex login status -> Not logged in; $HOME/.codex/auth.json does not exist/nonempty check returned missing.
    • Required login command: ssh -t contabo 'codex login'.
  • Create codex-vps wrapper with backup-safe shell config handling if needed.
    • Evidence: created /Users/nmhuyen/bin/codex-vps; no .zshrc, .bashrc, or .profile edit was needed because /Users/nmhuyen/bin is already in PATH.
    • No existing /Users/nmhuyen/bin/codex-vps was present, so no wrapper backup was needed.
    • Wrapper behavior: SSH to contabo, cd /root, quote/forward all arguments, then exec codex.
  • Test codex-vps --version.
    • Evidence: codex-vps --version -> codex-cli 0.132.0.
    • Test environment emitted Pseudo-terminal will not be allocated because stdin is not a terminal. before output; this is expected for non-TTY automation, not for an interactive Mac terminal.
  • Upload/finalize report.
    • Evidence: Agent Data upload created knowledge/current-state/reports/2026-05-21-codex-vps-workflow-progress.md, revision 1.

Final Commands

  • Login if needed: ssh -t contabo 'codex login'
  • Use: codex-vps
  • Version: codex-vps --version
  • Prompt forwarding: codex-vps "kiem tra project nay"
  • Rollback: rm /Users/nmhuyen/bin/codex-vps

Notes

  • Project directory defaulted to /root per user instruction allowing $HOME when no project directory is specified.
  • No SSH keys, firewall, VPS user, or security config were changed.
  • No API key/token was written to shell config or script.
  • OR update: not needed; this mission is workstation/VPS CLI setup, not a new Incomex operating rule.