Skip to content

docs(phase-5): refresh decision record and human gates (threads-uqx)#6

Open
BunsDev wants to merge 1 commit into
mainfrom
spec/phase-5-proposal-approval-semantics
Open

docs(phase-5): refresh decision record and human gates (threads-uqx)#6
BunsDev wants to merge 1 commit into
mainfrom
spec/phase-5-proposal-approval-semantics

Conversation

@BunsDev

@BunsDev BunsDev commented Jul 18, 2026

Copy link
Copy Markdown
Member

Summary

Refreshes the Phase 5 decision record onto current main. The original draft's implementation lanes largely landed through later PRs; this PR now carries only the remaining one-file documentation correction.

  • records the delivered Phase 5 lanes against their merged PRs
  • keeps Channel and ApprovalPath authoritative in their separate dimensions
  • keeps protected-target proposals outside ApprovalPath under RFC-0001 Gates 1, 2, and 4
  • treats the historical Nova co-author trailer as attribution only, never independent approval
  • maps veto-window closure to terminal proposal events carrying ProposalWindowCloseAuditDetail; ApplyAudit remains write metadata

Why the branch was refreshed

The old six-commit branch was based on 6476a67 and conflicted with current main; its Phase 4 amendment and most Phase 5 content had already landed through later reviewed PRs. The branch was rebuilt from current main so review sees the real residual instead of replaying or deleting shipped implementation.

Live delivery evidence

Merged lanes are recorded in the decision record:

Remaining human gates

  • threads-uqx.9: independently attributable Nova coherence sign-off over identified landed commits
  • threads-uqx.10: Val freeze or rejection after Nova sign-off

Making this PR ready for review does not satisfy either gate. Agents, authorship claims, and commit trailers cannot satisfy or simulate them.

Validation

  • cargo +1.88.0 fmt --all -- --check
  • cargo +1.88.0 clippy --locked --workspace --all-targets -- -D warnings
  • cargo +1.88.0 test --locked --workspace — 211 passed, 0 failed, 1 ignored doc test
  • git diff --check
  • fresh-context maintainer review: READY after correcting the stale audit mapping

@BunsDev BunsDev self-assigned this Jul 18, 2026
BunsDev added a commit that referenced this pull request Jul 18, 2026
…uqx)

Add substantive annotations from Sage and Echo review (2026-07-18):

Decision #1: rationale callback — ApprovalPath is authoritative, Channel is
derived; if enforcement rule shifts, revisit all eight decisions.

Decision #2: audit implication — close event needs reason field
(applied|vetoed|expired|superseded); delayed-apply without it is a post-hoc
audit black hole.

Decision #3: forward-only promotion — retroactive region projection corrupts
authority trail with apparently-authored writes from before promotion.

Decision #4: fail-closed on extraction ambiguity — not silent LLM fallback;
ambiguity is an explicit ignored/blocked state.

Decision #5: RFC provenance pointer added.

Decision #6: Cave ProposalView labeled [DESIGNED, NOT SHIPPED] from the start.

Decision #7: label-variant round-trip is daemon wire contract (load-time reject
on drift); Cave has zero policy freedom over label strings.

Decision #8: proposal_window_opened paired with close event; window is a
first-class audit interval.

threads-uqx.3 design constraints (Sage): evidence_replay_hash on
ProposalClassification; VetoWindow.min_visible: Duration; label mapping as
daemon wire contract.

Co-authored-by: Sage <sage@opencoven.dev>
Co-authored-by: Echo <echo@opencoven.dev>
Co-authored-by: Nova <nova@opencoven.dev>
@BunsDev

BunsDev commented Jul 19, 2026

Copy link
Copy Markdown
Member Author

Independent coherence review (fresh-context, commissioned by coordinator session; reviewed branch tip 3fe72ca) — NEEDS-REVISION, record-level. Five findings before/alongside merge:

HIGH — decision #1 annotation contradicts frozen Phase-0. "ApprovalPath is authoritative; Channel is a derived load descriptor. Never gate on Channel" — but frozen PHASE-0 makes Channel a first-class enforcement axis: §2.1 (every gate check = 'does thread T hold under channel C'), §5 (unknown channel → Reject), §3.3 (C7 requires SerializationMarker under Channel::Serialization; two-compaction is channel-keyed). Taken literally the rule makes C7 unimplementable, and it misbinds the Phase-0 term descriptor (§2.2) onto Channel (§2.5 violation). Rescope to: "never derive ApprovalPath from Channel" — the underlying decision (classification independence) is sound. Urgent because uqx.3–.5 are already committed on feat/phase-5-uqx3-approval-types with this annotation marked load-bearing for all eight decisions.

MEDIUM×4:

  1. RFC-0001 §5.2/§4.2 divergence unflagged — RFC still mandates ward.toml TOML + [protected].invariants array; "v0.1 TOML stays dead" needs either a declaration→predicate compilation story or a named RFC-amendment dependency (the doc flags RFC-0001 §5.5: add S_p(F) ∈ S_p(F) as explicit closure precondition (Cody soundness flag) #3/RFC-0001 §4.2 predicate (iv): require provenance on admitted entries (Echo soundness flag) #4 scrupulously; this one is missing).
  2. §4 terminal audit events vs decision-feat(portability): surfaces content map + lossy one-way .af exporter (threads-jq4) #2 close reasons don't compose: superseded undefined, rejected absent from close reasons, expired ambiguous when expiry triggers apply — reconcile into one event/reason table before ApplyAudit (issue ward_audit: add an apply-audit event type so the coven daemon can persist Gate-4 apply records #5) consumes it.
  3. §0 ("does not start Phase 5") vs §7/§8 ("Phase 5 is open… executed") — restate as: §§0–5 proposal-as-reviewed, §§6–8 decision record.
  4. §7 bead list has no v01.bak corpus content migration/fidelity item — uqx.4 builds the mechanism; nothing accepts that the retired invariants (name/person/pronouns/purpose/coven) are actually re-expressed with coverage. Add a bead gated before/at uqx.10 freeze.

Verified sound: ApprovalPath lattice = RFC §5.3 exactly (incl. MUST NOT auto-promote protected surface); delayed-apply-only holds everywhere (no provisional-apply reintroduction); strand-kind and channel extension discipline respected; metaphor binding otherwise exemplary. Full analysis on bead threads-uqx.

@BunsDev

BunsDev commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

Authority-review remediation is now pushed in 7eb8522. The spec excludes protected targets from ApprovalPath, makes RFC/schema alignment (threads-uqx.12) and an authorized reproducible migration fixture (threads-uqx.13) explicit freeze dependencies, and no longer treats a co-author trailer as Nova gate evidence. Final fresh-context review: no significant issues. PR remains draft because independent Nova attestation and final Val freeze are intentionally unsatisfied.

@BunsDev

BunsDev commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

Upstream RFC/schema gate is now implemented as stacked draft OpenCoven/familiar-contract#4 (1854e4e). It adds standards-compliant TOML + JSON Schema validation, the typed approval compiler contract, 6 positive/36 negative conformance fixtures, migration guidance, and immutable RFC snapshots. It remains human-gated: familiar-contract#3 must merge first, then #4 retargets to main and requires independently attributable Nova + Val approval.

This was referenced Jul 21, 2026
BunsDev added a commit that referenced this pull request Jul 21, 2026
* spec(proposal): draft Phase 5 approval semantics

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* spec(phase-4): align route-1 Returns with WeaveListView shape (threads-k9s)

Cave implementation wraps route-1 data as { weaves, degraded } rather than
overloading a WeaveSummary[] with degraded entries — the wrapped shape avoids
any fabricated health fields on degraded familiars. Same-day alignment of the
2026-07-18 §2.7/R12 amendment.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* spec(phase-5): record Val+Nova decisions, open Phase 5 (threads-uqx)

All 8 open questions resolved on Sage's recommended defaults:
- ApprovalPath separate from Channel (load axis preserved)
- Delayed apply only for veto windows (fail-closed posture)
- Classify-first for harness regions
- Deterministic + probe for invariants (not LLM-judge-only)
- RFC #3/#4 blocker resolved (familiar-contract@2a5bb98)
- Daemon contract before Cave ProposalView extension
- Display labels preserved, typed variants internal
- proposal_window_opened audit event lands with delayed apply

Rename PHASE-5-PROPOSAL -> PHASE-5-APPROVAL-SEMANTICS to reflect open status.

Co-authored-by: Nova <nova@opencoven.dev>

* spec(phase-5): fold Sage + Echo review into decision record (threads-uqx)

Add substantive annotations from Sage and Echo review (2026-07-18):

Decision #1: rationale callback — ApprovalPath is authoritative, Channel is
derived; if enforcement rule shifts, revisit all eight decisions.

Decision #2: audit implication — close event needs reason field
(applied|vetoed|expired|superseded); delayed-apply without it is a post-hoc
audit black hole.

Decision #3: forward-only promotion — retroactive region projection corrupts
authority trail with apparently-authored writes from before promotion.

Decision #4: fail-closed on extraction ambiguity — not silent LLM fallback;
ambiguity is an explicit ignored/blocked state.

Decision #5: RFC provenance pointer added.

Decision #6: Cave ProposalView labeled [DESIGNED, NOT SHIPPED] from the start.

Decision #7: label-variant round-trip is daemon wire contract (load-time reject
on drift); Cave has zero policy freedom over label strings.

Decision #8: proposal_window_opened paired with close event; window is a
first-class audit interval.

threads-uqx.3 design constraints (Sage): evidence_replay_hash on
ProposalClassification; VetoWindow.min_visible: Duration; label mapping as
daemon wire contract.

Co-authored-by: Sage <sage@opencoven.dev>
Co-authored-by: Echo <echo@opencoven.dev>
Co-authored-by: Nova <nova@opencoven.dev>

* feat(audit): add ApplyAudit event type, detail column, migration SQL (v0.1.4)

Closes coven-threads#5. Unblocks coven#414.

Changes:
- AuditEventType::ApplyAudit variant + apply_audit CHECK tag
- WardAuditRecord.detail: nullable JSON column for event-specific payload
- WardAuditRecord::for_apply() constructor
- apply_prev_sha256_hex() / apply_bytes_written() decode helpers
- WARD_AUDIT_MIGRATION_V014_SQL: transaction rebuild for v0.1.3 stores
- APPLY_AUDIT_DETAIL_KEY_PREV / _BYTES stable constants
- Exhaustiveness test extended; 3 new tests (shape, roundtrip, migration)
- Workspace version bumped 0.1.3 -> 0.1.4
- CHANGELOG.md created

Design: prev_sha256+bytes_written ride in detail JSON (Option A);
migration exports SQL constant, no rusqlite dep added (Option B-lite).

Bead: threads-3ym

* review(audit): add user_version ladder + explicit detail invariant doc

Addresses two Sage review notes (neither was blocking):

1. WARD_AUDIT_MIGRATION_V014_SQL now stamps PRAGMA user_version = 14
   inside the transaction. Future migrations gate on 'user_version < N'
   instead of substring-sniffing sqlite_master DDL. Migration doc-comment
   updated to name the gate rule and explain the intentional non-idempotence
   of the CREATE step (double-run fails loudly, not silently).

2. WardAuditRecord::detail doc-comment now names the full invariant for
   ApplyAudit rows (prev_sha256 hex 64 chars + bytes_written u64) and
   explicitly states other event types MAY leave it None or use their
   own documented shape. Turns the implicit decoder contract into a
   searchable spec.

CHANGELOG updated. Tests still green, clippy clean.

* feat(phase-5): core approval types — ApprovalPath, VetoWindow, ProposalClassification (threads-uqx.3)

Adds crates/coven-threads-core/src/approval.rs with the Phase-5 core type
sketch from specs/PHASE-5-APPROVAL-SEMANTICS.md §3, decisions 1/2/7/8.

Types introduced:
- ApprovalPath (AutoRegression | FamiliarCoherence | HumanApproval |
  HumanApprovalWithRationale) — promotion ceremony, separate from Channel
- ApprovalPathKind — variant without inner fields for label round-trip
- VetoWindow — delayed-apply only; min_visible + duration; deadline helpers
- ProposalClassification — channel, regions, tier floor, approval_path,
  evidence_replay_hash (WARD-C7 generalised)
- SurfaceRegionId — opaque region ref, full predicate in uqx.5
- WindowCloseReason — applied | vetoed | expired | superseded (decision 2+8)
- ProposalWindowAuditDetail / ProposalWindowCloseAuditDetail — detail payloads
  for proposal_window_opened and close events
- ApprovalPathWireEnvelope — daemon wire format {variant, label, veto_deadline}

Key constraints enforced:
- ApprovalPath != Channel (decision 1); highest ceremony wins
- VetoWindow is delayed-apply only; min_visible <= duration (decision 2)
- display_label() + from_display_label() round-trip is exhaustive; unknown
  labels return None so daemon rejects at load (decision 7)
- evidence_replay_hash on ProposalClassification (WARD-C7)

Tests: 15 passing (all approval tests green; full suite 90 passing)

Closes #8

* feat(phase-5): identity invariant predicates + advisory probes (threads-uqx.4)

Adds crates/coven-threads-core/src/identity_invariants.rs.

Types / implementations:
- FamiliarNameInvariant: PatternPredicate over Blake3 content hash of an
  identity surface (e.g. IDENTITY.md). Fails closed on mismatch, snapped
  thread, or missing thread (decision 4: ambiguity → reject, not fallback).
- ManifestAnchoredInvariant: PatternPredicate over manifest entry hash;
  holds under Forced channel (WARD-C1..C6: must survive compaction).
