Skip to content

feat(adapters): codex T2 — AGENTS.md fenced snippet - #393

Merged
plind-junior merged 3 commits into
vouchdev:testfrom
dripsmvcp:feat/codex-agents-snippet
Jul 6, 2026
Merged

feat(adapters): codex T2 — AGENTS.md fenced snippet#393
plind-junior merged 3 commits into
vouchdev:testfrom
dripsmvcp:feat/codex-agents-snippet

Conversation

@dripsmvcp

Copy link
Copy Markdown
Contributor

codex reads AGENTS.md for project instructions the same way cursor does, and the cursor adapter already ships this exact tier. without it, a codex session gets the kb tools but no standing instructions on when to recall or how to propose through the review gate. this adds adapters/codex/AGENTS.md.snippet as a T2 tier with the standard fence markers.

the snippet carries the same invariants as cursor's (what vouch is, all writes via proposals, review stays human) and is phrased host-neutrally: the only difference is the VOUCH_AGENT=codex identity line, and a sync test asserts codex_snippet == cursor_snippet.replace("cursor", "codex") so the two can't drift apart silently.

the ticket's acceptance criteria also call for "an edited fence body is replaced within the markers", which _install_fenced didn't do — it skipped whenever the fence existed, so a hand-edited or stale snippet stayed stale forever. the fenced writer now recognizes its own fence and brings a drifted body back in sync in place (reported through the merged channel), touching nothing outside the markers. an up-to-date fence still reports skipped, so re-runs stay flat-noop and the existing claude-code/cursor/openclaw behavior is preserved; a begin marker without an end marker is treated as corrupt and left alone. this benefits every fenced adapter, not just codex.

tests cover: append to an existing AGENTS.md, create when absent, idempotent re-run, T1 not touching AGENTS.md, the cursor lockstep check, edited-fence refresh (user content above and below the fence survives), and the unclosed-fence guard. full suite, mypy, and ruff green.

stacks on #392 (both touch adapters/codex/install.yaml) — merge after it; once #392 lands this diff reduces to the T2 change.

closes #385

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 00e894e2-cdc6-446d-8243-9ba8bd0dec99

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI 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.

Pull request overview

Adds Codex adapter T2 guidance via an AGENTS.md fenced snippet (kept in lockstep with Cursor’s snippet), and improves the installer so fenced snippets can be refreshed in-place when their fence body has drifted. The PR also introduces toml_merge support for Codex’s .codex/config.toml so existing user config is deep-merged rather than silently skipped.

Changes:

  • Add adapters/codex/AGENTS.md.snippet and wire it into Codex install.yaml as a T2 fenced_append install.
  • Update _install_fenced to refresh a drifted fenced body in-place (and report via InstallResult.merged).
  • Add toml_merge support + TOML serializer/merge logic, and expand installer tests to cover Codex T2 and TOML merge behaviors.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/test_install_adapter.py Adds coverage for Codex T2 fenced snippet install/refresh and Codex TOML merge behavior.
src/vouch/install_adapter.py Implements fenced-body refresh behavior and adds toml_merge support (merge + serialize + install).
adapters/codex/install.yaml Defines fence markers, enables toml_merge for T1, and adds T2 fenced snippet entry.
adapters/codex/AGENTS.md.snippet New Codex AGENTS snippet (intended to stay cursor-lockstep modulo host name).

Comment thread src/vouch/install_adapter.py Outdated
Comment on lines +284 to +288
existing = dst.read_text(encoding="utf-8")
if manifest.fence_begin in existing:
result.skipped.append(rel_dst)
begin = existing.index(manifest.fence_begin)
end = existing.find(manifest.fence_end, begin)
if end == -1:
dripsmvcp added 3 commits July 6, 2026 17:32
vouchdev#361 inserted `_log = logging.getLogger(...)` between two import
groups in jsonl_server.py. that statement-among-imports trips ruff's
E402 on every import that follows it, so `ruff check src tests` — the
lint gate in ci — now fails on the whole repo. move the logger
definition below the imports (where storage.py already keeps its own
module logger); no behaviour change.
.codex/config.toml is codex's primary config file, so the plain-copy
path silently skipped any project where codex was already configured
and vouch never got wired. add a toml_merge entry flag mirroring
json_merge: parse the existing destination with tomllib, deep-merge
the template's tables into it (existing user values always win on
conflict), and write back. flip the codex T1 entry to toml_merge.

writing uses a minimal hand-rolled serializer (tables, arrays, inline
tables in arrays, scalars, datetimes) so the dependency set stays
unchanged; the output must survive a tomllib round-trip back to the
merged data, and anything the serializer can't faithfully re-emit
degrades to skipped rather than risking the user's config.

closes vouchdev#384
codex reads AGENTS.md for project instructions the way cursor does,
but the codex adapter stopped at T1, so a codex session got the kb
tools with no standing guidance on recall-first or the review gate.
ship adapters/codex/AGENTS.md.snippet as a T2 tier with the standard
fence markers, kept in lockstep with cursor's snippet modulo the host
name (enforced by a sync test).

also close the edited-fence gap in _install_fenced per the ticket's
acceptance criteria: a fence body that drifted from the shipped
snippet is replaced within the markers (reported as merged) instead
of being skipped forever, while user content outside the fence stays
untouched. a begin marker without an end marker is treated as corrupt
and left alone.

closes vouchdev#385
@dripsmvcp
dripsmvcp force-pushed the feat/codex-agents-snippet branch from 8ace918 to 628c733 Compare July 6, 2026 08:38
@github-actions github-actions Bot added mcp mcp, jsonl, and http surfaces size: L 500-999 changed non-doc lines and removed size: M 200-499 changed non-doc lines labels Jul 6, 2026
@dripsmvcp

Copy link
Copy Markdown
Contributor Author

addressed the copilot review: _install_fenced now recognises the fence only when the BEGIN/END markers each sit on their own line, so a file that merely mentions the marker text in prose or a code sample is no longer mistaken for an installed fence — and an in-place refresh can't clobber content between two stray mentions. added tests for the prose-mention append and the marker-mention-below-a-real-fence no-op.

@plind-junior
plind-junior merged commit 6eaba12 into vouchdev:test Jul 6, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adapters agent host adapters and install manifests mcp mcp, jsonl, and http surfaces size: L 500-999 changed non-doc lines tests tests and fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants