Skip to content

feat(ward): integrate Phase 5 delayed-apply scheduler#430

Open
BunsDev wants to merge 7 commits into
mainfrom
feat/429-phase5-delayed-apply
Open

feat(ward): integrate Phase 5 delayed-apply scheduler#430
BunsDev wants to merge 7 commits into
mainfrom
feat/429-phase5-delayed-apply

Conversation

@BunsDev

@BunsDev BunsDev commented Jul 20, 2026

Copy link
Copy Markdown
Member

Summary

  • migrate the shared Ward audit schema and strictly parse Phase 5 scheduled envelopes
  • add daemon-owned deadline processing, durable decision claims, veto/rationale recovery, and idempotent lifecycle auditing
  • bind apply intents to committed materialized before-images and preserve Channel through replay, enforcement, and audit
  • add transactional baseline finalization and atomic conditional writes that fail closed on concurrent changes

Validation

  • cargo fmt --all -- --check
  • CARGO_INCREMENTAL=0 cargo clippy -p coven-cli --all-targets --locked -- -D warnings
  • CARGO_INCREMENTAL=0 cargo test -p coven-cli --locked (1,261 unit tests plus integration suites; expected ignored binary-only tests remain)
  • final fresh-context review: no significant issues

Closes #429

Upstream: OpenCoven/coven-threads#15
Bead: threads-uqx.6

BunsDev and others added 3 commits July 19, 2026 22:48
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add daemon-owned delayed proposal processing, durable decision claims, fail-closed evidence replay, transactional audit/baseline finalization, and concurrency-safe approved writes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 20, 2026 06:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Integrates Phase 5 delayed-apply scheduling and stricter authority replay into the coven-cli daemon/Ward boundary, including durable persistence and schema migration for audit/baseline state.

Changes:

  • Adds a daemon-owned proposal envelope (proposal_scheduler.rs) with strict JSON shape validation and replay-derived lifecycle fields.
  • Introduces conditional, fail-closed atomic commit for approved Ward applies, including rollback-on-mismatch semantics (ward.rs).
  • Migrates/stamps the shared ward_audit schema in the SQLite store and tightens baseline advancement to fail closed if surfaces changed (store.rs, threads_gate.rs).

Reviewed changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
crates/coven-cli/src/ward.rs Adds approved-apply conditional atomic exchange/rollback path and platform support gating.
crates/coven-cli/src/threads_gate.rs Exposes baseline/surface helpers for scheduler flows and adds post-apply baseline advancement guardrails.
crates/coven-cli/src/store.rs Replaces unconditional ward audit schema init with migration/stamping logic and adds coverage tests.
crates/coven-cli/src/proposal_scheduler.rs New strict scheduled-proposal envelope with replay validation and lifecycle derivation.
crates/coven-cli/src/main.rs Registers the new proposal scheduler module.
crates/coven-cli/src/daemon.rs Starts a background scheduler thread to process due threads proposals.
crates/coven-cli/Cargo.toml Pins coven-threads-core to a specific Phase 5 revision.
Cargo.lock Updates lockfile for the coven-threads-core revision/version bump.

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

Comment on lines +882 to +885
let mut prepared = Vec::with_capacity(edits.len());
let mut preparation_error = None;
for (edit, decision) in edits.iter().zip(decisions) {
let result = (|| -> Result<PreparedConditionalWrite> {
Comment thread crates/coven-cli/src/ward.rs Outdated
Comment on lines +872 to +875
/// Existing targets are exchanged atomically with randomized sibling staging
/// files. The displaced inode is then compared with the approved before-image;
/// a mismatch swaps it back and rolls back every earlier edit in the batch.
/// Already-applied bytes are accepted so crash recovery remains idempotent.
BunsDev and others added 2 commits July 20, 2026 01:53
Expose a daemon-issued authority-envelope revision and canonical familiar UUID, then require manual Phase 5 decisions to carry the inspected revision through durable claim recovery.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use recursively key-sorted compact JSON and SHA-256 so Cave can independently bind displayed staged contents to the daemon revision.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
BunsDev and others added 2 commits July 20, 2026 06:55
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

feat(ward): integrate Phase 5 delayed-apply authority scheduler

2 participants