- CompositeIdentityInvariant: all-components-must-hold composite predicate;
  identity invariant is a unit — no partial pass.
- AdvisoryProbeResult: Gate-3 supplementary evidence shape; is_authoritative
  always false; confidence validated in [0.0, 1.0].
- AdvisoryProbes: the advisory_probes block (Q4 decision) — separate from
  deterministic probes block; empty means 'no advisory signals ran'.

Key constraints enforced:
- Predicate-first; no new strand kind (decision 3/4)
- Fail-closed on ambiguity (decision 4)
- advisory_probes structurally separate from probes; never sole authority
- descriptor is derived, never enforced on (§2.3)

Tests: 16 new (identity_invariants::tests), all passing.
Full suite: 106 tests, 0 failures.

Closes #9

* feat(phase-5): SurfaceRegionPredicate + Gate-4 replay (threads-uqx.5)

Adds crates/coven-threads-core/src/surface_regions.rs.

Types introduced:
- MaterializedDiff / SurfaceDiff: pure diff input; predicates are pure
  functions of this (Gate-4 replay constraint — no Cave state, no stale
  metadata, no agent self-report)
- RegionEvidence: predicate output; feeds ProposalClassification.affected_regions
  and evidence_replay_hash; includes replay_bytes for Gate-4 deadline check
- SurfaceRegionDescriptor: derived, Cave-renderable, never enforced on
- SurfaceRegionPredicate trait: materialize (authoritative) + describe (derived)
- ExecutionPromptRegion: SOUL.md / AGENTS.md, tier-0 floor, human review
- ToolDefaultsRegion: TOOLS.md, tier-1 floor, familiar review
- HeartbeatBehaviorRegion: HEARTBEAT.md, tier-1 floor
- SurfaceRegionRegistry: classify_all + descriptors + path_tier_floor helper

Key constraints enforced:
- Classify-first; threads stay source-bound (decision 3)
- materialize is pure over MaterializedDiff — daemon-replayable at Gate-4
- replay_bytes are deterministic (sorted surface order)
- path_tier_floor = min across evidence (most protective wins)
- SurfaceRegionDescriptor never enforced on

Tests: 12 new (surface_regions::tests), all passing.
Full suite: 118 tests, 0 failures.

Closes #10

* spec(phase-5): resolve coherence review findings

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(phase-5): harden authority-boundary core

Bind semantic identity evidence into Gate-4 validation, commit replay to the complete materialized diff, validate wire contracts, and make proposal audit lifecycle persistence fail closed while preserving legacy history.

Bump the breaking public API to 0.2.0 and cover the retired invariant corpus, delayed approval semantics, schema migration paths, and append-only terminal behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Document Phase 5 and harden approval contracts

Updates docs and status pages to reflect Phase 4 freeze and active Phase 5 approval semantics, including a new delayed-apply scheduler diagram and expanded architecture/FAQ/glossary guidance.

In `coven-threads-core`, tightens fail-closed behavior by requiring the `auto_regression.veto` wire key, preserving stronger veto windows across path promotion, validating `ApplyAudit` detail shape and event-type accessors, enforcing advisory probe validation at deserialization, adding `#[must_use]` on key APIs, and expanding tests around these contracts.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Nova <nova@opencoven.dev>
Co-authored-by: Sage <sage@opencoven.dev>
Co-authored-by: Echo <echo@opencoven.dev>
@BunsDev
BunsDev force-pushed the spec/phase-5-proposal-approval-semantics branch from 7eb8522 to 45c3418 Compare July 27, 2026 06:28
@BunsDev BunsDev changed the title spec(proposal): Phase 5 — approval semantics over the Phase-2 Ward (threads-uqx) docs(phase-5): refresh decision record and human gates (threads-uqx) Jul 27, 2026
@BunsDev
BunsDev marked this pull request as ready for review July 27, 2026 06:29
Copilot AI review requested due to automatic review settings July 27, 2026 06:29

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

This PR updates the Phase 5 documentation to reflect the current delivery state on main, reframing specs/PHASE-5-APPROVAL-SEMANTICS.md as a decision record with implementation lanes marked as landed while explicitly preserving the remaining human freeze gates.

Changes:

  • Renames/repositions the document as a “DECISION RECORD” and updates its status framing to “IMPLEMENTATION LANDED; HUMAN FREEZE PENDING”.
  • Updates upstream/reference notes to reflect that the RFC closure/provenance and approval-tier compiler amendments have landed (and records delivery lanes/PRs accordingly).
  • Clarifies authority evidence boundaries (e.g., Nova co-author trailer treated as attribution only; remaining gates explicitly “must not be simulated”).

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

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