Skip to content

feat(decision): harden decision layer (rounds 5-7) - #9

Merged
trac41799 merged 3 commits into
mainfrom
feat/decision-hardening-r7
Sep 29, 2026
Merged

trac41799 merged 3 commits into
mainfrom
feat/decision-hardening-r7

Conversation

@trac41799

Copy link
Copy Markdown
Owner

What

Hardens the decision layer (spec 001-decision-layer) — rounds 5–7 of the adversarial review — rebased onto current origin/main.

Fixes

  • R-13 — wire all six formerly-dead integration points (compounder, KG typing, outcome, failure, handoff, contradiction); reachability now 13 solid / 0 partial.
  • R-4 — batched decisions (choose_batch/judge_batch): one request for N questions (KG types+gate = 2, relations = 1, contradictions = 1/item; was 2·N / N / N²).
  • R-1 — network-holding commands open an independent connection (db::open_aux + busy_timeout), so the shared Mutex<Connection> is never held across HTTP.
  • R-2 — one reused ureq::Agent per timeout; blocking-network commands are non-async.
  • R-3 — daemon applies an env-configurable accept/review band and emits a decision_usage audit line.
  • R-10 — circuit breaker + $5 spend cap.
  • R-12 — hash-only replay fingerprint (input_hash, FNV-1a).
  • R-14 — migrations fail loudly if a decision table is missing.
  • R-15 — decision_reviews dedup.
  • R-16 / R-5 — review-band enqueue for contradiction + verification.
  • R-17 — health_probe: backend/auth → degraded; tracks last_success_ms().
  • R-7 — worktree diff feeds the semantic secrets check.
  • R-8 — spec R7 tightened (structured state is rejected, not truncated).

Reconciliation with origin/main

  • Dropped our commands::run_compounder_cmd — origin already ships knowledge_commands::run_compounder_cmd + the split compounder_prepare_prompt/compounder_merge helpers (kept theirs).
  • Renumbered migrations: 017_decision_reviews_unique → 019, 018_decision_usage_hash → 020 (origin took 017 for 017_build_runs.sql).
  • Frontend now uses IPC constants (inferOutcome, diagnoseFailure) instead of inline literals; regenerated the IPC unused-command snapshot per the contract test's documented workflow.

Verification

Gate Result
cargo test (MSVC) 210 lib + 42 integration = 252 passed / 0 failed
npm test 341 passed / 0 failed (35 files, incl. IPC contract)
npx tsc --noEmit clean
npm run lint 0 errors (13 warnings)
pytest local-daemon/tests/test_router.py 23 passed

Migrations added: 019_decision_reviews_unique.sql, 020_decision_usage_hash.sql.

Docs: architecture.md (§5 reachability + §8 risk register), spec.md, review-round5..7.md.

@vercel

vercel Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
source-forge Ready Ready Preview Sep 29, 2026 10:41am UTC

- R-13: wire all six dead integration points (compounder, KG typing, outcome,
  failure, handoff, contradiction) so every point is reachable
- R-4: batch decisions (choose_batch/judge_batch) - one request for N questions
- R-10: circuit breaker + spend cap
- R-12: hash-only replay fingerprint (migration)
- R-14: fail loudly when decision tables are missing
- R-17: health_probe backend/auth -> degraded; track last success
- R-5/R-16: review-band enqueue for contradiction + verification
- R-15: decision_reviews dedup (migration)
- R-1/R-2: independent DB connection for network commands; reuse ureq agent
- R-3: daemon threshold band + decision_usage audit
- R-7: worktree diff feeds semantic secrets check
- docs: architecture, spec, review rounds 1-7
Add inferOutcome/diagnoseFailure to src/lib/ipc/commands.ts, use the IPC
constants in intelligenceStore, and regenerate the registered-but-unused
snapshot (run_kg_extraction_cmd) per the contract test's documented workflow.
@trac41799
trac41799 merged commit 782d98d into main Sep 29, 2026
8 checks passed
@trac41799
trac41799 deleted the feat/decision-hardening-r7 branch September 29, 2026 10:44
- H1: annotate blocking-network commands #[tauri::command(async)] (Tauri v2 runs
  sync commands on the main thread, so the previous sync conversion froze the UI)
- M1: independent connection for compound_knowledge / create_budget /
  run_compounder step 3 (shared lock was still held across HTTP)
- M2: migration 019 collapses pre-existing duplicates before the unique index
- M3: assert_decision_tables also verifies the input_hash column
- L1..L9: drop foot-gun AppState::default, correct stale docs + migration numbers,
  daemon band tests, cfg(test) breaker isolation, tighter hosted-URL guard,
  route intel invokes through IPC constants
- docs: review-round8.md; AGENTS.md repo rules (worktree+branch+review+merge,
  never push to main)

This branch was successfully deployed

1 active deployment
Preview — 93368f4a Deployed Sep 29, 2026 by vercel[bot]
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.

1 participant