MAS orchestration: health + remediate queries, webui fixes, scan caching - #127
Conversation
…d findings The Rust/TS/Python/Go reconcilers scan the entire project root on every call. reconcile_targets() called them once per target, so N targets produced N copies of every orphaned-file finding. With 23 targets this produced 138 findings from 6 unique orphaned files. Fix: cache reconciler results by Language inside the node loop so each reconciler runs exactly once. Collect findings once per cached run, then clear the cache before moving to the next node. Also closes blueprint drift by declaring three orphaned modules: - cairn.sse (src/sse.rs) - cairn.state (src/state) - cairn.watch (src/watch.rs) cairn lint now exits 0. cairn hook all now passes.
- scripts/dogfood.sh: runs cairn lint + cairn hook all - .git/hooks/pre-push: blocks push if dogfood gate fails - .github/workflows/dogfood.yml: same gate in CI on PR/push - docs/strongholds/next-phase-plan.md: comprehensive plan with priorities
|
Warning Review limit reached
More reviews will be available in 48 minutes and 51 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR resolves blueprint module drift by registering three orphaned Rust modules as top-level cairn declarations, introduces two new query commands ( ChangesProject Health Assessment and Infrastructure Optimization
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes The PR involves multiple independent optimizations (scanner caching, UI server caching) and a substantial new query feature (health/remediate handlers with registry, CLI wiring, and comprehensive tests), spanning 19 files with mixed implementation density. The scanner caching logic and remediate_json handler are particularly dense, requiring careful review of state aggregation and priority sorting logic. The architectural decision to close blueprint drift and the comprehensive documentation add context but low technical complexity. Possibly related PRs
Poem
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR expands Cairn’s MAS orchestration surface by adding health/remediate query tools and related docs/tests, while also attempting to improve web UI reliability via scan caching and fixing reconciler duplication behavior in the scanner.
Changes:
- Added
healthandremediatetools to the query API (registry, dispatch, snapshots, tests) and documented the recommended orchestration loop. - Introduced UI server scan caching keyed off blueprint mtime and applied minor CSS adjustments for rendering stability.
- Updated scanner reconciliation logic to cache reconciler runs by language (intended to eliminate duplicate orphan findings).
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/snapshots/wire_format_snapshots__api_meta.snap | Snapshot update to include health/remediate tools in API meta |
| src/ui/server.rs | Adds blueprint-mtime-based scan caching for UI API routes |
| src/ui_assets/style.css | Tweaks “settle” animation to avoid transform-based effects |
| src/scanner/mod.rs | Attempts to dedupe reconciler runs/findings by caching per language |
| src/query_api/registry.rs | Registers health/remediate tools and updates registry size test |
| src/query_api/mod.rs | Routes health/remediate in query execution and adds tests |
| src/query_api/handlers.rs | Implements health_json and remediate_json payloads |
| src/cli/mod.rs | Marks health/remediate as requiring --json (shared JSON path) |
| scripts/dogfood.sh | Adds a repo “dogfood” script (cairn lint + cairn hook all) |
| meta/decisions/close-blueprint-drift.md | Adds decision artefact documenting blueprint drift closure |
| examples/demo/README.md | Documents MAS orchestration usage in demo |
| docs/strongholds/next-phase-plan.md | Adds internal plan doc for hardening and webui repair |
| docs/mcp.md | Documents new MCP tools + recommended MAS loop |
| docs/integration-contract.md | Adds health/remediate to integration contract table |
| docs/commands.md | Adds CLI docs for health/remediate |
| docs/agent-prompts.md | Adds suggested prompts for health/remediate loop |
| cairn.blueprint | Declares previously orphaned modules (SSE/State/Watch) |
| .github/workflows/dogfood.yml | Adds CI workflow to run the dogfood gate |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
|
|
| // Collect findings only once per cached reconciler run, not per target. | ||
| for report in reconciler_cache.values() { | ||
| all_findings.extend(report.findings.clone()); | ||
| } | ||
| reconciler_cache.clear(); | ||
| reports.extend(node_reports); |
| let report = reconciler_cache.entry(target.language).or_insert_with(|| { | ||
| let req = ReconcileRequest { root, ignores }; | ||
| match target.language { | ||
| Language::Rust => rust_reconciler.reconcile(req).unwrap(), | ||
| Language::TypeScript => { | ||
| let reconciler = | ||
| crate::reconcile::typescript::TypeScriptReconciler::new(ast); | ||
| reconciler.reconcile(req).unwrap() | ||
| } | ||
| Language::Python => { | ||
| let reconciler = crate::reconcile::python::PythonReconciler::new(ast); | ||
| reconciler.reconcile(req).unwrap() | ||
| } | ||
| Language::Go => { | ||
| let reconciler = crate::reconcile::go::GoReconciler::new(ast); | ||
| reconciler.reconcile(req).unwrap() | ||
| } | ||
| } |
| "CAIRN_CONTRACT_MISSING" | ||
| | "CAIRN_CONTRACT_MISSING_NODE" | ||
| | "CAIRN_CONTRACT_UNKNOWN_NODE" => { | ||
| has_orphans = true; | ||
| } |
| if !should_reload && let Some(scan) = self.cached_scan.borrow().as_ref() { | ||
| return Ok(scan.clone()); | ||
| } |
| | `cairn lint` | Lint the blueprint and report findings (blocking) | | ||
|
|
||
| ### Node inspection | ||
|
|
Summary