Expand description
Codex HarnessAdapter — Rust port of packages/cli/src/harnesses/codex.ts.
Codex shares the pending-stamp + watch-loop shape with OpenCode, so the
adapter is constructed via super::pending_stamp::adapter_static
instead of re-implementing the trait. The only codex-specific bits are:
name = "codex"— the dispatch key and log-line label.session_root—$HOME/.codex/sessions, resolved lazily so tests that override$HOMEsee the override.ingest_sessions— opens a fresh ledger handle and runsrelayburn_sdk::ingest_codex_sessions(the codex-only ingest pass). The TS sibling callsingestCodexSessions()directly here; the Rust SDK function takes&mut Ledger, so the closure opens a handle each call. That mirrors the TS lock-then-write-then-close shape, and the per-tick open is cheap (SQLite WAL, no DDL after first open).
The factory’s super::pending_stamp::adapter_static does the
Box::leak so the registry can store the result as
&'static dyn HarnessAdapter. See the factory module for the leak
rationale (codex/opencode are the only two callers; runtime cost is
a few dozen bytes per process).
Functions§
- adapter
- Convenience: hand out a
&'static dyn HarnessAdapterfor the codex adapter. The registry calls this once at lazy-init time. Seepending_stamp::adapter_staticfor the leak semantics — codex is one of two callers and the leaked footprint is bytes, not megabytes. - config
- Build the
PendingStampAdapterconfig for codex. Exposed as a constructor function (rather than astatic) because the closure captures and theArc<dyn Fn>s inside don’t fit a const initializer. The registry calls this once and feeds the result topending_stamp::adapter_static.