prodex 0.2.103

Safe multi-account auto-rotate for Codex CLI with isolated CODEX_HOME profiles
name: CI

on:
  push:
    branches:
      - main
  pull_request:

concurrency:
  group: ci-${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  test:
    runs-on: ubuntu-latest
    timeout-minutes: 30

    steps:
      - name: Check out repository
        uses: actions/checkout@v6

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt

      - name: Cache Rust dependencies
        uses: Swatinem/rust-cache@v2

      - name: Check formatting
        run: cargo fmt --check

      - name: Run binary test targets
        run: cargo test -q --bins -- --test-threads=1

      - name: Run auto-rotate integration tests
        run: cargo test -q --test auto_rotate

      - name: Run main integration tests
        run: cargo test --test main_internal -- --test-threads=1

  runtime-stress:
    runs-on: ubuntu-latest
    timeout-minutes: 30

    steps:
      - name: Check out repository
        uses: actions/checkout@v6

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt

      - name: Cache Rust dependencies
        uses: Swatinem/rust-cache@v2

      - name: Run runtime proxy stress loop
        run: |
          set -euo pipefail
          # The main test job already covers runtime_proxy_ once. Keep one extra focused
          # stress pass here, but leave the slow continuation-heavy cases to the dedicated
          # rerun step below so they are not paid twice in this loop as well.
          for iteration in 1; do
            echo "runtime_proxy_ stress iteration ${iteration}"
            cargo test --test main_internal runtime_proxy_ -- --test-threads=1 \
              --skip runtime_proxy_persists_previous_response_affinity_across_restart \
              --skip runtime_proxy_persists_session_affinity_across_restart_for_compact \
              --skip runtime_proxy_retries_after_websocket_reuse_silent_hang \
              --skip runtime_proxy_does_not_rotate_after_multi_chunk_sse_stall
          done

      - name: Rerun continuation-heavy tests
        run: |
          set -euo pipefail
          for iteration in 1 2; do
            echo "continuation-heavy iteration ${iteration}"
            cargo test --test main_internal runtime_proxy_persists_previous_response_affinity_across_restart -- --test-threads=1
            cargo test --test main_internal runtime_proxy_persists_session_affinity_across_restart_for_compact -- --test-threads=1
            cargo test --test main_internal runtime_proxy_retries_after_websocket_reuse_silent_hang -- --test-threads=1
            cargo test --test main_internal runtime_proxy_does_not_rotate_after_multi_chunk_sse_stall -- --test-threads=1
          done