Repository navigation
refactor(codex, agent): split the module, no behaviour change - #65
Merged
Merged
Conversation
… the split 60 real and broken `codex exec --json` lines read on both routes, 7 whole turns, the argv and environment of 11 spawn configurations, the bridged registration, mcp_config and a turn that cannot start; budget_for_spawn at every size around its limits, its priority order, both cut floors and the spill notice. Every expectation was produced by the code as it stands.
Same expectations, same assertions: the whole-turn cases and readings become consts, and the spawn pin builds its configurations and its two routes' expected argv in helpers, so no pin function passes 100 lines. The argv helper is renamed `reported`, which no other module defines.
codex.rs becomes src/agent/codex/: mod.rs (the backend and its settings), argv.rs (both routes' commands, MODEL_ONLY_OVERRIDES, the bridge registration), bridged.rs (run_bridged), wire.rs (the --json wire types and Reading). Reading::line is one match that hands each variant to a helper; the long bridged-turn test is backed by setup and event helpers with the same assertions. Tests split into codex/tests.rs and codex/wire_tests.rs, declared #[cfg(test)]. agent/mod.rs keeps AgentEvent, TurnOutcome, the quota status and AgentError; the trait and its Box forwarding move to backend.rs, the handover classifiers to handover.rs, budget_for_spawn to spawn_budget.rs as named steps (by_priority, is_high_priority, Kept::take). Everything is re-exported at its old path. Docs that named codex.rs or agent/mod.rs now name the new files. The pins of the two commits before pass unchanged; MAX_UNWIRED stays 41.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Behaviour-preserving split answering the code-auditor findings on
src/agent/codex.rs(2183 lines;Reading::linecomplexity 30 / 145 lines; a 114-line test) andsrc/agent/mod.rs(1307 lines;budget_for_spawn101 lines).Commits
src/agent/codex/pinned_tests.rs: 60 real and brokencodex exec --jsonlines read on both routes (everyWirevariant and item type, malformed lines), 7 whole turns, the argv + environment of 11 spawn configurations (own route fresh/resumed, every permission mode, bridged fresh/resumed, a Windows server path), the 14MODEL_ONLY_OVERRIDES,mcp_config, and a turn whose binary is missing.src/agent/budget_pinned_tests.rs:budget_for_spawnat every size around its limits, priority order, both cut floors (100/120), char boundaries, and the exact spill notice. Every expectation was produced by the original code.18 passed; 0 failed; ... 2318 filtered out.Layout
agent/mod.rs(AgentEvent, TurnOutcome, quota status, AgentError)agent/backend.rs(trait + Box forwarding)agent/handover.rsagent/spawn_budget.rsagent/codex/mod.rsagent/codex/argv.rsagent/codex/bridged.rsagent/codex/wire.rsagent/codex/tests.rs/wire_tests.rs/pinned_tests.rsEverything is re-exported at its old path; no caller changed.
MAX_UNWIREDstays 41 (is_limit_statusstays inmod.rsso it is not re-exported by name, which would have hidden that it is still unwired).Checks
cargo fmt --all -- --check,cargo clippy --all-targets -q -- -D warnings,cargo test -q: lib 2318 -> 2336 (2326 passed, 10 ignored), 59 bin. The static auditor reports no function over 100 lines or complexity 20 in the touched files.