Skip to content

feat(tui): register interactive sessions in the Coven ledger (opt-in) (Phase 3, Track B)#152

Merged
BunsDev merged 2 commits into
mainfrom
feat/engine-ledger
Jul 13, 2026
Merged

feat(tui): register interactive sessions in the Coven ledger (opt-in) (Phase 3, Track B)#152
BunsDev merged 2 commits into
mainfrom
feat/engine-ledger

Conversation

@BunsDev

@BunsDev BunsDev commented Jul 13, 2026

Copy link
Copy Markdown
Member

Summary

Phase 3, Track B (engine side): when enabled, the interactive TUI registers itself in the Coven daemon's ledger so the session appears in coven sessions. Companion to the daemon-side PR on OpenCoven/coven (the /api/v1/sessions/external + /complete endpoints).

What's in this PR

  • DaemonClient methods (coven_daemon.rs): register_external_session and complete_session, mirroring the existing create_session transport. Request keys are camelCase (id, projectRoot, harness, title, transcriptPath; exitCode) — verified to match the daemon's parser exactly.
  • daemonLedger setting (opt-in, default off): only acts when a Coven daemon socket is present.
  • Best-effort notifier (coven_ledger.rs, #[cfg(unix)]-gated): registers on session start (off the TUI event loop via spawn_blocking) and completes on the single clean exit. Every failure is swallowed to a debug log — a dead or absent daemon never affects the TUI.
  • The registered session id is captured so a mid-run /resume (which rebinds the session) can't leave a registration uncompleted.

Verification

  • cargo test --workspace, cargo clippy --workspace --all-targets -- -D warnings, cargo fmt --check — all clean. Serialization tests assert the camelCase keys and that snake_case doesn't leak.

Review

Spec-compliant and quality-approved; a final cross-repo integration review confirmed the notifier↔daemon wire contract end-to-end and the /resume id-capture fix. Commit signed; no AI co-author trailer (per this repo's AGENTS.md).

When `daemonLedger` is enabled and a Coven daemon socket is present, the
interactive TUI registers itself via POST /api/v1/sessions/external on start
and POST /api/v1/sessions/<id>/complete on exit. Best-effort: every failure is
swallowed so a dead or absent daemon never affects the TUI. Opt-in (default off).
Copilot AI review requested due to automatic review settings July 13, 2026 02:17
@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Jul 13, 2026 3:23am

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 an opt-in path for the interactive TUI to register and complete its session in the Coven daemon “ledger”, so it can appear in coven sessions, using new daemon client endpoints and a small best-effort notifier layer.

Changes:

  • Add daemonLedger (default off) to settings to enable ledger notifications.
  • Implement best-effort ledger notifier functions (notify_session_start / notify_session_complete) in core.
  • Extend DaemonClient with register_external_session and complete_session plus serialization tests.

Reviewed changes

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

File Description
src-rust/crates/core/src/lib.rs Exposes coven_ledger module and adds daemonLedger setting merge behavior.
src-rust/crates/core/src/coven_ledger.rs Adds best-effort session start/complete notifier wrappers around daemon IPC.
src-rust/crates/core/src/coven_daemon.rs Adds external-session register/complete endpoints and serialization tests.
src-rust/crates/cli/src/main.rs Wires opt-in registration at interactive start and completion at interactive exit.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +4572 to 4577
if let Some(id) = &ledger_session_id {
claurst_core::coven_ledger::notify_session_complete(id, Some(0));
}

restore_terminal(&mut terminal)?;
Ok(())
@BunsDev
BunsDev merged commit 9060913 into main Jul 13, 2026
4 checks passed
@BunsDev
BunsDev deleted the feat/engine-ledger branch July 13, 2026 05:37
@BunsDev
BunsDev requested review from CompleteDotTech and removed request for CompleteDotTech July 13, 2026 05:40
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.

2 participants