prodex 0.48.0

OpenAI profile pooling and safe auto-rotate for Codex CLI and Claude Code
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
name: CI

on:
  push:
    branches:
      - main
  pull_request:

permissions:
  contents: read

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

jobs:
  fmt:
    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

  docs-lint:
    runs-on: ubuntu-latest
    timeout-minutes: 30

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

      - name: Install Node.js
        uses: actions/setup-node@v6
        with:
          node-version: 22
          package-manager-cache: false

      - name: Lint markdown docs
        run: npm run docs:lint

  secret-scan:
    runs-on: ubuntu-latest
    timeout-minutes: 30

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

      - name: Scan repository for leaked credentials
        shell: bash
        run: |
          set -euo pipefail
          docker run --rm \
            -v "${PWD}:/repo" \
            ghcr.io/gitleaks/gitleaks:v8.30.1 \
            detect --source /repo --no-git --redact --no-banner --config /repo/.gitleaks.toml

  supply-chain:
    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: clippy

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

      - name: Cache cargo supply-chain tools
        id: cargo-supply-chain-cache
        uses: actions/cache@v5
        with:
          path: |
            ~/.cargo/bin/cargo-audit
            ~/.cargo/bin/cargo-deny
          key: ${{ runner.os }}-cargo-supply-chain-tools-audit-0.22.1-deny-0.19.0

      - name: Check locked compile graph
        run: cargo check --locked --all-targets --all-features

      - name: Run clippy warning gate
        run: cargo clippy --locked --all-targets --all-features -- -D warnings

      - name: Install cargo-audit
        shell: bash
        run: |
          set -euo pipefail
          if ! command -v cargo-audit >/dev/null 2>&1; then
            cargo install cargo-audit --locked --version 0.22.1
          fi

      - name: Run cargo audit
        shell: bash
        run: |
          set -euo pipefail
          for attempt in 1 2 3; do
            if cargo audit; then
              exit 0
            fi
            if [ "$attempt" -eq 3 ]; then
              exit 1
            fi
            sleep "$((attempt * 5))"
          done

      - name: Install cargo-deny
        shell: bash
        run: |
          set -euo pipefail
          if ! command -v cargo-deny >/dev/null 2>&1; then
            cargo install cargo-deny --locked --version 0.19.0
          fi

      - name: Run cargo deny checks
        shell: bash
        run: |
          set -euo pipefail
          for attempt in 1 2 3; do
            if cargo deny check advisories sources; then
              exit 0
            fi
            if [ "$attempt" -eq 3 ]; then
              exit 1
            fi
            sleep "$((attempt * 5))"
          done

  release-sync:
    runs-on: ubuntu-latest
    timeout-minutes: 30

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

      - name: Verify release/version sync
        shell: bash
        run: |
          set -euo pipefail
          npm run npm:sync-version
          git diff --exit-code -- Cargo.toml npm README.md QUICKSTART.md scripts/npm

  npm-package-smoke:
    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

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

      - name: Install Node.js
        uses: actions/setup-node@v6
        with:
          node-version: 22
          package-manager-cache: false

      - name: Build host release binary
        run: cargo build --release --locked --target x86_64-unknown-linux-gnu

      - name: Smoke staged npm package
        run: node scripts/ci/npm-package-smoke.mjs --binary-dir target/x86_64-unknown-linux-gnu/release

  auto-rotate:
    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

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

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

  profile-commands-internal:
    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

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

      - name: Run profile command internal tests
        run: |
          cargo test --lib profile_commands_internal_tests:: -- --test-threads=1

  main-internal-core:
    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

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

      - name: Run main internal tests without runtime proxy shard
        run: |
          set -euo pipefail
          cargo test --lib main_internal_tests:: -- --skip runtime_proxy_ --test-threads=1

  env-sensitive-parallel-guard:
    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

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

      - name: Run env-sensitive parallel guard
        run: node scripts/ci/runtime-env-parallel.mjs --runs 2 --test-threads 4

  main-internal-runtime-proxy:
    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

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

      - name: Validate runtime CI manifest
        run: npm run ci:runtime-manifest

      - name: Run runtime proxy internal test shard
        run: node scripts/ci/runtime-proxy-shard.mjs

      - name: Upload runtime proxy shard diagnostics
        if: failure()
        uses: actions/upload-artifact@v7
        with:
          name: runtime-proxy-shard-diagnostics
          path: target/ci/runtime-proxy
          if-no-files-found: ignore

  runtime-proxy-bench-smoke:
    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

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

      - name: Check runtime proxy benchmark regression thresholds
        env:
          PRODEX_RUNTIME_PROXY_BENCH_CHECK: "1"
          PRODEX_RUNTIME_PROXY_BENCH_THRESHOLD_FILE: scripts/ci/runtime-proxy-bench-thresholds.json
        run: cargo bench --locked --features bench-support --bench runtime_proxy_hot_paths

  runtime-stress:
    name: Runtime stress (${{ matrix.label }})
    runs-on: ubuntu-latest
    timeout-minutes: 30
    strategy:
      fail-fast: false
      matrix:
        include:
          - suite: stress
            label: broad shard
          - suite: serialized
            label: serialized shard
          - suite: continuation
            label: continuation shard
    env:
      RUNTIME_STRESS_ARTIFACT_DIR: target/ci/runtime-stress/${{ matrix.suite }}
      PRODEX_RUNTIME_LOG_DIR: target/ci/runtime-stress/${{ matrix.suite }}/runtime-logs
      CARGO_TERM_COLOR: always
      RUST_BACKTRACE: "1"

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

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

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

      - name: Prepare runtime stress diagnostics
        shell: bash
        run: |
          set -euo pipefail
          rm -rf "${RUNTIME_STRESS_ARTIFACT_DIR}"
          mkdir -p "${PRODEX_RUNTIME_LOG_DIR}"
          {
            echo "suite=${{ matrix.suite }}"
            echo "label=${{ matrix.label }}"
            echo "artifact_dir=${RUNTIME_STRESS_ARTIFACT_DIR}"
            echo "runtime_log_dir=${PRODEX_RUNTIME_LOG_DIR}"
            echo "started_at=$(date -u +%FT%TZ)"
            echo "command=npm run ci:runtime-stress -- --suite ${{ matrix.suite }}"
          } > "${RUNTIME_STRESS_ARTIFACT_DIR}/metadata.txt"

      - name: Run runtime stress ${{ matrix.label }}
        shell: bash
        run: |
          set -euo pipefail
          npm run ci:runtime-stress -- --suite "${{ matrix.suite }}" 2>&1 | tee "${RUNTIME_STRESS_ARTIFACT_DIR}/runtime-stress.log"

      - name: Collect runtime stress diagnostics
        if: failure()
        shell: bash
        run: |
          set -euo pipefail
          mkdir -p "${RUNTIME_STRESS_ARTIFACT_DIR}" "${PRODEX_RUNTIME_LOG_DIR}"
          diagnostics_path="${RUNTIME_STRESS_ARTIFACT_DIR}/diagnostics.txt"
          pointer_path="${PRODEX_RUNTIME_LOG_DIR}/prodex-runtime-latest.path"
          latest_log_path=""
          {
            echo "suite=${{ matrix.suite }}"
            echo "label=${{ matrix.label }}"
            echo "artifact_dir=${RUNTIME_STRESS_ARTIFACT_DIR}"
            echo "runtime_log_dir=${PRODEX_RUNTIME_LOG_DIR}"
            echo "finished_at=$(date -u +%FT%TZ)"
            echo "runtime_log_pointer=${pointer_path}"
          } > "${diagnostics_path}"
          if [[ -f "${pointer_path}" ]]; then
            latest_log_path="$(tr -d '\r\n' < "${pointer_path}")"
            echo "runtime_log_pointer_target=${latest_log_path}" >> "${diagnostics_path}"
          else
            echo "runtime_log_pointer_target=missing" >> "${diagnostics_path}"
          fi
          if [[ -z "${latest_log_path}" || ! -f "${latest_log_path}" ]]; then
            latest_log_path="$(
              find "${PRODEX_RUNTIME_LOG_DIR}" -maxdepth 1 -type f -name 'prodex-runtime*.log' -printf '%T@ %p\n' \
                | sort -nr \
                | head -n 1 \
                | cut -d' ' -f2-
            )"
          fi
          find "${PRODEX_RUNTIME_LOG_DIR}" -maxdepth 1 -type f -print \
            | sort \
            | sed 's/^/log_entry=/' >> "${diagnostics_path}"
          if [[ -n "${latest_log_path}" && -f "${latest_log_path}" ]]; then
            echo "latest_runtime_log=${latest_log_path}" >> "${diagnostics_path}"
            cp "${latest_log_path}" "${RUNTIME_STRESS_ARTIFACT_DIR}/latest-runtime.log"
            tail -n 200 "${latest_log_path}" | tee "${RUNTIME_STRESS_ARTIFACT_DIR}/latest-runtime-log-tail.txt"
          else
            echo "latest_runtime_log=missing" >> "${diagnostics_path}"
          fi

      - name: Upload runtime stress diagnostics
        if: failure()
        uses: actions/upload-artifact@v7
        with:
          name: runtime-stress-${{ matrix.suite }}-diagnostics
          path: ${{ env.RUNTIME_STRESS_ARTIFACT_DIR }}
          if-no-files-found: ignore