Context
Two separate cleanup wins sit in crates/relayburn-cli/src/harnesses/:
1. harnesses/codex.rs and harnesses/opencode.rs are 95% identical.
Both expose config() + adapter() with the same shape; they differ only in:
- harness name string,
session_root path (a static ~/.codex/sessions vs ~/.local/share/opencode/storage/session),
- ingest function (
ingest_codex_sessions_into vs ingest_opencode_sessions_into).
These adapters are already constructed via harnesses/pending_stamp.rs::createPendingStampAdapter per the project convention; the per-harness file is essentially a parameter pack.
2. harnesses/mod.rs:179-208 WatcherController is pure boilerplate.
It's a newtype around sdk::WatchController with three pass-through methods plus an unused raw(). The doc comment admits "today this is just a newtype" and enumerates speculative future use cases that haven't landed. Use sdk::WatchController directly — saves ~30 LOC and a wrapper allocation per start_watcher call.
Proposed fix
- Add
pub fn adapter_static(name: &'static str, session_root: &'static Path, ingest: fn(...) -> ...) -> impl HarnessAdapter to harnesses/pending_stamp.rs (or extend the existing factory).
- Replace
harnesses/codex.rs and harnesses/opencode.rs with one call each, or collapse to a single pending_stamp_harnesses! macro / one struct literal each. Both files become roughly 5 lines.
- Replace
WatcherController with sdk::WatchController at the call sites (harnesses/mod.rs:65, 75, ...). Drop harnesses/mod.rs:179-208.
Adjacent: harnesses/claude.rs:50, codex.rs:36, opencode.rs:39 triple-define the same let home = std::env::var_os("HOME").map(PathBuf::from).unwrap_or_else(|| PathBuf::from(".")). Hoist into util/.
Verification
cargo test -p relayburn-cli plus the harness-substrate unit tests under harnesses/. The runtime_adapter_names_match_runtime_adapters test is the existing parity check.
References
crates/relayburn-cli/src/harnesses/{codex,opencode,mod,pending_stamp}.rs
- CLI review notes from the May 2026 Rust review.
Context
Two separate cleanup wins sit in
crates/relayburn-cli/src/harnesses/:1.
harnesses/codex.rsandharnesses/opencode.rsare 95% identical.Both expose
config()+adapter()with the same shape; they differ only in:session_rootpath (a static~/.codex/sessionsvs~/.local/share/opencode/storage/session),ingest_codex_sessions_intovsingest_opencode_sessions_into).These adapters are already constructed via
harnesses/pending_stamp.rs::createPendingStampAdapterper the project convention; the per-harness file is essentially a parameter pack.2.
harnesses/mod.rs:179-208 WatcherControlleris pure boilerplate.It's a newtype around
sdk::WatchControllerwith three pass-through methods plus an unusedraw(). The doc comment admits "today this is just a newtype" and enumerates speculative future use cases that haven't landed. Usesdk::WatchControllerdirectly — saves ~30 LOC and a wrapper allocation perstart_watchercall.Proposed fix
pub fn adapter_static(name: &'static str, session_root: &'static Path, ingest: fn(...) -> ...) -> impl HarnessAdaptertoharnesses/pending_stamp.rs(or extend the existing factory).harnesses/codex.rsandharnesses/opencode.rswith one call each, or collapse to a singlepending_stamp_harnesses!macro / one struct literal each. Both files become roughly 5 lines.WatcherControllerwithsdk::WatchControllerat the call sites (harnesses/mod.rs:65, 75, ...). Dropharnesses/mod.rs:179-208.Adjacent:
harnesses/claude.rs:50, codex.rs:36, opencode.rs:39triple-define the samelet home = std::env::var_os("HOME").map(PathBuf::from).unwrap_or_else(|| PathBuf::from(".")). Hoist intoutil/.Verification
cargo test -p relayburn-cliplus the harness-substrate unit tests underharnesses/. Theruntime_adapter_names_match_runtime_adapterstest is the existing parity check.References
crates/relayburn-cli/src/harnesses/{codex,opencode,mod,pending_stamp}.rs