Skip to content

fix: use TOML parser instead of regex for Codex model extraction (#2222)#2227

Merged
farion1231 merged 2 commits into
farion1231:mainfrom
nmsn:fix/codex-model-toml-parsing
Apr 23, 2026
Merged

fix: use TOML parser instead of regex for Codex model extraction (#2222)#2227
farion1231 merged 2 commits into
farion1231:mainfrom
nmsn:fix/codex-model-toml-parsing

Conversation

@nmsn

@nmsn nmsn commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Fixes #2222

Regex only matched model=... on first line, breaking configs with comments or multiline TOML. Use the existing toml crate to parse properly.

nmsn and others added 2 commits April 22, 2026 09:08
Regex only matched model=... on first line, TOML parser handles
multiline TOML correctly.

Fixes farion1231#2222
The previous commit replaced the only Regex usage in stream_check.rs
with toml::Table parsing, leaving `use regex::Regex;` orphaned.
Without this removal, `cargo clippy -- -D warnings` (run in CI)
fails with `unused import: regex::Regex`.

@farion1231 farion1231 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution!

@farion1231
farion1231 merged commit 3ad7d0b into farion1231:main Apr 23, 2026
0 of 2 checks passed
ManLOK-Chu pushed a commit to ManLOK-Chu/cc-switch that referenced this pull request May 11, 2026
…ion1231#2222) (farion1231#2227)

* fix(codex): use TOML parser instead of regex for model extraction

Regex only matched model=... on first line, TOML parser handles
multiline TOML correctly.

Fixes farion1231#2222

* fix(stream_check): drop unused regex::Regex import

The previous commit replaced the only Regex usage in stream_check.rs
with toml::Table parsing, leaving `use regex::Regex;` orphaned.
Without this removal, `cargo clippy -- -D warnings` (run in CI)
fails with `unused import: regex::Regex`.

---------

Co-authored-by: Jason <[email protected]>
dfbb pushed a commit to dfbb/cc-switch that referenced this pull request May 20, 2026
…ion1231#2222) (farion1231#2227)

* fix(codex): use TOML parser instead of regex for model extraction

Regex only matched model=... on first line, TOML parser handles
multiline TOML correctly.

Fixes farion1231#2222

* fix(stream_check): drop unused regex::Regex import

The previous commit replaced the only Regex usage in stream_check.rs
with toml::Table parsing, leaving `use regex::Regex;` orphaned.
Without this removal, `cargo clippy -- -D warnings` (run in CI)
fails with `unused import: regex::Regex`.

---------

Co-authored-by: Jason <[email protected]>
delta-lo pushed a commit to delta-lo/cc-switch-mod that referenced this pull request May 31, 2026
…ion1231#2222) (farion1231#2227)

* fix(codex): use TOML parser instead of regex for model extraction

Regex only matched model=... on first line, TOML parser handles
multiline TOML correctly.

Fixes farion1231#2222

* fix(stream_check): drop unused regex::Regex import

The previous commit replaced the only Regex usage in stream_check.rs
with toml::Table parsing, leaving `use regex::Regex;` orphaned.
Without this removal, `cargo clippy -- -D warnings` (run in CI)
fails with `unused import: regex::Regex`.

---------

Co-authored-by: Jason <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] 正则表达式导致的Codex测试模型在config.toml中不在首行时会被忽略,导致回退到默认模型gpt-5.1-codex

2 participants