name: codex-local-cli-e2e description: Run and debug Agmente iOS end-to-end tests against a real local Codex CLI app-server instance. Use when validating Codex websocket/protocol compatibility, connect/initialize/thread flows, or reproducing Codex-only UI test failures with an actual local Codex server.
Codex Local CLI E2E
Overview
Run Agmente's Codex UI E2E test against a real local codex app-server, using the repo-owned scenario spec as the source of truth, collect actionable failure details, and always clean up simulator/app-server state.
Workflow
- Resolve run inputs.
- Require
endpoint(for examplews://127.0.0.1:8788) and simulatorUDID. - Decide run mode:
existing server: server already running.managed server: start server with a provided command and stop it during cleanup.
- Read
e2e/scenarios/codex/local-cli-smoke.md. - Use
references/agmente-codex-e2e-contract.mdonly for the UI-test environment-variable harness contract.
- Start or verify server.
- If
managed server, start the command and wait until the endpoint port is reachable. - If
existing server, verify reachability before running tests.
- Run only the Codex UI E2E test.
- Export:
AGMENTE_E2E_CODEX_ENABLED=1AGMENTE_E2E_CODEX_ENDPOINT=<endpoint>
- Execute targeted test only:
AgmenteUITests/AgmenteUITests/testCodexDirectWebSocketConnectInitializeAndSessionFlow
- On failure, extract root cause.
- Parse
xcodebuildoutput for the failing test and assertion. - Read
.xcresultdetails whenxcodebuildis not explicit. - Include failing file/line and endpoint/simulator context in the report.
- Always clean up.
- Stop app-server if this run started it.
- Uninstall app from simulator:
xcrun simctl uninstall <UDID> com.example.Agmente
- Optionally shut simulator down if requested.
Preferred Execution
Use the bundled script for deterministic runs:
scripts/run_codex_local_e2e.sh
Managed-server example:
scripts/run_codex_local_e2e.sh \
--endpoint ws://127.0.0.1:8788 \
--udid <SIMULATOR_UDID> \
--start-codex-cmd "codex app-server --listen ws://127.0.0.1:8788"
Existing-server example:
scripts/run_codex_local_e2e.sh \
--endpoint ws://127.0.0.1:8788 \
--udid <SIMULATOR_UDID>
Reporting Requirements
Always report:
- Endpoint used.
- Simulator UDID used.
- Pass/fail status.
- Failing assertion and file/line (if failed).
- Paths to
xcodebuildlog and Codex server log.