Community程式設計與開發github.com

遠端測試

在整合測試中針對遠端執行器進行測試。

遠端測試 是什麼?

此技能提供了在整合測試中針對遠端執行器(Remote Executor)進行測試的完整指南與工具。其核心目的是驗證應用伺服器(app-server)與執行伺服器(exec-server)分離架構下的代理功能,確保在本地與遠端執行環境中都能正常運作。該技能支援兩種遠端執行器:基於 Docker 的 Linux 執行器,以及基於 Wine 的 Windows 執行器。目前僅限於 x86_64 Linux 主機。測試案例需要明確選擇加入遠端執行測試,並使用標準化的 `build_with_auto_env()` 或 `new_with_auto_env()` 等初始化方法來設定測試環境。此外,此技能提供了多種條件式跳過巨集(如 `skip_if_wine_exec!`、`skip_if_host_windows!`),讓開發者能針對特定設定檔失敗的測試進行標記與跳過,同時鼓勵開發者編寫預設在所有主機/目標設定下都能執行的測試。

相容平台~Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/openai/codex/tree/main/.codex/skills/remote-tests

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

遠端執行器測試會演練應用伺服器/執行伺服器的拆分,以確保代理功能在本地與遠端執行環境中都能正常運作。

遠端執行器測試目前需要一台 x86_64 Linux 主機。有兩種執行方式:

  1. Docker(Linux 執行伺服器)
  2. Wine(Windows 執行伺服器)

測試 Fixtures

個別測試案例必須選擇加入才能針對遠端執行器執行。

codex_core

在核心整合測試中,除非測試需要更精確地控制其執行器,否則請使用 TestCodexBuilder::build_with_auto_env() 來選擇加入遠端執行。

app-server

除非測試本身定義了自己的 $CODEX_HOME/environments.toml 或會在執行時期定義自訂環境,否則請使用 TestAppServer::new_with_auto_env() 啟動伺服器。

如果您已使用 auto_env 方式建立伺服器,請使用 TestAppServer::send_thread_start_request_with_auto_env() 啟動執行緒。使用時請省略 ThreadStartParams.environments(保留為 None)。

測試跳過

如果某個測試在特定的遠端執行器設定中無法通過,您可以在該設定中跳過它。當使用的跳過巨集支援時,請為未來的讀者附上字串原因。

根據導致測試失敗的原因選擇跳過巨集:

  • skip_if_target_windows!:Windows 目標行為。
  • skip_if_wine_exec!:Wine-exec 執行器限制。
  • skip_if_host_windows!:Windows 主機限制。
  • skip_if_remote!:僅限本機的測試行為。
  • skip_if_no_remote_env!:僅限遠端的測試行為。

預設情況下,建議編寫能在所有主機/目標設定中執行的測試。請參閱 $path-types 技能,了解讓測試相容所需的最常見變更。

Docker

Docker 容器透過 ./scripts/test-remote-env.sh 建置並初始化。在 bash 中執行此腳本後,會提供 codex_remote_env_cleanup 函式,可在測試結束後使用。

要針對 Docker 遠端執行器執行核心整合測試:

bash -c '
  set -euo pipefail
  unset CODEX_TEST_REMOTE_EXEC_SERVER_URL
  source scripts/test-remote-env.sh
  trap codex_remote_env_cleanup EXIT

  cd codex-rs
  just test -p codex-core --test all
'

要針對 Docker 遠端執行器執行應用伺服器整合測試:

bash -c '
  set -euo pipefail
  unset CODEX_TEST_REMOTE_EXEC_SERVER_URL
  source scripts/test-remote-env.sh
  trap codex_remote_env_cleanup EXIT

  cd codex-rs
  just test -p codex-app-server --test all
'

Wine

這些測試會為 Windows 建置一個執行伺服器,並在 Wine 下執行,而應用伺服器則保留在 Linux 主機上。跨平台建置的相依性意味著它們只能在 Bazel 中執行。

核心整合測試:

bazel test //codex-rs/core:core-all-wine-exec-test

應用伺服器整合測試:

bazel test //codex-rs/app-server:app-server-all-wine-exec-test

Devbox

如果您使用的是 macOS 機器,可以使用 devbox 來執行這些測試。

您可以透過 applied_devbox ls 列出 devbox,選取名稱中包含 codex 的那一個。 透過 ssh <devbox_name> 連線到 devbox。 在 ~/code/codex 中重複使用相同的 codex checkout。如有需要,請重設檔案。多次 checkout 會使建置時間更長,並佔用更多空間。 檢查遠端與本機的 SHA 和已修改檔案是否同步。

Individual skills in this repo

This repo contains 19 individual skills — each has its own dedicated page.

babysit-pr

Babysit a GitHub pull request after creation by continuously polling review comments, CI checks/workflow runs, and mergeability state until the PR is merged/closed or user help is required. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and keep watching open PRs so fresh review feedback is surfaced promptly. Use when the user asks Codex to monitor a PR, watch CI, handle review comments, or keep an eye on failures and feedback on an open PR.

code-review

Run a final code review on a pull request

code-review-change-size

Change size guidance (800 lines)

code-review-context

Model visible context

code-review-testing

Test authoring guidance

codex-bug

Diagnose GitHub bug reports in openai/codex. Use when given a GitHub issue URL from openai/codex and asked to decide next steps such as verifying against the repo, requesting more info, or explaining why it is not a bug; follow any additional user-provided instructions.

codex-issue-digest

Run a GitHub issue digest for openai/codex by feature-area labels, all areas, and configurable time windows. Use when asked to summarize recent Codex bug reports or enhancement requests, especially for owner-specific labels such as tui, exec, app, or similar areas.

codex-pr-body

Update the title and body of one or more pull requests.

imagegen

Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output should be a bitmap asset rather than repo-native code or vector. Do not use when the task is better handled by editing existing SVG/vector/code-native assets, extending an established icon or logo system, or building the visual directly in HTML/CSS/canvas.

openai/babysit-pr

Babysit a GitHub pull request after creation by continuously polling review comments, CI checks/workflow runs, and mergeability state until the PR is merged/closed or user help is required. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and keep watching open PRs so fresh review feedback is surfaced promptly. Use when the user asks Codex to monitor a PR, watch CI, handle review comments, or keep an eye on failures and feedback on an open PR.

openai-docs

Use when the user asks how to build with OpenAI products or APIs, asks about Codex itself or choosing Codex surfaces, needs up-to-date official documentation with citations, help choosing the latest model for a use case, or model upgrade and prompt-upgrade guidance; use OpenAI docs MCP tools for non-Codex docs questions, use the Codex manual helper first for broad Codex self-knowledge, and restrict fallback browsing to official OpenAI domains.

openai/test-tui

Guide for testing Codex TUI interactively

path-types

Choose Rust types for operating system paths across the Codex repository. Use when defining new path-bearing types or explicitly migrating existing ones.

plugin-creator

Create and scaffold plugin directories for Codex with a required `.codex-plugin/plugin.json`, optional plugin folders/files, valid manifest defaults, and personal-marketplace entries by default. Use when Codex needs to create a new personal plugin, add optional plugin structure, generate or update marketplace entries for plugin ordering and availability metadata, or update an existing local plugin during development with the CLI-driven cachebuster and reinstall flow.

pushing-ci-changes

Pushing GitHub Actions changes, resolving push rejection, requesting upload exceptions.

skill-creator

Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Codex's capabilities with specialized knowledge, workflows, or tool integrations.

skill-installer

Install Codex skills into $CODEX_HOME/skills from a curated list or a GitHub repo path. Use when a user asks to list installable skills, install a curated skill, or install a skill from another repo (including private repos).

test-tui

Guide for testing Codex TUI interactively

update-v8-version

Update Codex's pinned `v8` / `rusty_v8` versions, validate the release-candidate path, and investigate failed V8 canary or artifact builds. Use when asked to bump V8, update `rusty_v8` artifacts, prepare or validate a V8 release candidate, check `v8-canary`, or diagnose why a V8 version update no longer builds.

相關技能