Skip to content

Layer 7: Deterministic Decision + Execution Rail #97

Description

@d3v07

Blocked until d3v07 reviews and approves or requests changes on frex22's Layers 1-4 PR.

Assignee:
d3v07

Branch:
feature/d3v07-layers-5-8-safety-execution-governance

Context:
Use the Layer 7 architecture image as the visual and technical spec. This layer is where mutation authority lives. Agents recommend. Engine decides. Only backend executes.

Goal:
Harden the deterministic decision and execution rail so VERIFIED is earned only by strict evidence checks.

Strict VERIFIED criteria:
A run may be marked VERIFIED only when all checks pass:

  1. blocking SORT is gone
  2. selected index is evidenced in winning or hinted plan
  3. docs examined or keys examined or execution time improves
  4. verification result is written to trace / ledger

If any check fails:

  • remain applied-but-not-verified
  • record failed checks
  • show failure trace
  • do not mark VERIFIED

Required work:

  • Harden or preserve strict verification semantics in deterministic Python.
  • Keep apply backend-only and approval-gated.
  • Ensure evidence hash remains bound to the approved pack.
  • Ensure stale or mismatched approvals cannot unlock apply.
  • Ensure verification trace names failed checks.
  • Ensure ledger writes capture verification result.

Non-negotiable constraints:

  • Agents cannot apply indexes.
  • Agents cannot mark runs VERIFIED.
  • Frontend cannot mark runs VERIFIED.
  • Browser cannot see secrets or database credentials.
  • Do not change EvidencePack v1 unless explicitly approved.
  • Do not add API routes unless explicitly approved.

Backend tests required:

  • strict verification passes when SORT removed, selected index is evidenced, metrics improve, ledger trace written
  • strict verification fails when SORT remains
  • strict verification fails when selected index is not evidenced
  • strict verification fails when no metric improves
  • verification-failed state records failed checks in trace
  • stale approval hash cannot unlock apply
  • agents cannot call mutation functions
  • tools remain read-only

Acceptance criteria:

  • Deterministic Python is the only code path that can apply and verify.
  • VERIFIED status cannot be produced by agent output or frontend logic.
  • Failed verification remains visibly failed/applied-but-not-verified.
  • Ledger/trace contains enough proof to audit the outcome.

Tests:
Run:
uv run pytest tests/unit/test_orchestrator.py tests/unit/test_ledger_store.py -q
uv run pytest -q
uv run ruff check controller tests

If dashboard verification state UI is touched:
cd dashboard && npm run lint
cd dashboard && ./node_modules/.bin/tsc --noEmit
cd dashboard && npm run build

Deviation guard:
Stop and ask before changing EvidencePack v1, renaming tools, adding API routes, adding agent mutation authority, exposing credentials, or marking VERIFIED from frontend-only logic.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions