Issues / #1982

#1982 Field report: Codex CLI as a coding agent on Strata — same fix in 36% less time by changing how the agent works (greedy default, Codex output truncation)

open · @fioruccione · 0 コメント · GitHub で見る

BenchmarksSetup & installNVIDIA / CUDAModels & quants

本文

I gave one real coding task to Codex CLI on Strata and to GPT-6.1 in the cloud, repeating it on the same starting code. The aim was not more tokens per second but getting the local model to reach the same result **in fewer steps**. Changing how the agent works cut wall time by **36 %** with the same model, server and quality. On the way we found two settings that other Codex users on Strata may want to know about.

**Setup.** Strata v0.1.40, Qwen3.8 Flash-Next UD-IQ4_XS, 262,144 context, `--kv int8`, MTP `--spec 4`, one slot, 2× RTX 4060 Ti 16 GB, Threadripper PRO 3975WX. Codex CLI 0.162.0 (Responses API), reasoning effort `medium`.

**The task.** One round of 13 fixes on a ~4,000-line Python CAD tool with a FreeCAD backend:
- data integrity, symlinks and locks;
- proposal/commit logic;
- geometry edge cases.

Each fix needed a failing test first. The same external black-box script checked every result on 13 behaviours, and the full existing suite was rerun independently.

| Run | Wall time | Model turns | Generated tok (reasoning) | Input summed | Compactions | Suite | 13 checks |
|---|---|---|---|---|---|---|---|
| Baseline (greedy, original prompt) | 121.8 min | 374 | 287k (166k) | 46.2M | 2 | green | 13/13 |
| 1 · Codex "code mode" only | 127.7 min | 267 | 350k (189k) | 31.0M | 2 | green | 12/13 |
| 2 · Model-card sampling (T 1.0, top-p 0.95, top-k 20) | 85.2 min | 237 | 176k (91k) | 30.2M | 1 | green | 12/13 |
| 3 · Sampling + larger tool output | 118.0 min | 295 | 241k (125k) | 39.0M | 2 | green | 12/13 |
| 4 · Sampling + larger output + work recipes | 79.5 min | 153 | 204k (115k) | 20.5M | 1 | green | 12/13 |
| **5 · Greedy + larger output + work recipes** | **77.9 min** | 181 | **165k (94k)** | 22.1M | 1 | green | 12/13 |
| GPT-6.1 high (cloud, same prompt) | 15.8 min | 55 | 43k (17k) | 6.5M | 0 | green | 13/13 |

Every run missed the same check: the export folder replaced by a symlink. Every run fixed the other symlink cases, and the baseline caught this one only in its final review pass.

### Findings

1. **The gap is the number of steps, not speed or depth per step.**
   - Per turn, Qwen reasoned ~1.4× as much as GPT-6.1.
   - Throughput was similar, prefill and tools included: ~2,400 vs ~2,700 generated tokens per minute.
   - The baseline took 6.8× as many turns: it read files 50 lines at a time (141 reads, one file re-read 26 times) and made many small patches.

2. **Codex truncates tool output for custom providers.**
   - Every command output reached the model cut to ~2,550 tokens (~200 lines), even when the model asked for `max_output_tokens: 30000`.
   - With `tool_output_token_limit = 25000` in the Codex config, the default becomes ~10k tokens and up to 25k on request.
   - This alone cut reads from 141 to 88, but did not cut time by itself.

3. **On v0.1.40, with no `sampling` block, decoding is greedy.**
   - Codex sends no temperature or top-p, so every earlier run was greedy: same prompt, same answer.
   - The model card recommends T 1.0 / top-p 0.95 / top-k 20 for thinking mode.
   - Sampling helped the old workflow (−30 %).
   - With the work recipes, greedy and sampling ended level (78 vs 80 min), and greedy generated 20 % fewer tokens.
   - No repetition loops with greedy over ~2-hour sessions.
   - MTP acceptance was higher with greedy: ~76 % and ~62 tok/s, against ~72 % and ~59 tok/s with sampling.

4. **Codex "code mode" did not suit this model.**
   - Code mode is one JS script running several commands per step.
   - Turns dropped by 29 %, but each cost more reasoning.
   - The reduced JS runtime (no `Buffer`, `require` or `btoa`; patches inside JS strings) produced 41 failed scripts.
   - No time saved.

5. **What worked was telling the agent how to work** (in `AGENTS.md`):
   - work in groups of related fixes;
   - write each group's tests first, then apply the changes as one multi-hunk patch;
   - read whole functions, several ranges per command, with large output;
   - read more only to settle a concrete doubt;
   - keep a short work log on disk, so a compaction does not force re-reading;
   - run the full suite once at the end.

   The effect:
   - Turns halved.
   - Input summed fell from 46M to 22M.
   - Time spent waiting on long commands fell from 26 min to 4.5-12 min.

   Each turn now reasons more (~1,300 vs ~770 generated tokens), so total time fell by about a third, not by half.

### Stability

Six sessions on Strata, 78 to 128 minutes each, with 172 to 388 model calls and 9 context compactions in total (prompts up to ~236k tokens). In none of them was there a server error or hang, a reasoning loop, a lost thread after a compaction, or broken code at the end. Every run ended with the full suite green.

### Caveats

- One run per setup. Greedy runs are reproducible; sampled runs vary (runs 2 and 3 differ by 33 min, more than the one change between them should explain).
- One task, one codebase.
- Not yet tested on v0.1.42.

Thanks for Strata: running a ~88 GiB MoE as a two-hour coding agent on two 16 GB cards is something.

関連リンク

インストール・モデル・リリースへの站内リンク。