Skip to content

test: cover non-adjacent qmax env table in Codex config writer - #226

Open
Desperado wants to merge 1 commit into
mainfrom
test/codex-split-qmax-env-table
Open

Desperado wants to merge 1 commit into
mainfrom
test/codex-split-qmax-env-table

Conversation

@Desperado

Copy link
Copy Markdown
Contributor

Why

qmax-code v1.40.0 broke ~/.codex/config.toml in the field. Its writer replaced only the exact [mcp_servers.qmax] header, so a separate [mcp_servers.qmax.env] table further up the file (with other tables in between) survived. The next write appended an inline env = { ... }, which defined env twice, and Codex refused to start:

failed to load workspace requirements: invalid configuration at ~/.codex/config.toml:541:1

#223 (shipped in v1.40.2) already fixes the writer. The existing test only covers an env table placed right after the qmax header, so nothing pins the non-adjacent layout seen in practice.

What

Test-only change in internal/agent/codex_config_test.go:

  • TestCodexMCPRemovesNonAdjacentEnvTable: a stale [mcp_servers.qmax.env] separated from [mcp_servers.qmax] by other server and project tables is removed. Unrelated bytes are unchanged, the output is valid TOML, the new env wins, and a second write is idempotent.
  • TestWriteCodexMCPEntryLeavesDuplicateEnvConfigUnchanged: a config the old writer already broke is refused and left byte-for-byte unchanged.

Verification

  • go test ./... passes.
  • Mutation check: with the skip condition reverted to match only [mcp_servers.qmax] (len(path) == 2), TestCodexMCPRemovesNonAdjacentEnvTable fails.

Pre-v1.40.2 writers replaced only the exact [mcp_servers.qmax] header, so a
[mcp_servers.qmax.env] table elsewhere in ~/.codex/config.toml survived. The
next inline env = { ... } defined env twice and Codex failed to load with
'invalid configuration'. PR #223 fixed the writer; these tests pin it:

- a stale env table separated from the qmax header by other tables is removed,
  unrelated bytes are preserved, and a second write is idempotent
- a config the old writer already broke is refused and left unchanged
@qualitymaxapp

qualitymaxapp Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

QualityMax Review

Verdict: COMMENT · Confidence: evidence-backed scan

Re-review: Open the QualityMax check and select Re-review after it completes.

Files eligible: 1 · Files reviewed: 1 · Files with findings: 0 · Findings: 0 · Inline cards: 0

Priority findings

priority location finding
— — No blocking findings

Review gates

gate status
AI diff review completed · eligible 1, reviewed 1 · MODEL-ONLY findings are advisory · batches reviewed 1 of 1 · LLM · served gemini-3.1-flash-lite
SAST completed · eligible 1, reviewed 1 · hybrid · served qwen3.7-plus
Overall review evidence clean
Inline evidence not needed

Important files

file risk note next step
— — No findings —

Review lifecycle

Use the inline cards to inspect evidence and suggested remediation. Re-run the QualityMax review after pushing a fix; unchanged cards are identified by their stable finding marker. Dismiss with a reason through the existing QualityMax/GitHub review feedback flow. 0 prior card(s) are stale/resolved on this head. @qmax Q&A is tracked separately.

Proof legend: GROUNDED deterministic scanner evidence · MODEL-ONLY advisory model judgment · MODEL-REVIEWED patch model judgment, not reproduction.

QualityMax project results are available in the configured project.

Receipt · commit 407c98e861a716a5e50b3e4e32061e9d0d188ffb · run 2026-11-26T05:48:57+00:00 · model served qwen3.7-plus, gemini-3.1-flash-lite · model requested qwen3.7-plus, gemini-3.1-flash-lite · model review recorded — 884 model output tokens · model source repository ai_review_preferences.preferred_model · re-review 2 · proof counts {}

@qualitymaxapp qualitymaxapp Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

QualityMax Review — canonical overview updated; no inline findings were created for this review.

@qualitymaxapp

qualitymaxapp Bot commented Nov 26, 2026

Copy link
Copy Markdown

QualityMax Code Health

Grade A · 100/100 · PASS — 0 finding(s) in 1 file(s).

No code-health findings.

Full report · Commit 407c98e

@qualitymaxapp

qualitymaxapp Bot commented Nov 26, 2026

Copy link
Copy Markdown

⚠️ QualityMax Pipeline

Gate Result
🔍 AI diff review ✅ Clean · gemini-3.1-flash-lite · completed · 1 eligible / 1 reviewed · gemini-3.1-flash-lite
🔍 SAST completed · 1 eligible / 1 reviewed · qwen3.7-plus
🔍 Canonical PR review delivery completed · 0 eligible / 0 reviewed · exact-head review #6069150078 and overview #7183824151 confirmed
🔍 Repository runtime evidence completed · 0 eligible / 0 reviewed · runtime execution passed for the assessed revision
🔍 Runtime evidence policy completed · 0 eligible / 0 reviewed · admissible runtime evidence satisfies this advisory runtime-only policy
🧪 Repo Tests ✅ 1591/1591 passed (go)
🤖 AI Tests ❌ blocked before sandbox execution (sandbox_concurrency_limit; go_test)

Powered by QualityMax — AI-Powered Test Automation

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants