Skip to content

Feature/v0 3 2 ci gates - #150

Open
marlon-costa-dc wants to merge 70 commits into
mainfrom
feature/v0-3-2-ci-gates
Open

Feature/v0 3 2 ci gates#150
marlon-costa-dc wants to merge 70 commits into
mainfrom
feature/v0-3-2-ci-gates

Conversation

@marlon-costa-dc

Copy link
Copy Markdown
Collaborator

No description provided.

marlonsc added 30 commits June 7, 2026 12:20
…ine-tables debug, linker opt-in) for faster local builds
…matched_files) + workflow_dispatch recovery — fixes the v0.3.0 failure mode where one failed build leg blocked the whole GitHub Release
…oss (was 100% cold), isolated ci-coverage key for tarpaulin (no thrash), cache-on-failure:true on all rust-cache jobs
…on save-if:false reusers and only matters where the cache is written (lint, test-cross, coverage), keeping warm deps across failed iterations without poisoning correctness (cargo fingerprinting handles partial caches)
… + cargo-nextest runner with cargo test fallback + sccache opt-in + install both hooks; archive broken .pre-commit-config.yaml
…test-cross/golden jobs — make test auto-detects and uses nextest for faster parallel test runs
…t for the bilingual codebase (Portuguese terms, crate names, fixtures excluded) — gate catches new typos going forward
…NTS.md; add orchestrate skill encoding the coordinator/executor + safety-doctrine loop
…rated export, not source of truth); all bead changes via bd CLI only
…d to beads (v0.3.1 milestone epic mcb-i7o4, v0.3.2 epic mcb-v5an); non-canonical task tracking replaced by bd
…lds/deploys); always monitor or pick up independent non-blocking work
…n only via pull_request — stops duplicate push+PR runs and run cascading on branches with an open PR
…step; one self-paced 5-min loop per session; lane separation + delegate via subagents per sub-bead with quality gates
…— nextest runs a process per test so the shared process-wide OnceLock context inits concurrently and fails ('shared test context init failed'); max-threads=1 restores cargo-test semantics
…rical Decision') so the ADR validator passes — superseded-by-ADR-034 status stays in the header + body
…ans) and allowlist 'flext' — unblocks the lint typos gate on PR #135 (the words came from archived legacy docs, not active source)
…st context instead of swallowing via .ok()? — golden job (cargo test THREADS=2) reported only generic 'shared test context init failed' (mcb-v5an.16); create_shared_test_context now returns Result<_,String> with the true FastEmbed/EdgeVec cause (no hidden failures)
…utes 60->90 — measured: the cold cache-seeding run hit the 60-min cap and was cancelled mid-run before rust-cache could save, creating a deadlock (perpetually cold -> always times out); 90 lets one run complete and seed the cache, after which runs finish well under it (mcb-lcia)
…(.dolt/, .beads-credential-key, .beads/proxieddb/) + opt out the intentional AGENTS.md<->CLAUDE.md doc-divergence (CLAUDE.md is a thin pointer to the AGENTS.md SSOT); reduces bd doctor 11->3 warnings (remaining: shared-server phantom-db restart + optional plugin, tracked in mcb-okxs)
…h into single shared_app_context (AGENTS.md §3.5 no-wrapper, YAGNI/SSOT) — after the Result refactor the two fns became byte-identical aliases; keep one, update real_providers callers; net -9 LOC
…al context

- Changed implementation_status to "Historical snapshot; see bd for live work" in ADRs 008, 009, 010, 012, 014, 015, 016, 017, 018, 019, 021, 022, 023, 027, 028, 031, 032, 033, 035, 038, 039, 040, 041, 042, 043, 044, 045, 047, 049, 051, and 053.
- Updated README.md to clarify that ADR status reflects historical snapshots and not current implementation states.
- Adjusted phase-9/README.md to indicate that original execution notes are historical design context.
- Revised ROADMAP.md to emphasize that current work is tracked in beads and not in the roadmap.
- Enhanced CHANGELOG.md to document changes related to the v0.3.2 release.
- Updated INTEGRATION_TESTS.md to clarify tracking of service availability reporting and conditional test groups in beads.
…te (mcb-xku4) — cargo-tarpaulin's default ptrace engine intermittently aborts with 'Test failed during run' on tokio/multi-threaded test binaries even when every test passes (observed run 27105549947: all tests green, tarpaulin still errored). Coverage is a metric, not a correctness gate; LINT/TEST_LINUX/TEST_CROSS/VALIDATE/AUDIT/GOLDEN/RELEASE_BUILD stay required. Root-cause --engine llvm fix tracked in mcb-xgji
marlonsc added 15 commits June 13, 2026 00:43
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 148 files, which is 48 over the limit of 100.

To get a review, narrow the scope:
• coderabbit review --committed # exclude uncommitted changes
• coderabbit review --dir # limit to a subdirectory
• coderabbit review --base # compare against a closer base

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 4b6a3882-4d9b-40e2-9444-e8457ed6d80e

📥 Commits

Reviewing files that changed from the base of the PR and between 507b04a and a5c3d9f.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (157)
  • .clinerules
  • .config/nextest.toml
  • .continue/rules/mcb.md
  • .gemini/styleguide.md
  • .github/actions/native-deps/action.yml
  • .github/actions/warm-fastembed/action.yml
  • .github/setup-ci.sh
  • .github/workflows/ci.yml
  • .github/workflows/release.yml
  • .gitignore
  • .markdownlintignore
  • .planning/STATE.md
  • .planning/phases/01-unblock-build-merge-pr-116/01-CONTEXT.md
  • .planning/phases/01-unblock-build-merge-pr-116/01-DISCUSSION-LOG.md
  • .pre-commit-config.yaml
  • .windsurfrules
  • AGENTS.md
  • CLAUDE.md
  • CONVENTIONS.md
  • Cargo.toml
  • Makefile
  • ONBOARDING.md
  • codex.md
  • crates/mcb-domain/src/macros/registry.rs
  • crates/mcb-domain/src/ports/mod.rs
  • crates/mcb-domain/src/ports/repositories/mod.rs
  • crates/mcb-domain/src/ports/repositories/project.rs
  • crates/mcb-infrastructure/src/config/loader.rs
  • crates/mcb-infrastructure/src/services/highlight_service.rs
  • crates/mcb-infrastructure/src/services/highlight_sync_service.rs
  • crates/mcb-infrastructure/src/services/mod.rs
  • crates/mcb-providers/src/database/seaorm/constraints.rs
  • crates/mcb-providers/src/database/seaorm/repos/project.rs
  • crates/mcb-providers/src/vcs/git.rs
  • crates/mcb-providers/src/vcs/submodule.rs
  • crates/mcb-providers/tests/project_repo.rs
  • crates/mcb-server/src/composition.rs
  • crates/mcb-server/src/handlers/search.rs
  • crates/mcb-server/src/mcp_server.rs
  • crates/mcb-server/src/tools/validation.rs
  • crates/mcb-server/src/transport/http_client.rs
  • crates/mcb-server/tests/e2e/golden_e2e_complete.rs
  • crates/mcb-server/tests/unit/mcp_server/mcp_contract_tests.rs
  • crates/mcb-server/tests/unit/tools/tool_invariant_matrix_tests.rs
  • crates/mcb-server/tests/utils/real_providers.rs
  • crates/mcb-server/tests/utils/test_fixtures.rs
  • crates/mcb-utils/src/constants/http.rs
  • crates/mcb-utils/src/utils/crypto.rs
  • crates/mcb-validate/src/ast/selector_engine.rs
  • crates/mcb-validate/src/config/file_config.rs
  • crates/mcb-validate/src/validators/kiss/mod.rs
  • crates/mcb-validate/src/validators/ssot.rs
  • crates/mcb/Cargo.toml
  • crates/mcb/src/cli/mod.rs
  • crates/mcb/src/cli/validate.rs
  • crates/mcb/src/initializers/mcp_server.rs
  • crates/mcb/src/loco_app.rs
  • crates/mcb/src/main.rs
  • crates/mcb/tests/unit/validate_test.rs
  • docs/MCP_TOOLS.md
  • docs/README.md
  • docs/adr/001-modular-crates-architecture.md
  • docs/adr/003-unified-provider-architecture.md
  • docs/adr/008-git-aware-semantic-indexing-v0.2.0.md
  • docs/adr/009-persistent-session-memory-v0.2.0.md
  • docs/adr/010-hooks-subsystem-agent-backed.md
  • docs/adr/011-http-transport-request-response-pattern.md
  • docs/adr/012-di-strategy-two-layer-approach.md
  • docs/adr/013-clean-architecture-crate-separation.md
  • docs/adr/014-multi-domain-architecture.md
  • docs/adr/015-workspace-shared-libraries.md
  • docs/adr/016-integration-points-adapter-pattern.md
  • docs/adr/017-phased-feature-integration.md
  • docs/adr/018-hybrid-caching-strategy.md
  • docs/adr/019-error-handling-strategy.md
  • docs/adr/021-dependency-management.md
  • docs/adr/022-ci-integration-strategy.md
  • docs/adr/023-inventory-to-linkme-migration.md
  • docs/adr/024-simplified-dependency-injection.md
  • docs/adr/027-architecture-evolution-v013.md
  • docs/adr/028-advanced-code-browser-v020.md
  • docs/adr/030-multi-provider-strategy.md
  • docs/adr/031-documentation-excellence.md
  • docs/adr/032-agent-quality-domain-extension.md
  • docs/adr/033-mcp-handler-consolidation.md
  • docs/adr/034-workflow-core-fsm.md
  • docs/adr/035-context-scout.md
  • docs/adr/036-enforcement-policies.md
  • docs/adr/037-workflow-orchestrator.md
  • docs/adr/038-multi-tier-execution-model.md
  • docs/adr/039-context-persistence-boundary.md
  • docs/adr/040-unified-tool-execution-gate.md
  • docs/adr/041-integrated-context-system-architecture.md
  • docs/adr/042-knowledge-graph-code-context.md
  • docs/adr/043-hybrid-search-discovery.md
  • docs/adr/044-lightweight-discovery-models.md
  • docs/adr/045-context-versioning-freshness.md
  • docs/adr/047-project-architecture.md
  • docs/adr/048-observability-strategy.md
  • docs/adr/049-axum-return-rmcp-tower-compatibility.md
  • docs/adr/050-manual-composition-root-dill-removal.md
  • docs/adr/051-seaql-loco-platform-rebuild.md
  • docs/adr/053-shared-provider-resolution.md
  • docs/adr/README.md
  • docs/adr/phase-9/README.md
  • docs/architecture/ARCHITECTURE.md
  • docs/architecture/PATTERNS.md
  • docs/archive/k8s/README.md
  • docs/archive/k8s/legacy-manifests.bak/README.md
  • docs/archive/k8s/legacy-manifests.bak/configmap.yaml
  • docs/archive/k8s/legacy-manifests.bak/deploy.sh
  • docs/archive/k8s/legacy-manifests.bak/deployment.yaml
  • docs/archive/k8s/legacy-manifests.bak/hpa.yaml
  • docs/archive/k8s/legacy-manifests.bak/ingress.yaml
  • docs/archive/k8s/legacy-manifests.bak/kustomization.yaml
  • docs/archive/k8s/legacy-manifests.bak/networkpolicy.yaml
  • docs/archive/k8s/legacy-manifests.bak/poddisruptionbudget.yaml
  • docs/archive/k8s/legacy-manifests.bak/rbac.yaml
  • docs/archive/k8s/legacy-manifests.bak/secrets.yaml
  • docs/archive/k8s/legacy-manifests.bak/service.yaml
  • docs/archive/k8s/legacy-manifests.bak/servicemonitor.yaml
  • docs/archive/operations/INTEGRATION_TEST_SKIPPING.md.bak
  • docs/archive/operations/README.md
  • docs/archive/plans/README.md
  • docs/archive/plans/legacy-v0.2-v0.3.bak/v0.2.2-OPENCODE-INTEGRATION-PLAN.md
  • docs/archive/plans/legacy-v0.2-v0.3.bak/v0.2.2-OPENCODE-MCB-MIGRATION-PLAN.md
  • docs/archive/plans/legacy-v0.2-v0.3.bak/v0.2.2-PLUGIN_ARCHITECTURE_PLAN.md
  • docs/archive/plans/legacy-v0.2-v0.3.bak/v0.2.2-ULW-REFACTOR-PLAN.md
  • docs/archive/plans/legacy-v0.2-v0.3.bak/v0.2.2-observability-strategy.md
  • docs/archive/plans/legacy-v0.2-v0.3.bak/v0.3.0-IMPLEMENTATION-PLAN.md
  • docs/beads-sql-schema.sql
  • docs/developer/BENCHMARK.md
  • docs/developer/CONTRIBUTING.md
  • docs/developer/ROADMAP.md
  • docs/modules/project-cli.md
  • docs/modules/project.md
  • docs/operations/CHANGELOG.md
  • docs/operations/CI_OPTIMIZATION.md
  • docs/operations/CI_PR_POLICIES.md
  • docs/operations/CI_RELEASE.md
  • docs/operations/CODEQL_SETUP.md
  • docs/operations/DEPLOYMENT.md
  • docs/superpowers/specs/2026-06-09-ci-fixes-and-consolidation-design.md
  • docs/testing/INTEGRATION_TESTS.md
  • k8s/README.md
  • makefiles/dispatch.mk
  • makefiles/ui.mk
  • scripts/context/validate-beads-policy.sh
  • scripts/dev-env-optimize.sh
  • scripts/docs/lib/common.sh
  • scripts/docs/py/utils.py
  • scripts/docs/validate.sh
  • scripts/hooks/pre-commit
  • scripts/hooks/pre-push
  • scripts/lib/mcb.sh
  • tests/playwright-report/index.html
  • typos.toml

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/v0-3-2-ci-gates

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

qodo-code-review Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Harden v0.3.2 CI, release, and local development gates

✨ Enhancement 🐞 Bug fix 🧪 Tests 📝 Documentation ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Accelerates CI and local checks with nextest, sccache, targeted caches, and tiered hooks.
• Makes cross-platform testing and release publication resilient to slow or failed build legs.
• Aligns runtime validation, architecture boundaries, documentation, and Beads-based coordination.
Diagram

graph TD
  DEV["Developer Hooks"] --> MAKE["Make Gates"] --> TEST["Nextest Suite"] --> CI["CI Matrix"] --> RELEASE["Release Workflow"]
  CI --> CACHE[("Build Caches")]
  CI --> DEPS["Composite Actions"]
  DEPS --> RELEASE
  subgraph Legend
    direction LR
    _step["Process"] ~~~ _db[("Cache")]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Reusable GitHub workflows
  • ➕ Can centralize complete jobs across CI and release workflows
  • ➕ Provides typed workflow inputs and explicit job-level outputs
  • ➖ Adds workflow-call indirection for setup that is currently step-oriented
  • ➖ Makes local reproduction and incremental adoption harder than composite actions
2. Single Ubuntu mega-job
  • ➕ Maximizes reuse of one target directory
  • ➕ Avoids artifact upload and download overhead
  • ➖ Reduces failure isolation and status granularity
  • ➖ Serializes otherwise independent checks and increases retry scope
3. Precompiled target artifact sharing
  • ➕ Could reduce repeated cold Ubuntu compilation
  • ➕ Preserves separate check statuses
  • ➖ Rust target artifacts are large and sensitive to flags and toolchain differences
  • ➖ Transfer overhead and cache correctness complexity may exceed recompilation savings

Recommendation: Keep the PR's composite actions, granular jobs, and purpose-specific caches. They remove duplicated setup without coupling unrelated checks; revisit artifact sharing only after measured cache-warm runs demonstrate that compilation remains the dominant bottleneck.

Files changed (149) +7288 / -2483 · 13 not counted

Enhancement (3) +368 / -2
loader.rsWarn when LOCO_ENV defaults to test +4/-1

Warn when LOCO_ENV defaults to test

• Makes the implicit test-profile fallback observable in logs.

crates/mcb-infrastructure/src/config/loader.rs

loco_app.rsAdd explicit HTTP and stdio-only serving lifecycle +76/-1

Add explicit HTTP and stdio-only serving lifecycle

• Implements signal handling, graceful shutdown, stdio-only waiting, and direct Axum listener serving.

crates/mcb/src/loco_app.rs

dev-env-optimize.shAdd multi-session process cleanup tooling +288/-0

Add multi-session process cleanup tooling

• Reports resource use and safely detects or terminates duplicate rust-analyzer, Serena, and stale Cargo processes with dry-run defaults.

scripts/dev-env-optimize.sh

Bug fix (12) +212 / -118
release.ymlMake release publication recoverable and fail-soft +36/-33

Make release publication recoverable and fail-soft

• Adds manual tag recovery, shared native setup, and release creation after partial build failures. Changelog generation targets the selected tag and missing platform artifacts no longer block publication.

.github/workflows/release.yml

git.rsAdapt Git provider to git2 0.21 APIs +4/-3

Adapt Git provider to git2 0.21 APIs

• Handles shorthand, remote URL, and tree entry names as Results and documents delta fallback mapping.

crates/mcb-providers/src/vcs/git.rs

submodule.rsImprove submodule traversal and URL errors +40/-18

Improve submodule traversal and URL errors

• Extracts depth/completion helpers and distinguishes absent submodule URLs from git2 read failures.

crates/mcb-providers/src/vcs/submodule.rs

search.rsSanitize search validation responses +2/-1

Sanitize search validation responses

• Logs detailed validation failures internally while returning a stable, non-sensitive client message.

crates/mcb-server/src/handlers/search.rs

mcp_server.rsFail fast on invalid auto-created context +55/-28

Fail fast on invalid auto-created context

• Requires valid timestamps, model IDs, and project paths during automatic session/project creation and propagates creation errors to callers.

crates/mcb-server/src/mcp_server.rs

validation.rsRequire explicit execution flow +6/-1

Require explicit execution flow

• Removes the implicit stdio execution-flow default and returns invalid-parameter errors when absent.

crates/mcb-server/src/tools/validation.rs

http_client.rsRemove unknown provenance placeholders +5/-6

Remove unknown provenance placeholders

• Only sends machine identity when discovered and stops emitting a fabricated model identifier.

crates/mcb-server/src/transport/http_client.rs

mcp_server.rsRequire configured runtime providers +20/-22

Require configured runtime providers

• Fails server initialization when embedding or vector-store provider names are missing instead of selecting null providers.

crates/mcb/src/initializers/mcp_server.rs

common.shExclude archived backup trees from docs scans +2/-0

Exclude archived backup trees from docs scans

• Skips .bak and .bkp directories during Markdown discovery.

scripts/docs/lib/common.sh

utils.pyExclude backup directories in Python docs scans +7/-1

Exclude backup directories in Python docs scans

• Prevents archived .bak and .bkp trees from entering active documentation validation.

scripts/docs/py/utils.py

validate.shSet project imports for outdated-content checks +1/-1

Set project imports for outdated-content checks

• Runs the Python checker with the repository root on PYTHONPATH.

scripts/docs/validate.sh

mcb.shReduce guard false positives without weakening checks +34/-4

Reduce guard false positives without weakening checks

• Excludes validator definitions, docs, constants, and string patterns from banned-code scans and accepts next-line suppression rationales.

scripts/lib/mcb.sh

Refactor (13) +395 / -330
registry.rsStandardize unsafe suppression justifications +8/-8

Standardize unsafe suppression justifications

• Updates registry macro comments to satisfy the guard's required Why convention.

crates/mcb-domain/src/macros/registry.rs

mod.rsExport focused project repository ports +5/-3

Export focused project repository ports

• Re-exports CRUD, phase, issue, dependency, and decision repository traits.

crates/mcb-domain/src/ports/mod.rs

mod.rsExpose split project repository interfaces +4/-1

Expose split project repository interfaces

• Publishes the new ISP-oriented project repository sub-traits.

crates/mcb-domain/src/ports/repositories/mod.rs

project.rsSplit the project repository into focused traits +39/-15

Split the project repository into focused traits

• Separates project persistence capabilities and retains ProjectRepository as a compatibility super-trait.

crates/mcb-domain/src/ports/repositories/project.rs

highlight_service.rsMake async highlighting a thin blocking adapter +20/-268

Make async highlighting a thin blocking adapter

• Moves synchronous tree-sitter state behind an injected port and delegates work through spawn_blocking.

crates/mcb-infrastructure/src/services/highlight_service.rs

highlight_sync_service.rsExtract synchronous tree-sitter highlighting +292/-0

Extract synchronous tree-sitter highlighting

• Adds a dedicated synchronous service containing mutex-protected highlighter state, language configuration, and span parsing.

crates/mcb-infrastructure/src/services/highlight_sync_service.rs

mod.rsRegister the synchronous highlight module +1/-0

Register the synchronous highlight module

• Adds the internal highlight_sync_service module.

crates/mcb-infrastructure/src/services/mod.rs

project.rsImplement focused project repository ports +21/-13

Implement focused project repository ports

• Splits the SeaORM adapter implementation across the new sub-traits and implements their aggregate super-trait.

crates/mcb-providers/src/database/seaorm/repos/project.rs

http.rsRemove unused HTTP endpoint defaults +0/-9

Remove unused HTTP endpoint defaults

• Deletes host and port constants no longer used by the Loco runtime.

crates/mcb-utils/src/constants/http.rs

mod.rsExport the unambiguous validation CLI type +1/-1

Export the unambiguous validation CLI type

• Renames the public validation argument export to ValidateCliArgs.

crates/mcb/src/cli/mod.rs

validate.rsRename validation command arguments +2/-2

Rename validation command arguments

• Renames ValidateArgs to avoid collision with similarly named validation-domain types.

crates/mcb/src/cli/validate.rs

main.rsUse the renamed validation CLI arguments +2/-2

Use the renamed validation CLI arguments

• Updates command wiring for ValidateCliArgs.

crates/mcb/src/main.rs

ui.mkRemove unused Make UI helpers +0/-8

Remove unused Make UI helpers

• Deletes unused colors and output helper macros while retaining required error handling.

makefiles/ui.mk

Tests (7) +54 / -42
project_repo.rsTest against the focused project CRUD port +1/-1

Test against the focused project CRUD port

• Imports the narrower repository interface required by project persistence tests.

crates/mcb-providers/tests/project_repo.rs

golden_e2e_complete.rsAccept both MCP validation error forms +16/-9

Accept both MCP validation error forms

• Updates empty-query assertions for returned error results and sanitized invalid-parameter messages.

crates/mcb-server/tests/e2e/golden_e2e_complete.rs

mcp_contract_tests.rsSupply execution flow in contract tests +4/-1

Supply execution flow in contract tests

• Adds explicit stdio provenance so tests continue to target the intended missing-context invariant.

crates/mcb-server/tests/unit/mcp_server/mcp_contract_tests.rs

tool_invariant_matrix_tests.rsSupply execution flow in invariant tests +10/-3

Supply execution flow in invariant tests

• Populates stdio execution flow before testing rejection of other missing provenance fields.

crates/mcb-server/tests/unit/tools/tool_invariant_matrix_tests.rs

real_providers.rsPropagate shared provider initialization failures +5/-11

Propagate shared provider initialization failures

• Uses the fallible shared context API and preserves the underlying setup error.

crates/mcb-server/tests/utils/real_providers.rs

test_fixtures.rsPreserve shared test-context initialization errors +17/-16

Preserve shared test-context initialization errors

• Stores a Result in OnceLock and reports runtime, embedding, or vector-store resolution failures verbatim.

crates/mcb-server/tests/utils/test_fixtures.rs

validate_test.rsUpdate validation CLI test imports +1/-1

Update validation CLI test imports

• Aliases the renamed ValidateCliArgs type in existing tests.

crates/mcb/tests/unit/validate_test.rs

Documentation (98) +5692 / -1734
.clinerulesPoint Cline rules to the canonical agent guide +4/-14

Point Cline rules to the canonical agent guide

• Replaces duplicated rules with a concise reference to AGENTS.md as the project SSOT.

.clinerules

mcb.mdPoint Continue rules to AGENTS.md +4/-14

Point Continue rules to AGENTS.md

• Removes duplicated conventions and identifies AGENTS.md as the authoritative rule source.

.continue/rules/mcb.md

styleguide.mdAlign Gemini review guidance with current gates +6/-5

Align Gemini review guidance with current gates

• References AGENTS.md and updates lint and validation commands to canonical Make verbs.

.gemini/styleguide.md

.windsurfrulesPoint Windsurf rules to AGENTS.md +4/-14

Point Windsurf rules to AGENTS.md

• Removes duplicated rules and makes AGENTS.md authoritative.

.windsurfrules

AGENTS.mdEstablish Beads-first governance and tiered validation +221/-14

Establish Beads-first governance and tiered validation

• Expands project rules for Beads/Dolt coordination, independent validation, scoped agent work, and evidence-based completion. Documents v0.3.2 hooks, commands, architecture, and release practices.

AGENTS.md

CLAUDE.mdAdd a concise project quick reference +68/-2

Add a concise project quick reference

• Keeps AGENTS.md authoritative while documenting common commands, crate roles, conventions, and onboarding links.

CLAUDE.md

CONVENTIONS.mdRemove duplicated Aider conventions +5/-14

Remove duplicated Aider conventions

• Replaces copied project rules with a pointer to AGENTS.md.

CONVENTIONS.md

ONBOARDING.mdAdd an end-to-end contributor onboarding guide +174/-0

Add an end-to-end contributor onboarding guide

• Documents the stack, crate architecture, request lifecycle, conventions, commands, and primary source locations.

ONBOARDING.md

codex.mdPoint Codex instructions to AGENTS.md +5/-13

Point Codex instructions to AGENTS.md

• Removes duplicated conventions and retains a thin canonical reference.

codex.md

constraints.rsDocument wildcard constraint mappings +2/-0

Document wildcard constraint mappings

• Adds required rationale comments to intentional wildcard match arms.

crates/mcb-providers/src/database/seaorm/constraints.rs

composition.rsJustify composition-root argument count +1/-1

Justify composition-root argument count

• Documents why explicit bootstrap wiring intentionally accepts many independent ports.

crates/mcb-server/src/composition.rs

crypto.rsJustify secure-erasure unsafe access +1/-1

Justify secure-erasure unsafe access

• Documents the safety rationale for zeroizing String bytes.

crates/mcb-utils/src/utils/crypto.rs

selector_engine.rsDocument unsupported grammar fallback +1/-0

Document unsupported grammar fallback

• Adds the required rationale for the intentional wildcard language match.

crates/mcb-validate/src/ast/selector_engine.rs

file_config.rsDocument validator tuple type complexity +1/-1

Document validator tuple type complexity

• Explains the justified clippy suppression on the static validator dispatch table.

crates/mcb-validate/src/config/file_config.rs

mod.rsDocument KISS violation types +1/-0

Document KISS violation types

• Adds missing public enum documentation.

crates/mcb-validate/src/validators/kiss/mod.rs

ssot.rsDocument SSOT violation types +1/-0

Document SSOT violation types

• Adds missing public enum documentation.

crates/mcb-validate/src/validators/ssot.rs

MCP_TOOLS.mdDocument v0.3.2 provenance discovery +28/-16

Document v0.3.2 provenance discovery

• Updates the version and explains automatic provenance sources, fast-fail behavior, workspace detection, and explicit overrides.

docs/MCP_TOOLS.md

README.mdRemove stale CI links and repair ADR references +1/-4

Remove stale CI links and repair ADR references

• Points superseded architecture references at active ADRs and removes deleted operations documents.

docs/README.md

001-modular-crates-architecture.mdRepair foundational ADR links +2/-2

Repair foundational ADR links

• Redirects superseded DI and event-bus references to current architecture ADRs.

docs/adr/001-modular-crates-architecture.md

003-unified-provider-architecture.mdRepair provider architecture references +2/-2

Repair provider architecture references

• Points related event and DI history at current ADR records.

docs/adr/003-unified-provider-architecture.md

008-git-aware-semantic-indexing-v0.2.0.mdMark indexing status as historical +1/-1

Mark indexing status as historical

• Directs readers to Beads for live implementation state.

docs/adr/008-git-aware-semantic-indexing-v0.2.0.md

009-persistent-session-memory-v0.2.0.mdMark memory status historical and repair links +3/-3

Mark memory status historical and repair links

• Replaces live-looking status and redirects the admin-platform reference.

docs/adr/009-persistent-session-memory-v0.2.0.md

010-hooks-subsystem-agent-backed.mdMark hooks status historical and repair links +2/-2

Mark hooks status historical and repair links

• Moves live tracking to Beads and points UI context at ADR-051.

docs/adr/010-hooks-subsystem-agent-backed.md

011-http-transport-request-response-pattern.mdRepair HTTP transport ADR linkage +1/-1

Repair HTTP transport ADR linkage

• Redirects the removed web-administration reference to ADR-051.

docs/adr/011-http-transport-request-response-pattern.md

012-di-strategy-two-layer-approach.mdMark legacy DI progress historical +2/-2

Mark legacy DI progress historical

• Moves live tracking to Beads and repairs the platform reference.

docs/adr/012-di-strategy-two-layer-approach.md

013-clean-architecture-crate-separation.mdRepair clean-architecture ADR references +1/-1

Repair clean-architecture ADR references

• Redirects the removed admin ADR link to the current platform rebuild ADR.

docs/adr/013-clean-architecture-crate-separation.md

014-multi-domain-architecture.mdConvert stale implementation checklist to history +13/-10

Convert stale implementation checklist to history

• Labels planned domain phases as historical design context rather than active tasks.

docs/adr/014-multi-domain-architecture.md

015-workspace-shared-libraries.mdMark shared-library status historical +1/-1

Mark shared-library status historical

• Directs live implementation tracking to Beads.

docs/adr/015-workspace-shared-libraries.md

016-integration-points-adapter-pattern.mdArchive adapter implementation tasks +9/-6

Archive adapter implementation tasks

• Recasts unchecked adapter items as historical notes and points active work to Beads.

docs/adr/016-integration-points-adapter-pattern.md

017-phased-feature-integration.mdMark the phased roadmap historical +4/-3

Mark the phased roadmap historical

• Clarifies that the six-phase integration plan is not the current execution queue.

docs/adr/017-phased-feature-integration.md

018-hybrid-caching-strategy.mdMark caching status historical +1/-1

Mark caching status historical

• Moves live work tracking from ADR metadata to Beads.

docs/adr/018-hybrid-caching-strategy.md

019-error-handling-strategy.mdMark error-handling status historical +1/-1

Mark error-handling status historical

• Moves live work tracking from ADR metadata to Beads.

docs/adr/019-error-handling-strategy.md

021-dependency-management.mdMark dependency-management status historical +1/-1

Mark dependency-management status historical

• Moves live work tracking from ADR metadata to Beads.

docs/adr/021-dependency-management.md

022-ci-integration-strategy.mdMark CI strategy status historical +1/-1

Mark CI strategy status historical

• Moves live work tracking from ADR metadata to Beads.

docs/adr/022-ci-integration-strategy.md

023-inventory-to-linkme-migration.mdSeparate linkme history from active tasks +7/-4

Separate linkme history from active tasks

• Recasts unchecked validation notes as historical observations and repairs the DI reference.

docs/adr/023-inventory-to-linkme-migration.md

024-simplified-dependency-injection.mdRepair superseded DI references +2/-2

Repair superseded DI references

• Redirects removed ADR-029 archive links to the current composition-root record.

docs/adr/024-simplified-dependency-injection.md

027-architecture-evolution-v013.mdMark architecture evolution status historical +1/-1

Mark architecture evolution status historical

• Moves live work tracking from ADR metadata to Beads.

docs/adr/027-architecture-evolution-v013.md

028-advanced-code-browser-v020.mdRepair code-browser platform references +4/-4

Repair code-browser platform references

• Marks status historical and redirects removed web and routing ADR links.

docs/adr/028-advanced-code-browser-v020.md

030-multi-provider-strategy.mdRepair multi-provider DI history link +1/-1

Repair multi-provider DI history link

• Redirects the removed ADR-029 archive reference.

docs/adr/030-multi-provider-strategy.md

031-documentation-excellence.mdMark documentation status historical +1/-1

Mark documentation status historical

• Moves live work tracking from ADR metadata to Beads.

docs/adr/031-documentation-excellence.md

032-agent-quality-domain-extension.mdClarify superseded workflow ownership +19/-17

Clarify superseded workflow ownership

• Explains that MCB-native workflow storage was superseded and current coordination remains in Beads.

docs/adr/032-agent-quality-domain-extension.md

033-mcp-handler-consolidation.mdMark handler consolidation status historical +1/-1

Mark handler consolidation status historical

• Moves live implementation tracking to Beads.

docs/adr/033-mcp-handler-consolidation.md

034-workflow-core-fsm.mdRepair workflow FSM architecture links +3/-3

Repair workflow FSM architecture links

• Redirects removed DI and configuration references to current ADRs.

docs/adr/034-workflow-core-fsm.md

035-context-scout.mdAlign context-scout history with Beads +14/-11

Align context-scout history with Beads

• Repairs ADR links, replaces stale planning references, and labels code sketches as historical.

docs/adr/035-context-scout.md

036-enforcement-policies.mdRepair enforcement-policy ADR links +3/-3

Repair enforcement-policy ADR links

• Redirects removed DI and configuration records to current ADRs.

docs/adr/036-enforcement-policies.md

037-workflow-orchestrator.mdRepair orchestrator ADR links +3/-3

Repair orchestrator ADR links

• Redirects removed DI and configuration records to current ADRs.

docs/adr/037-workflow-orchestrator.md

038-multi-tier-execution-model.mdArchive execution roadmap details +7/-4

Archive execution roadmap details

• Marks sizing phases as historical and repairs current architecture references.

docs/adr/038-multi-tier-execution-model.md

039-context-persistence-boundary.mdMark context persistence status historical +1/-1

Mark context persistence status historical

• Moves live implementation tracking to Beads.

docs/adr/039-context-persistence-boundary.md

040-unified-tool-execution-gate.mdMark execution-gate status historical +1/-1

Mark execution-gate status historical

• Moves live implementation tracking to Beads.

docs/adr/040-unified-tool-execution-gate.md

041-integrated-context-system-architecture.mdMark context-system status historical +1/-1

Mark context-system status historical

• Moves live implementation tracking to Beads.

docs/adr/041-integrated-context-system-architecture.md

042-knowledge-graph-code-context.mdMark knowledge-graph status historical +1/-1

Mark knowledge-graph status historical

• Moves live implementation tracking to Beads.

docs/adr/042-knowledge-graph-code-context.md

043-hybrid-search-discovery.mdMark hybrid-search status historical +1/-1

Mark hybrid-search status historical

• Moves live implementation tracking to Beads.

docs/adr/043-hybrid-search-discovery.md

044-lightweight-discovery-models.mdMark discovery-model status historical +1/-1

Mark discovery-model status historical

• Moves live implementation tracking to Beads.

docs/adr/044-lightweight-discovery-models.md

045-context-versioning-freshness.mdMark context-version status historical +1/-1

Mark context-version status historical

• Moves live implementation tracking to Beads.

docs/adr/045-context-versioning-freshness.md

047-project-architecture.mdAlign project architecture with Beads tracking +2/-2

Align project architecture with Beads tracking

• Marks implementation state historical and replaces a removed planning reference.

docs/adr/047-project-architecture.md

048-observability-strategy.mdMake the observability ADR canonical +3/-1

Make the observability ADR canonical

• Removes dependency on a retired planning artifact and assigns follow-up tracking to Beads.

docs/adr/048-observability-strategy.md

049-axum-return-rmcp-tower-compatibility.mdRepair Axum migration history links +4/-4

Repair Axum migration history links

• Marks progress historical and removes links to the deleted routing ADR copy.

docs/adr/049-axum-return-rmcp-tower-compatibility.md

050-manual-composition-root-dill-removal.mdRepair composition-root history links +2/-2

Repair composition-root history links

• Redirects removed ADR-029 archive references.

docs/adr/050-manual-composition-root-dill-removal.md

051-seaql-loco-platform-rebuild.mdMark the platform rebuild complete +5/-2

Mark the platform rebuild complete

• Records completion and labels the migration sequence as historical context.

docs/adr/051-seaql-loco-platform-rebuild.md

053-shared-provider-resolution.mdMark shared provider resolution complete +1/-1

Mark shared provider resolution complete

• Updates ADR implementation status to complete.

docs/adr/053-shared-provider-resolution.md

README.mdSeparate ADR history from live project state +15/-6

Separate ADR history from live project state

• Updates ADR counts and clarifies that release alignment and implementation metadata are historical while Beads is authoritative.

docs/adr/README.md

README.mdReplace stale Phase 9 checklist with Beads tracking +12/-33

Replace stale Phase 9 checklist with Beads tracking

• Converts the dated roadmap into historical context and provides the current Beads query.

docs/adr/phase-9/README.md

ARCHITECTURE.mdRepair architecture ADR references +3/-3

Repair architecture ADR references

• Redirects removed admin, configuration, and routing ADR links.

docs/architecture/ARCHITECTURE.md

PATTERNS.mdRepair configuration pattern references +1/-1

Repair configuration pattern references

• Points the superseded configuration link to ADR-051.

docs/architecture/PATTERNS.md

README.mdDocument archived Kubernetes artifacts +13/-0

Document archived Kubernetes artifacts

• Explains why legacy manifests are inactive and must not be deployed.

docs/archive/k8s/README.md

README.mdArchive the legacy Kubernetes guide +226/-0

Archive the legacy Kubernetes guide

• Preserves the previous deployment instructions as explicitly inactive historical material.

docs/archive/k8s/legacy-manifests.bak/README.md

configmap.yamlArchive the legacy Kubernetes ConfigMap not counted

Archive the legacy Kubernetes ConfigMap

• Moves the inactive configuration manifest into the documentation archive.

docs/archive/k8s/legacy-manifests.bak/configmap.yaml

deploy.shArchive the imperative Kubernetes deploy script not counted

Archive the imperative Kubernetes deploy script

• Moves the prohibited legacy deployment path out of the active manifest tree.

docs/archive/k8s/legacy-manifests.bak/deploy.sh

deployment.yamlArchive the legacy Kubernetes Deployment not counted

Archive the legacy Kubernetes Deployment

• Preserves the stale application deployment manifest for historical reference only.

docs/archive/k8s/legacy-manifests.bak/deployment.yaml

hpa.yamlArchive the legacy autoscaler manifest not counted

Archive the legacy autoscaler manifest

• Preserves the inactive HPA outside the active Kubernetes tree.

docs/archive/k8s/legacy-manifests.bak/hpa.yaml

ingress.yamlArchive the legacy ingress manifest not counted

Archive the legacy ingress manifest

• Preserves the inactive ingress configuration for historical reference.

docs/archive/k8s/legacy-manifests.bak/ingress.yaml

kustomization.yamlArchive the legacy Kustomize definition not counted

Archive the legacy Kustomize definition

• Moves stale manifest composition out of the active deployment path.

docs/archive/k8s/legacy-manifests.bak/kustomization.yaml

networkpolicy.yamlArchive the legacy network policy not counted

Archive the legacy network policy

• Preserves the inactive Kubernetes network policy as historical material.

docs/archive/k8s/legacy-manifests.bak/networkpolicy.yaml

poddisruptionbudget.yamlArchive the legacy disruption budget not counted

Archive the legacy disruption budget

• Preserves the inactive availability policy outside the active manifest tree.

docs/archive/k8s/legacy-manifests.bak/poddisruptionbudget.yaml

rbac.yamlArchive the legacy RBAC manifest not counted

Archive the legacy RBAC manifest

• Preserves the inactive access-control configuration for historical reference.

docs/archive/k8s/legacy-manifests.bak/rbac.yaml

secrets.yamlArchive the unsafe legacy secrets manifest not counted

Archive the unsafe legacy secrets manifest

• Removes placeholder secret guidance from the active deployment path.

docs/archive/k8s/legacy-manifests.bak/secrets.yaml

service.yamlArchive the legacy Kubernetes Service not counted

Archive the legacy Kubernetes Service

• Preserves the inactive service manifest outside the active tree.

docs/archive/k8s/legacy-manifests.bak/service.yaml

servicemonitor.yamlArchive the legacy ServiceMonitor not counted

Archive the legacy ServiceMonitor

• Preserves the stale metrics integration for historical reference only.

docs/archive/k8s/legacy-manifests.bak/servicemonitor.yaml

INTEGRATION_TEST_SKIPPING.md.bakArchive obsolete integration-skip guidance not counted

Archive obsolete integration-skip guidance

• Moves outdated helper and skip-policy documentation out of the active operations tree.

docs/archive/operations/INTEGRATION_TEST_SKIPPING.md.bak

README.mdIndex archived operations documentation +12/-0

Index archived operations documentation

• Identifies canonical operational sources and explains the archived integration-test page.

docs/archive/operations/README.md

README.mdIndex retired implementation plans +22/-0

Index retired implementation plans

• Separates historical plans from Beads-managed current work and executable project sources.

docs/archive/plans/README.md

v0.2.2-OPENCODE-INTEGRATION-PLAN.mdArchive the OpenCode integration plan +308/-0

Archive the OpenCode integration plan

• Preserves the retired v0.2.2 integration design as historical context.

docs/archive/plans/legacy-v0.2-v0.3.bak/v0.2.2-OPENCODE-INTEGRATION-PLAN.md

v0.2.2-OPENCODE-MCB-MIGRATION-PLAN.mdArchive the OpenCode migration plan +814/-0

Archive the OpenCode migration plan

• Preserves the retired component migration inventory outside active planning.

docs/archive/plans/legacy-v0.2-v0.3.bak/v0.2.2-OPENCODE-MCB-MIGRATION-PLAN.md

v0.2.2-PLUGIN_ARCHITECTURE_PLAN.mdArchive the legacy plugin architecture plan +783/-0

Archive the legacy plugin architecture plan

• Preserves the historical inventory-era design without presenting it as current architecture.

docs/archive/plans/legacy-v0.2-v0.3.bak/v0.2.2-PLUGIN_ARCHITECTURE_PLAN.md

v0.2.2-ULW-REFACTOR-PLAN.mdArchive the legacy refactor plan +392/-0

Archive the legacy refactor plan

• Preserves the retired code-reduction roadmap outside the active work queue.

docs/archive/plans/legacy-v0.2-v0.3.bak/v0.2.2-ULW-REFACTOR-PLAN.md

v0.2.2-observability-strategy.mdArchive the observability implementation plan +80/-0

Archive the observability implementation plan

• Preserves the superseded plan while ADR-048 remains canonical.

docs/archive/plans/legacy-v0.2-v0.3.bak/v0.2.2-observability-strategy.md

v0.3.0-IMPLEMENTATION-PLAN.mdArchive the v0.3.0 implementation plan +1708/-0

Archive the v0.3.0 implementation plan

• Preserves the retired workflow roadmap outside current Beads planning.

docs/archive/plans/legacy-v0.2-v0.3.bak/v0.3.0-IMPLEMENTATION-PLAN.md

beads-sql-schema.sqlLabel the Beads SQLite schema as legacy +2/-1

Label the Beads SQLite schema as legacy

• Clarifies that current coordination uses the Dolt shared-server backend.

docs/beads-sql-schema.sql

BENCHMARK.mdDocument build and CI optimization measurements +106/-0

Document build and CI optimization measurements

• Records sccache, job-count, process-cleanup, and CI cache performance evidence and recommendations.

docs/developer/BENCHMARK.md

CONTRIBUTING.mdRemove stale contributor links +1/-2

Remove stale contributor links

• Repairs the configuration ADR reference and removes the deleted CI release guide.

docs/developer/CONTRIBUTING.md

ROADMAP.mdAdd the v0.3.2 release lane and Beads tracking +41/-27

Add the v0.3.2 release lane and Beads tracking

• Updates release status and replaces duplicated metrics and backlogs with authoritative Beads queries.

docs/developer/ROADMAP.md

project-cli.mdDocument Dolt-based Beads operations +18/-17

Document Dolt-based Beads operations

• Replaces SQLite/JSONL sync guidance with shared-server configuration, Dolt remotes, and backups.

docs/modules/project-cli.md

project.mdAlign project documentation with current Beads storage +75/-93

Align project documentation with current Beads storage

• Distinguishes internal project-domain history from operational Dolt coordination and replaces legacy sync and recovery instructions.

docs/modules/project.md

CHANGELOG.mdAdd v0.3.2 release notes +18/-0

Add v0.3.2 release notes

• Summarizes release recovery, CI caches, nextest, typos, and documentation governance changes.

docs/operations/CHANGELOG.md

DEPLOYMENT.mdReplace speculative deployment guidance with current operations +76/-692

Replace speculative deployment guidance with current operations

• Documents supported runtime modes, YAML profiles, Make-based validation, user installation, MCP configuration, and GitOps policy.

docs/operations/DEPLOYMENT.md

2026-06-09-ci-fixes-and-consolidation-design.mdRecord CI timeout and consolidation design +207/-0

Record CI timeout and consolidation design

• Documents measured Windows and coverage failures, considered compilation-sharing designs, trade-offs, and validation criteria.

docs/superpowers/specs/2026-06-09-ci-fixes-and-consolidation-design.md

INTEGRATION_TESTS.mdRewrite integration testing around current helpers +81/-416

Rewrite integration testing around current helpers

• Documents canonical service detection, skip macros, Docker Make verbs, CI behavior, and Beads-tracked follow-ups.

docs/testing/INTEGRATION_TESTS.md

README.mdRetire stale active Kubernetes manifests +15/-218

Retire stale active Kubernetes manifests

• States that no active manifests remain, explains archival reasons, and directs rebuild work to current sources and Beads.

k8s/README.md

Other (16) +567 / -257
nextest.tomlSerialize shared-context server tests under nextest +23/-0

Serialize shared-context server tests under nextest

• Adds a nextest test group for mcb-server integration tests and retries residual cold FastEmbed failures.

.config/nextest.toml

action.ymlCentralize cross-platform native dependency setup +53/-0

Centralize cross-platform native dependency setup

• Adds a composite action for protoc an

[Comment truncated to fit github's 65,536-char limit.]

@qodo-code-review

qodo-code-review Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (10) 📘 Rule violations (8) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 36 rules

Grey Divider


Action required

1. Conflicting package duplicated in lockfile 📘 Rule violation ✧ Quality ⭐ New
Description
The added protoc-bin-vendored 3.2.0 records duplicate existing package identities, including a
conflicting protoc-bin-vendored-macos-aarch_64 record with a different checksum and unrelated
dependencies copied from prost-build. This lockfile corruption may cause Cargo to reject or fail
to verify the lockfile, blocking locked builds, Clippy, tests, and CI.
Code

Cargo.lock[R5337-5341]

+[[package]]
+name = "protoc-bin-vendored-macos-aarch_64"
+version = "3.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "343d3bd7056eda839b03204e68deff7d1b13aba7af2b2fd16890697274262ee7"
Relevance

⭐⭐⭐ High

PRs #103 and #105 accepted fixes for CI blockers and checksum integrity.

PR-#103
PR-#105
PR-#158

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 1208599 requires Cargo build and Clippy commands to complete successfully. The existing
protoc-bin-vendored 3.2.0 record at Cargo.lock[5291-5305] is repeated at Cargo.lock[5370-5384],
and the Linux records at Cargo.lock[5307-5335] are repeated at Cargo.lock[5386-5415]; moreover, the
inserted macOS ARM record at Cargo.lock[5337-5356] conflicts with the existing record at
Cargo.lock[5416-5420], including a different checksum (343d... versus 8927...), while its
checksum and dependency structure match prost-build at Cargo.lock[5248-5267], confirming that the
lockfile is corrupted.

Rule 1208599: No compiler warnings or clippy lint failures
Cargo.lock[5337-5356]
Cargo.lock[5416-5420]
Cargo.lock[5248-5267]
Cargo.lock[5291-5335]
Cargo.lock[5337-5415]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description

`Cargo.lock` contains duplicated `protoc-bin-vendored` 3.2.0 package identities and a corrupted `protoc-bin-vendored-macos-aarch_64` record with a conflicting checksum and unrelated dependencies. This can cause Cargo to reject or fail to validate the committed lockfile.

## Issue Context

The added block repeats existing `protoc-bin-vendored` platform records, while the macOS ARM entry contains checksum and dependency data that do not belong to that platform-binary package. Regenerate the lockfile from the workspace manifests rather than manually retaining or editing the duplicated block, then verify the result with locked Cargo build, Clippy, and test commands.

## Fix Focus Areas

- Cargo.lock[5337-5415]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Windows jobs clone twice 🐞 Bug ☼ Reliability
Description
The Windows test-cross and release-build legs run actions/checkout and then clone into the
already populated workspace. git clone ... . therefore fails before either job reaches tests or
compilation.
Code

.github/workflows/ci.yml[334]

+          git clone --depth 1 https://github.com/${{ github.repository }}.git .
Evidence
The first job checks out the repository at lines 320-323 before cloning into . at line 334; the
release job repeats the same sequence at lines 530-545.

.github/workflows/ci.yml[320-336]
.github/workflows/ci.yml[530-546]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Windows CI jobs clone into a workspace already populated by `actions/checkout`, causing deterministic failures.

## Issue Context
Both `test-cross` and `release-build` contain the duplicated checkout sequence. Preserve the existing checkout and use the native dependency action where dependencies are needed.

## Fix Focus Areas
- .github/workflows/ci.yml[320-338]
- .github/workflows/ci.yml[530-548]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Stdio completion cannot exit 🐞 Bug ☼ Reliability
Description
Stdio-only serving now waits exclusively for Ctrl+C or SIGTERM, while the stdio transport runs in a
detached task whose completion is ignored. When that transport shuts down, the main process remains
alive waiting for an unrelated OS signal.
Code

crates/mcb/src/loco_app.rs[170]

+            wait_for_shutdown_signal().await;
Evidence
The stdio-only branch can return only after wait_for_shutdown_signal, but spawn_stdio_server
drops its task handle and does not notify that wait when serve_stdio reaches its documented
shutdown completion.

crates/mcb/src/loco_app.rs[151-173]
crates/mcb/src/initializers/mcp_server.rs[325-353]
crates/mcb-server/src/transport/stdio.rs[34-53]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Completion of the stdio transport does not terminate stdio-only serving, leaving the process running.

## Issue Context
The initializer drops the stdio task handle. Introduce a shared shutdown notification or retain and await the handle alongside OS signals, while preserving hybrid HTTP behavior.

## Fix Focus Areas
- crates/mcb/src/loco_app.rs[151-173]
- crates/mcb/src/initializers/mcp_server.rs[325-353]
- crates/mcb-server/src/transport/stdio.rs[34-53]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (6)
4. Manual release builds wrong revision 🐞 Bug ≡ Correctness
Description
The new manual release path accepts an arbitrary existing tag, but release-build checks out the
dispatch ref rather than that tag. It can consequently publish binaries built from a branch revision
under the requested tag.
Code

.github/workflows/release.yml[20]

+  # Recovery path: manually (re)publish a GitHub Release for an existing tag without
Evidence
The workflow defines a tag input, while the release-build checkout has no ref; later steps
explicitly use the input tag as the release tag and attach the produced artifacts to it.

.github/workflows/release.yml[20-27]
.github/workflows/release.yml[64-77]
.github/workflows/release.yml[132-191]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Manual release artifacts are built from the workflow dispatch ref instead of the requested release tag.

## Issue Context
The input tag controls release naming and publication, but the build checkout has no matching `ref`. Ensure all tag-specific build and documentation jobs operate on the validated input tag.

## Fix Focus Areas
- .github/workflows/release.yml[20-27]
- .github/workflows/release.yml[64-67]
- .github/workflows/release.yml[132-191]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Release target ignored 🐞 Bug ≡ Correctness
Description
The release workflows install matrix.target but build via make build RELEASE=1, which runs
cargo build --release without --target, so the produced binary is for the runner’s host target
while being packaged/named as matrix.target. This can publish mislabeled or incorrect-architecture
release artifacts (and effectively skips building the intended non-host target).
Code

.github/workflows/release.yml[R76-77]

+      - name: Build
        run: make build RELEASE=1
Evidence
The workflow installs the target but builds via Makefile; the Makefile’s DISPATCH_BUILD uses
cargo build --release without any --target, so the matrix target is unused by the build command
and the copied artifact path (target/release/...) is host-target output.

.github/workflows/release.yml[71-78]
makefiles/dispatch.mk[59-63]
.github/workflows/ci.yml[563-585]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`.github/workflows/release.yml` (and similarly `ci.yml`’s release-build job) sets `targets: ${{ matrix.target }}` and names artifacts by that target, but the build command is `make build RELEASE=1`. The Makefile’s build dispatcher runs `cargo build --release` without `--target`, which means Cargo builds for the host triple, not the matrix target.

### Issue Context
- Workflow expects per-matrix target artifacts (e.g. `x86_64-apple-darwin`).
- Current Makefile build target does not accept or forward a target.

### Fix Focus Areas
- .github/workflows/release.yml[71-99]
- makefiles/dispatch.mk[59-63]
- .github/workflows/ci.yml[563-585]

### Suggested fix
Choose one:
1) **Workflow-level**: replace `make build RELEASE=1` with `cargo build --release --target "${{ matrix.target }}"` and copy from `target/${{ matrix.target }}/release/...`.
2) **Makefile-level**: add a `TARGET` variable and have `DISPATCH_BUILD` do `cargo build --release --target "$(TARGET)"` when `TARGET` is set; then pass `TARGET=${{ matrix.target }}` from the workflow(s) and adjust copy paths accordingly.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. Doctest hits private module 🐞 Bug ≡ Correctness
Description
highlight_sync_service.rs includes a doctest that imports
mcb_infrastructure::services::highlight_sync_service::HighlightSyncPort, but the module is
declared private (mod highlight_sync_service;). Doctests compile as an external crate, so `cargo
test --doc` will fail to compile this example.
Code

crates/mcb-infrastructure/src/services/highlight_sync_service.rs[R42-46]

+/// ```
+/// use mcb_infrastructure::services::highlight_sync_service::HighlightSyncPort;
+/// fn example(port: &dyn HighlightSyncPort) {
+///     let _ = port.highlight("fn main() {}", "rust");
+/// }
Evidence
The doctest references mcb_infrastructure::services::highlight_sync_service::..., but the module
is not publicly exported from services (mod, not pub mod), making that path inaccessible to
doctest compilation.

crates/mcb-infrastructure/src/services/highlight_sync_service.rs[39-47]
crates/mcb-infrastructure/src/services/mod.rs[19-23]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The doctest in `highlight_sync_service.rs` imports a private module path (`services::highlight_sync_service`), but `services/mod.rs` declares it as a private module. Rust doctests are compiled as an external consumer, so private module paths are not accessible.

### Issue Context
This will break `cargo test --doc` / any CI gate running doctests.

### Fix Focus Areas
- crates/mcb-infrastructure/src/services/highlight_sync_service.rs[39-51]
- crates/mcb-infrastructure/src/services/mod.rs[19-23]

### Suggested fix
Pick one:
1) Make the module public: change `mod highlight_sync_service;` to `pub mod highlight_sync_service;` (or re-export specific items via `pub use highlight_sync_service::HighlightSyncPort;`).
2) If you *don’t* want it public, change the doctest block to ` ```ignore ` (or remove the external-path import and describe usage without compiling code).

Ensure doctests pass after the change.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. Auto-create blocks tool calls 🐞 Bug ☼ Reliability
Description
McpServer::handle_request now propagates errors from auto_create_session_and_project, and
auto_create_session returns an error on any DB insert failure; if the session id already exists
(e.g., persisted client session id after a server restart), the first tool call can fail and the
DashSet guard prevents retrying creation.
Code

crates/mcb-server/src/mcp_server.rs[R419-426]

+    services
+        .agent_session
+        .create_session(session)
+        .await
+        .map_err(|e| {
+            tracing::warn!("Auto-session creation failed (non-fatal): {e}");
+            McpError::internal_error(format!("Auto-session creation failed: {e}"), None)
+        })?;
Evidence
The server now awaits auto_create_session_and_project with ?, so any error aborts the tool
request. Session creation is a non-idempotent insert, and the HTTP client can persist/reuse a
session id across runs, making duplicates likely after restarts; init_sessions.insert() happens
before the insert and failures are propagated.

crates/mcb-server/src/mcp_server.rs[270-283]
crates/mcb-server/src/mcp_server.rs[371-426]
crates/mcb-providers/src/database/seaorm/repos/agent.rs[99-107]
crates/mcb-providers/src/database/seaorm/repos/common.rs[95-103]
crates/mcb-server/src/transport/http_client.rs[105-134]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`auto_create_session_and_project(...).await?` makes tool execution fail when auto-session/project creation fails. `auto_create_session` also inserts the session id into `init_sessions` **before** attempting DB creation; if the DB insert fails (including due to duplicate key), the tool call fails and the process will not retry creating that session.

### Issue Context
- The SeaORM `create_session` path uses a plain insert (`sea_repo_insert!`) which is not idempotent.
- The HTTP bridge can persist a session id via a session file; that makes duplicate session ids plausible across server restarts.

### Fix Focus Areas
- crates/mcb-server/src/mcp_server.rs[270-280]
- crates/mcb-server/src/mcp_server.rs[371-428]
- crates/mcb-providers/src/database/seaorm/repos/agent.rs[99-107]
- crates/mcb-providers/src/database/seaorm/repos/common.rs[95-103]
- crates/mcb-server/src/transport/http_client.rs[105-134]

### Suggested fix
- Do not propagate auto-create DB failures to tool callers: catch DB errors and log them, returning `Ok(())` from `auto_create_*`.
- Make session auto-create idempotent:
 - Check `get_session(session_id)` first, or
 - Treat unique-constraint violations as success, or
 - Remove the id from `init_sessions` on failure so a later request can retry.
- If keeping error propagation for validation failures, split error handling: only propagate deterministic input validation errors, not repository/DB errors.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


8. setup-ci requires cargo pre-Rust 🐞 Bug ☼ Reliability
Description
The CI setup now assumes sccache is available by installing it via cargo in
.github/setup-ci.sh and by exporting RUSTC_WRAPPER=sccache in the Makefile, but several
release/publish workflows run the native-deps/setup step before the Rust toolchain is installed and
the Makefile’s best-effort install can be ignored. If cargo is not present or the install fails,
subsequent builds/releases can abort with cargo: command not found or because the sccache
wrapper binary cannot be executed.
Code

.github/setup-ci.sh[R148-152]

+# Ensure sccache is available (mandatory compilation cache)
+if ! command -v sccache &>/dev/null; then
+	echo "Installing sccache (mandatory compilation cache)..." >&2
+	_mcb_install_crate sccache
+fi
Evidence
The native-deps composite action runs bash .github/setup-ci.sh ... on Unix, and setup-ci.sh
attempts to install sccache using cargo (via cargo binstall/install) when it isn’t already
present; however, in .github/workflows/release.yml the native-deps step appears before
dtolnay/rust-toolchain in multiple jobs, meaning cargo may not exist at the time setup-ci.sh
runs and the job can fail early. Separately, the Makefile configures Cargo to always use sccache
via RUSTC_WRAPPER, while its installation attempt is best-effort and failure is ignored, so if
sccache is missing (or cargo is unavailable) later cargo invocations will still try to execute
the wrapper and fail.

.github/setup-ci.sh[136-152]
.github/actions/native-deps/action.yml[16-19]
.github/workflows/release.yml[64-77]
.github/workflows/release.yml[260-265]
Makefile[35-44]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
CI/release/publish and local builds can fail because `sccache` is treated as mandatory in two places: `.github/setup-ci.sh` installs it using `cargo` when missing, but some workflows call the script before installing the Rust toolchain (so `cargo` may not exist), and the Makefile exports `RUSTC_WRAPPER=sccache` unconditionally while only best-effort attempting to install `sccache`, leaving Cargo configured to use a missing wrapper.

## Issue Context
- `native-deps` composite action runs `bash .github/setup-ci.sh ...` on Unix.
- `.github/setup-ci.sh` installs `sccache` via `_mcb_install_crate` / `cargo binstall/install` if it isn’t present.
- In `release.yml`, `native-deps` runs before `dtolnay/rust-toolchain` in `release-build`, and also in `publish-crates` when a registry token exists, so `cargo` may be unavailable when `setup-ci.sh` runs.
- The Makefile sets `RUSTC_WRAPPER := sccache` globally, and the installation attempt happens at Makefile parse-time with errors suppressed (`|| true`), so even if installation fails (or `cargo` is missing) subsequent `cargo` builds still attempt to invoke `sccache` and fail.

## Fix Focus Areas
- .github/setup-ci.sh[136-152]
- .github/workflows/release.yml[64-77]
- .github/workflows/release.yml[260-265]
- .github/actions/native-deps/action.yml[16-19]
- Makefile[35-44]

## Suggested fix
- Reorder `release.yml` steps so `dtolnay/rust-toolchain` runs before `./.github/actions/native-deps` (preferred), and/or
- Update `setup-ci.sh` to only attempt cargo-based installation when `cargo` exists (otherwise skip with a clear message or fail with instructions to install Rust first), and/or
- Install `sccache` via `mozilla-actions/sccache-action` in release/publish jobs before calling `native-deps`.
- In the Makefile, only export `RUSTC_WRAPPER` when `command -v sccache` succeeds, and consider moving installation to an explicit setup target (or making it opt-in via `SCCACHE=1`) so failures are explicit and there is a clean fallback when `sccache` is unavailable.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


9. erase_string uses unsafe block 📘 Rule violation ⛨ Security
Description
SecureErasure::erase_string contains an unsafe block (and explicitly allows unsafe_code),
which violates the project requirement to avoid unsafe Rust in production code. This can reintroduce
memory-safety risk and bypasses the intended unsafe_code denial policy.
Code

crates/mcb-utils/src/utils/crypto.rs[57]

+    #[allow(unsafe_code)] // Why: zeroizing String bytes requires unsafe as_mut_bytes(); exclusive access guarantees safety.
Evidence
PR Compliance ID 1208417 forbids unsafe usage in Rust production code. The updated erase_string
area includes #[allow(unsafe_code)] and an unsafe { ... } block in the same function.

Rule 1208417: No unsafe code blocks
crates/mcb-utils/src/utils/crypto.rs[57-66]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`SecureErasure::erase_string` currently uses an `unsafe` block (and `#[allow(unsafe_code)]`), which violates the repo policy forbidding unsafe Rust in non-test code.

## Issue Context
The PR modifies the `#[allow(unsafe_code)]` line for `erase_string`, but the function still performs unsafe byte access on a `String`.

## Fix Focus Areas
- crates/mcb-utils/src/utils/crypto.rs[57-66]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

10. HighlightError bypasses constructors 📘 Rule violation ≡ Correctness
Description
The new highlighting implementation directly constructs the thiserror enum variant
HighlightError::HighlightingFailed. Domain errors must be created through constructor methods so
their formatting and creation remain centralized.
Code

crates/mcb-infrastructure/src/services/highlight_sync_service.rs[R86-89]

+        let mut state = self
+            .state
+            .lock()
+            .map_err(|e| HighlightError::HighlightingFailed(format!("Lock poisoned: {e}")))?;
Evidence
PR Compliance ID 1208313 prohibits manually constructing thiserror enum variants. The added code
maps a poisoned lock directly to HighlightError::HighlightingFailed(...), and the same new module
contains additional direct constructions of ConfigurationError, UnsupportedLanguage, and
HighlightingFailed.

Rule 1208313: Use thiserror constructors for error creation
crates/mcb-infrastructure/src/services/highlight_sync_service.rs[86-89]
crates/mcb-domain/src/ports/services/browse.rs[27-40]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new infrastructure implementation directly instantiates `HighlightError` variants instead of using domain-provided constructor methods.

## Issue Context
Add appropriate constructor methods alongside the domain error definition if they do not exist, then replace all direct `HighlightError` variant construction in the new highlighting implementation.

## Fix Focus Areas
- crates/mcb-infrastructure/src/services/highlight_sync_service.rs[86-136]
- crates/mcb-infrastructure/src/services/highlight_sync_service.rs[235-279]
- crates/mcb-domain/src/ports/services/browse.rs[27-40]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


11. Optimizer kills unrelated analyzers 🐞 Bug ☼ Reliability
Description
Despite describing KEEP_RA as a per-project limit, the optimizer collects every matching
rust-analyzer process and retains only one globally. Running it with --apply can terminate active
analyzers serving unrelated repositories.
Code

scripts/dev-env-optimize.sh[110]

+    pids=$(pgrep -a -f 'rust.analyzer|rust-analyzer' 2>/dev/null | grep -v 'grep' | awk '{print $1}' || true)
Evidence
The configuration labels the limit per project, but process selection uses an unrestricted `pgrep
-f` list and the subsequent loop kills every PID after a single global keep count.

scripts/dev-env-optimize.sh[18-20]
scripts/dev-env-optimize.sh[107-150]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The destructive optimizer applies its rust-analyzer retention limit globally rather than per project.

## Issue Context
Group processes by a verified workspace or working directory before applying limits. Do not terminate a process unless its project ownership can be established safely.

## Fix Focus Areas
- scripts/dev-env-optimize.sh[18-20]
- scripts/dev-env-optimize.sh[107-150]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


12. Setup overwrites Beads hooks 🐞 Bug ≡ Correctness
Description
The setup target directly replaces .git/hooks/pre-commit and pre-push, but only the replacement
pre-push delegates to Beads. Running setup after bd hooks install --chain therefore removes the
required Beads pre-commit integration and can leave hook policy noncompliant.
Code

makefiles/dispatch.mk[305]

+  hooks)     cp scripts/hooks/pre-commit scripts/hooks/pre-push .git/hooks/; chmod +x .git/hooks/pre-commit .git/hooks/pre-push; echo "✓ pre-commit + pre-push hooks installed" ;; \
Evidence
The setup recipe copies over both hook entry points. The new pre-commit script only runs the Make
gate, whereas pre-push explicitly delegates to bd; repository policy requires chained Beads hooks
and validates that they remain installed and current.

makefiles/dispatch.mk[303-308]
scripts/hooks/pre-commit[1-7]
scripts/hooks/pre-push[1-10]
AGENTS.md[361-367]
scripts/context/validate-beads-policy.sh[22-45]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Project hook installation overwrites chained Beads hooks and drops Beads pre-commit execution.

## Issue Context
Make hook setup idempotently preserve or install the Beads chain for both hooks. Avoid plain copies over already installed hook entry points.

## Fix Focus Areas
- makefiles/dispatch.mk[303-308]
- scripts/hooks/pre-commit[1-7]
- scripts/hooks/pre-push[1-10]
- scripts/context/validate-beads-policy.sh[22-45]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (6)
13. Highlight imports are misordered 📘 Rule violation ⚙ Maintainability
Description
The new module places mcb_domain imports before external crates and then repeats the mcb_domain
group. Rust imports must be grouped as std, external crates, mcb_*, then local modules.
Code

crates/mcb-infrastructure/src/services/highlight_sync_service.rs[R9-14]

+use mcb_domain::ports::HighlightError;
+use mcb_domain::value_objects::browse::{HighlightSpan, HighlightedCode};
+use tree_sitter::Language;
+use tree_sitter_highlight::{Highlight, HighlightConfiguration, HighlightEvent, Highlighter};
+
+use mcb_domain::value_objects::browse::{HIGHLIGHT_NAMES, map_highlight_to_category};
Evidence
PR Compliance ID 1207880 requires imports to be ordered as standard library, external crates,
mcb_* crates, and local modules. The added lines put mcb_domain before tree_sitter and
introduce another mcb_domain import afterward.

Rule 1207880: Enforce grouped and ordered Rust imports: std, external crates, mcb_*, then local modules
crates/mcb-infrastructure/src/services/highlight_sync_service.rs[7-14]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The imports in `highlight_sync_service.rs` do not follow the required Rust import group order.

## Issue Context
External `tree_sitter` imports must precede all `mcb_*` imports, and the two `mcb_domain` blocks should be contiguous.

## Fix Focus Areas
- crates/mcb-infrastructure/src/services/highlight_sync_service.rs[7-14]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


14. Misordered imports in loco_app.rs 📘 Rule violation ⚙ Maintainability
Description
crates/mcb/src/loco_app.rs mixes std imports after external and mcb_* imports, violating the
required grouped import ordering. This reduces consistency and can cause style/lint gate failures.
Code

crates/mcb/src/loco_app.rs[R8-18]

use axum::Router as AxumRouter;
use loco_rs::Result;
use loco_rs::app::{AppContext as LocoAppContext, Hooks, Initializer};
-use loco_rs::boot::{BootResult, StartMode, create_app};
+use loco_rs::boot::{BootResult, ServeParams, StartMode, create_app};
use loco_rs::config::Config as LocoConfig;
use loco_rs::controller::AppRoutes;
use loco_rs::environment::Environment;
use mcb_infrastructure::infrastructure::DynamicMigrator;
+use std::net::SocketAddr;
use std::path::{Path, PathBuf};
+use tokio::signal;
Evidence
PR Compliance ID 1207880 requires use statements to be grouped and ordered std -> external ->
mcb_* -> local. In loco_app.rs, use mcb_infrastructure::... appears before use std::..., and
use tokio::... is interleaved, breaking the required ordering.

Rule 1207880: Enforce grouped and ordered Rust imports: std, external crates, mcb_*, then local modules
crates/mcb/src/loco_app.rs[7-18]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`crates/mcb/src/loco_app.rs` has `use std::...` imports placed after external crates and `mcb_*` imports, violating the required grouped/ordered Rust import convention.

## Issue Context
Rule requires grouping imports in this order: (1) `std`, (2) external crates, (3) `mcb_*` crates, (4) local (`crate::/self::/super::`).

## Fix Focus Areas
- crates/mcb/src/loco_app.rs[7-18]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


15. Hardcoded 8080 install check 📘 Rule violation ≡ Correctness
Description
makefiles/dispatch.mk hardcodes http://127.0.0.1:8080/ during install-validate, instead of
deriving the port from configuration or a Make variable. This can break validation in environments
where the HTTP bind/port is configured differently.
Code

makefiles/dispatch.mk[248]

+H=0; while [ $$H -lt 10 ]; do curl -sf http://127.0.0.1:8080/ >/dev/null 2>&1 && { echo "  HTTP server: OK"; break; }; H=$$((H+1)); [ $$H -lt 10 ] && sleep 1; done; [ $$H -eq 10 ] && { echo "  FAIL: HTTP server not responding" >&2; exit 1; }; \
Evidence
PR Compliance ID 1208701 disallows hardcoding values that should be configurable (like ports). The
new install-validate loop calls curl -sf http://127.0.0.1:8080/, embedding a fixed port that may
not match the deployed configuration.

Rule 1208701: Do not hardcode values that should be configurable
makefiles/dispatch.mk[241-249]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`install-validate` uses a hardcoded URL/port (`http://127.0.0.1:8080/`) which can diverge from the actual configured HTTP port.

## Issue Context
Ports are environment-dependent configuration values; validation logic should read them from a single source of truth (config file, systemd unit env, or a Make variable).

## Fix Focus Areas
- makefiles/dispatch.mk[241-249]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


16. HTTP client loses provenance 🐞 Bug ◔ Observability
Description
The HTTP bridge no longer sends model_id and only sends machine_id when hostname resolution
succeeds, so provenance can silently fall back to server-side defaults (wrong machine/model
attribution) or be missing depending on environment.
Code

crates/mcb-server/src/transport/http_client.rs[R380-389]

+    if let Some(machine_id) = hostname::get()
        .ok()
        .and_then(|h| h.into_string().ok())
        .or_else(|| std::env::var("HOSTNAME").ok())
-        .unwrap_or_else(|| FALLBACK_UNKNOWN.to_owned());
-    builder = builder.header(HEADER_MACHINE_ID, machine_id);
+    {
+        builder = builder.header(HEADER_MACHINE_ID, machine_id);
+    }

    builder = builder.header(HEADER_AGENT_PROGRAM, IDE_MCB_CLIENT);
-    builder = builder.header(HEADER_MODEL_ID, FALLBACK_UNKNOWN);
    builder = builder.header(HEADER_DELEGATED, "false");
Evidence
The HTTP client now conditionally sets machine_id and no longer sets model_id. Server defaults
compute machine_id from the server hostname and set model_id to a fallback value, which can
overwrite client provenance if headers are absent; validation expects these provenance fields to be
present for many tools.

crates/mcb-server/src/transport/http_client.rs[361-390]
crates/mcb-server/src/tools/defaults.rs[136-159]
crates/mcb-server/src/tools/validation.rs[64-75]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`post_mcp_request` no longer emits `model_id` and may omit `machine_id`. When headers are absent, `ToolExecutionContext` will use runtime defaults discovered on the server, which can misattribute provenance to the server host/model instead of the client.

### Issue Context
- Server-side runtime defaults derive `machine_id` from the server hostname and set `model_id` to `FALLBACK_UNKNOWN`.
- Provenance validation treats both fields as required for many tools.

### Fix Focus Areas
- crates/mcb-server/src/transport/http_client.rs[357-391]
- crates/mcb-server/src/tools/defaults.rs[136-159]
- crates/mcb-server/src/tools/validation.rs[64-75]

### Suggested fix
- Always send `HEADER_MACHINE_ID` (use a sentinel like `unknown` if it can’t be resolved).
- Restore sending `HEADER_MODEL_ID` (either from config/env or a sentinel).
- Optionally expand operator id detection to be cross-platform (e.g., `USERNAME` on Windows) to keep provenance complete.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


17. New file exceeds 200 lines 📘 Rule violation ⚙ Maintainability
Description
highlight_sync_service.rs is introduced at >200 lines (line numbers exceed 200), violating the
guideline to split large source files into submodules. This increases maintenance burden and review
difficulty.
Code

crates/mcb-infrastructure/src/services/highlight_sync_service.rs[R201-205]

+                    "go",
+                    tree_sitter_go::LANGUAGE.into(),
+                    tree_sitter_go::HIGHLIGHTS_QUERY,
+                ),
+                L::Java => (
Evidence
PR Compliance ID 1208563 requires source files to stay under ~200 lines. The newly added file has
code at line numbers 201+ (proving the file length exceeds the limit).

Rule 1208563: Source files must not exceed ~200 lines
crates/mcb-infrastructure/src/services/highlight_sync_service.rs[201-205]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A newly added production Rust source file exceeds ~200 lines and should be split into smaller modules.

## Issue Context
The file `highlight_sync_service.rs` is introduced at ~292 lines, which exceeds the rule threshold.

## Fix Focus Areas
- crates/mcb-infrastructure/src/services/highlight_sync_service.rs[1-292]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


18. load_app_config defaults LOCO_ENV 📘 Rule violation ☼ Reliability
Description
load_app_config() defaults LOCO_ENV to test when missing, instead of failing fast at startup.
This can start the application under an unintended environment configuration.
Code

crates/mcb-infrastructure/src/config/loader.rs[R30-33]

+    let env_name = std::env::var("LOCO_ENV").unwrap_or_else(|_| {
+        tracing::warn!("LOCO_ENV not set; defaulting to 'test'");
+        "test".to_owned()
+    });
Evidence
PR Compliance ID 1206783 requires startup to fail when required external configuration is missing
and disallows substituting hard-coded defaults. The changed code explicitly defaults LOCO_ENV to
test and continues execution.

Rule 1206783: Fail fast when required external configuration is missing at startup
crates/mcb-infrastructure/src/config/loader.rs[29-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`load_app_config()` uses a hard-coded fallback (`"test"`) when `LOCO_ENV` is unset, rather than failing fast.

## Issue Context
The compliance rule requires required external configuration to cause an explicit startup failure when missing.

## Fix Focus Areas
- crates/mcb-infrastructure/src/config/loader.rs[29-35]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo


/// Securely erase a string by overwriting its buffer
#[allow(unsafe_code)]
#[allow(unsafe_code)] // Why: zeroizing String bytes requires unsafe as_mut_bytes(); exclusive access guarantees safety.

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.

Action required

1. erase_string uses unsafe block 📘 Rule violation ⛨ Security

SecureErasure::erase_string contains an unsafe block (and explicitly allows unsafe_code),
which violates the project requirement to avoid unsafe Rust in production code. This can reintroduce
memory-safety risk and bypasses the intended unsafe_code denial policy.
Agent Prompt
## Issue description
`SecureErasure::erase_string` currently uses an `unsafe` block (and `#[allow(unsafe_code)]`), which violates the repo policy forbidding unsafe Rust in non-test code.

## Issue Context
The PR modifies the `#[allow(unsafe_code)]` line for `erase_string`, but the function still performs unsafe byte access on a `String`.

## Fix Focus Areas
- crates/mcb-utils/src/utils/crypto.rs[57-66]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +30 to +33
let env_name = std::env::var("LOCO_ENV").unwrap_or_else(|_| {
tracing::warn!("LOCO_ENV not set; defaulting to 'test'");
"test".to_owned()
});

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.

Remediation recommended

2. load_app_config defaults loco_env 📘 Rule violation ☼ Reliability

load_app_config() defaults LOCO_ENV to test when missing, instead of failing fast at startup.
This can start the application under an unintended environment configuration.
Agent Prompt
## Issue description
`load_app_config()` uses a hard-coded fallback (`"test"`) when `LOCO_ENV` is unset, rather than failing fast.

## Issue Context
The compliance rule requires required external configuration to cause an explicit startup failure when missing.

## Fix Focus Areas
- crates/mcb-infrastructure/src/config/loader.rs[29-35]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +201 to +205
"go",
tree_sitter_go::LANGUAGE.into(),
tree_sitter_go::HIGHLIGHTS_QUERY,
),
L::Java => (

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.

Remediation recommended

3. New file exceeds 200 lines 📘 Rule violation ⚙ Maintainability

highlight_sync_service.rs is introduced at >200 lines (line numbers exceed 200), violating the
guideline to split large source files into submodules. This increases maintenance burden and review
difficulty.
Agent Prompt
## Issue description
A newly added production Rust source file exceeds ~200 lines and should be split into smaller modules.

## Issue Context
The file `highlight_sync_service.rs` is introduced at ~292 lines, which exceeds the rule threshold.

## Fix Focus Areas
- crates/mcb-infrastructure/src/services/highlight_sync_service.rs[1-292]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread .github/setup-ci.sh
Comment on lines +148 to +152
# Ensure sccache is available (mandatory compilation cache)
if ! command -v sccache &>/dev/null; then
echo "Installing sccache (mandatory compilation cache)..." >&2
_mcb_install_crate sccache
fi

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.

Action required

4. Setup-ci requires cargo pre-rust 🐞 Bug ☼ Reliability

The CI setup now assumes sccache is available by installing it via cargo in
.github/setup-ci.sh and by exporting RUSTC_WRAPPER=sccache in the Makefile, but several
release/publish workflows run the native-deps/setup step before the Rust toolchain is installed and
the Makefile’s best-effort install can be ignored. If cargo is not present or the install fails,
subsequent builds/releases can abort with cargo: command not found or because the sccache
wrapper binary cannot be executed.
Agent Prompt
## Issue description
CI/release/publish and local builds can fail because `sccache` is treated as mandatory in two places: `.github/setup-ci.sh` installs it using `cargo` when missing, but some workflows call the script before installing the Rust toolchain (so `cargo` may not exist), and the Makefile exports `RUSTC_WRAPPER=sccache` unconditionally while only best-effort attempting to install `sccache`, leaving Cargo configured to use a missing wrapper.

## Issue Context
- `native-deps` composite action runs `bash .github/setup-ci.sh ...` on Unix.
- `.github/setup-ci.sh` installs `sccache` via `_mcb_install_crate` / `cargo binstall/install` if it isn’t present.
- In `release.yml`, `native-deps` runs before `dtolnay/rust-toolchain` in `release-build`, and also in `publish-crates` when a registry token exists, so `cargo` may be unavailable when `setup-ci.sh` runs.
- The Makefile sets `RUSTC_WRAPPER := sccache` globally, and the installation attempt happens at Makefile parse-time with errors suppressed (`|| true`), so even if installation fails (or `cargo` is missing) subsequent `cargo` builds still attempt to invoke `sccache` and fail.

## Fix Focus Areas
- .github/setup-ci.sh[136-152]
- .github/workflows/release.yml[64-77]
- .github/workflows/release.yml[260-265]
- .github/actions/native-deps/action.yml[16-19]
- Makefile[35-44]

## Suggested fix
- Reorder `release.yml` steps so `dtolnay/rust-toolchain` runs before `./.github/actions/native-deps` (preferred), and/or
- Update `setup-ci.sh` to only attempt cargo-based installation when `cargo` exists (otherwise skip with a clear message or fail with instructions to install Rust first), and/or
- Install `sccache` via `mozilla-actions/sccache-action` in release/publish jobs before calling `native-deps`.
- In the Makefile, only export `RUSTC_WRAPPER` when `command -v sccache` succeeds, and consider moving installation to an explicit setup target (or making it opt-in via `SCCACHE=1`) so failures are explicit and there is a clean fallback when `sccache` is unavailable.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +419 to +426
services
.agent_session
.create_session(session)
.await
.map_err(|e| {
tracing::warn!("Auto-session creation failed (non-fatal): {e}");
McpError::internal_error(format!("Auto-session creation failed: {e}"), None)
})?;

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.

Action required

5. Auto-create blocks tool calls 🐞 Bug ☼ Reliability

McpServer::handle_request now propagates errors from auto_create_session_and_project, and
auto_create_session returns an error on any DB insert failure; if the session id already exists
(e.g., persisted client session id after a server restart), the first tool call can fail and the
DashSet guard prevents retrying creation.
Agent Prompt
### Issue description
`auto_create_session_and_project(...).await?` makes tool execution fail when auto-session/project creation fails. `auto_create_session` also inserts the session id into `init_sessions` **before** attempting DB creation; if the DB insert fails (including due to duplicate key), the tool call fails and the process will not retry creating that session.

### Issue Context
- The SeaORM `create_session` path uses a plain insert (`sea_repo_insert!`) which is not idempotent.
- The HTTP bridge can persist a session id via a session file; that makes duplicate session ids plausible across server restarts.

### Fix Focus Areas
- crates/mcb-server/src/mcp_server.rs[270-280]
- crates/mcb-server/src/mcp_server.rs[371-428]
- crates/mcb-providers/src/database/seaorm/repos/agent.rs[99-107]
- crates/mcb-providers/src/database/seaorm/repos/common.rs[95-103]
- crates/mcb-server/src/transport/http_client.rs[105-134]

### Suggested fix
- Do not propagate auto-create DB failures to tool callers: catch DB errors and log them, returning `Ok(())` from `auto_create_*`.
- Make session auto-create idempotent:
  - Check `get_session(session_id)` first, or
  - Treat unique-constraint violations as success, or
  - Remove the id from `init_sessions` on failure so a later request can retry.
- If keeping error propagation for validation failures, split error handling: only propagate deterministic input validation errors, not repository/DB errors.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +380 to 389
if let Some(machine_id) = hostname::get()
.ok()
.and_then(|h| h.into_string().ok())
.or_else(|| std::env::var("HOSTNAME").ok())
.unwrap_or_else(|| FALLBACK_UNKNOWN.to_owned());
builder = builder.header(HEADER_MACHINE_ID, machine_id);
{
builder = builder.header(HEADER_MACHINE_ID, machine_id);
}

builder = builder.header(HEADER_AGENT_PROGRAM, IDE_MCB_CLIENT);
builder = builder.header(HEADER_MODEL_ID, FALLBACK_UNKNOWN);
builder = builder.header(HEADER_DELEGATED, "false");

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.

Remediation recommended

6. Http client loses provenance 🐞 Bug ◔ Observability

The HTTP bridge no longer sends model_id and only sends machine_id when hostname resolution
succeeds, so provenance can silently fall back to server-side defaults (wrong machine/model
attribution) or be missing depending on environment.
Agent Prompt
### Issue description
`post_mcp_request` no longer emits `model_id` and may omit `machine_id`. When headers are absent, `ToolExecutionContext` will use runtime defaults discovered on the server, which can misattribute provenance to the server host/model instead of the client.

### Issue Context
- Server-side runtime defaults derive `machine_id` from the server hostname and set `model_id` to `FALLBACK_UNKNOWN`.
- Provenance validation treats both fields as required for many tools.

### Fix Focus Areas
- crates/mcb-server/src/transport/http_client.rs[357-391]
- crates/mcb-server/src/tools/defaults.rs[136-159]
- crates/mcb-server/src/tools/validation.rs[64-75]

### Suggested fix
- Always send `HEADER_MACHINE_ID` (use a sentinel like `unknown` if it can’t be resolved).
- Restore sending `HEADER_MODEL_ID` (either from config/env or a sentinel).
- Optionally expand operator id detection to be cross-platform (e.g., `USERNAME` on Windows) to keep provenance complete.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines 8 to +18
use axum::Router as AxumRouter;
use loco_rs::Result;
use loco_rs::app::{AppContext as LocoAppContext, Hooks, Initializer};
use loco_rs::boot::{BootResult, StartMode, create_app};
use loco_rs::boot::{BootResult, ServeParams, StartMode, create_app};
use loco_rs::config::Config as LocoConfig;
use loco_rs::controller::AppRoutes;
use loco_rs::environment::Environment;
use mcb_infrastructure::infrastructure::DynamicMigrator;
use std::net::SocketAddr;
use std::path::{Path, PathBuf};
use tokio::signal;

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.

Remediation recommended

1. Misordered imports in loco_app.rs 📘 Rule violation ⚙ Maintainability

crates/mcb/src/loco_app.rs mixes std imports after external and mcb_* imports, violating the
required grouped import ordering. This reduces consistency and can cause style/lint gate failures.
Agent Prompt
## Issue description
`crates/mcb/src/loco_app.rs` has `use std::...` imports placed after external crates and `mcb_*` imports, violating the required grouped/ordered Rust import convention.

## Issue Context
Rule requires grouping imports in this order: (1) `std`, (2) external crates, (3) `mcb_*` crates, (4) local (`crate::/self::/super::`).

## Fix Focus Areas
- crates/mcb/src/loco_app.rs[7-18]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread makefiles/dispatch.mk
RES=$$(echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"install-validate","version":"1.0"}}}' | timeout 15 $(INSTALL_DIR)/$(BINARY_NAME) serve --stdio 2>/dev/null); \
echo "$$RES" | grep -q '"serverInfo"' && echo " MCP stdio: OK" || { echo " FAIL: MCP stdio no response" >&2; exit 1; }; \
[ $$R -eq 8 ] && { echo " FAIL: service not active"; exit 1; } || true; \
H=0; while [ $$H -lt 10 ]; do curl -sf http://127.0.0.1:8080/ >/dev/null 2>&1 && { echo " HTTP server: OK"; break; }; H=$$((H+1)); [ $$H -lt 10 ] && sleep 1; done; [ $$H -eq 10 ] && { echo " FAIL: HTTP server not responding" >&2; exit 1; }; \

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.

Remediation recommended

2. Hardcoded 8080 install check 📘 Rule violation ≡ Correctness

makefiles/dispatch.mk hardcodes http://127.0.0.1:8080/ during install-validate, instead of
deriving the port from configuration or a Make variable. This can break validation in environments
where the HTTP bind/port is configured differently.
Agent Prompt
## Issue description
`install-validate` uses a hardcoded URL/port (`http://127.0.0.1:8080/`) which can diverge from the actual configured HTTP port.

## Issue Context
Ports are environment-dependent configuration values; validation logic should read them from a single source of truth (config file, systemd unit env, or a Make variable).

## Fix Focus Areas
- makefiles/dispatch.mk[241-249]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +76 to 77
- name: Build
run: make build RELEASE=1

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.

Action required

3. Release target ignored 🐞 Bug ≡ Correctness

The release workflows install matrix.target but build via make build RELEASE=1, which runs
cargo build --release without --target, so the produced binary is for the runner’s host target
while being packaged/named as matrix.target. This can publish mislabeled or incorrect-architecture
release artifacts (and effectively skips building the intended non-host target).
Agent Prompt
### Issue description
`.github/workflows/release.yml` (and similarly `ci.yml`’s release-build job) sets `targets: ${{ matrix.target }}` and names artifacts by that target, but the build command is `make build RELEASE=1`. The Makefile’s build dispatcher runs `cargo build --release` without `--target`, which means Cargo builds for the host triple, not the matrix target.

### Issue Context
- Workflow expects per-matrix target artifacts (e.g. `x86_64-apple-darwin`).
- Current Makefile build target does not accept or forward a target.

### Fix Focus Areas
- .github/workflows/release.yml[71-99]
- makefiles/dispatch.mk[59-63]
- .github/workflows/ci.yml[563-585]

### Suggested fix
Choose one:
1) **Workflow-level**: replace `make build RELEASE=1` with `cargo build --release --target "${{ matrix.target }}"` and copy from `target/${{ matrix.target }}/release/...`.
2) **Makefile-level**: add a `TARGET` variable and have `DISPATCH_BUILD` do `cargo build --release --target "$(TARGET)"` when `TARGET` is set; then pass `TARGET=${{ matrix.target }}` from the workflow(s) and adjust copy paths accordingly.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +42 to +46
/// ```
/// use mcb_infrastructure::services::highlight_sync_service::HighlightSyncPort;
/// fn example(port: &dyn HighlightSyncPort) {
/// let _ = port.highlight("fn main() {}", "rust");
/// }

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.

Action required

4. Doctest hits private module 🐞 Bug ≡ Correctness

highlight_sync_service.rs includes a doctest that imports
mcb_infrastructure::services::highlight_sync_service::HighlightSyncPort, but the module is
declared private (mod highlight_sync_service;). Doctests compile as an external crate, so `cargo
test --doc` will fail to compile this example.
Agent Prompt
### Issue description
The doctest in `highlight_sync_service.rs` imports a private module path (`services::highlight_sync_service`), but `services/mod.rs` declares it as a private module. Rust doctests are compiled as an external consumer, so private module paths are not accessible.

### Issue Context
This will break `cargo test --doc` / any CI gate running doctests.

### Fix Focus Areas
- crates/mcb-infrastructure/src/services/highlight_sync_service.rs[39-51]
- crates/mcb-infrastructure/src/services/mod.rs[19-23]

### Suggested fix
Pick one:
1) Make the module public: change `mod highlight_sync_service;` to `pub mod highlight_sync_service;` (or re-export specific items via `pub use highlight_sync_service::HighlightSyncPort;`).
2) If you *don’t* want it public, change the doctest block to ` ```ignore ` (or remove the external-path import and describe usage without compiling code).

Ensure doctests pass after the change.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 1d253e6

@marlon-costa-dc
marlon-costa-dc enabled auto-merge (squash) July 29, 2026 02:51
Comment on lines +9 to +14
use mcb_domain::ports::HighlightError;
use mcb_domain::value_objects::browse::{HighlightSpan, HighlightedCode};
use tree_sitter::Language;
use tree_sitter_highlight::{Highlight, HighlightConfiguration, HighlightEvent, Highlighter};

use mcb_domain::value_objects::browse::{HIGHLIGHT_NAMES, map_highlight_to_category};

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.

Remediation recommended

1. Highlight imports are misordered 📘 Rule violation ⚙ Maintainability

The new module places mcb_domain imports before external crates and then repeats the mcb_domain
group. Rust imports must be grouped as std, external crates, mcb_*, then local modules.
Agent Prompt
## Issue description
The imports in `highlight_sync_service.rs` do not follow the required Rust import group order.

## Issue Context
External `tree_sitter` imports must precede all `mcb_*` imports, and the two `mcb_domain` blocks should be contiguous.

## Fix Focus Areas
- crates/mcb-infrastructure/src/services/highlight_sync_service.rs[7-14]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +86 to +89
let mut state = self
.state
.lock()
.map_err(|e| HighlightError::HighlightingFailed(format!("Lock poisoned: {e}")))?;

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.

Remediation recommended

2. highlighterror bypasses constructors 📘 Rule violation ≡ Correctness

The new highlighting implementation directly constructs the thiserror enum variant
HighlightError::HighlightingFailed. Domain errors must be created through constructor methods so
their formatting and creation remain centralized.
Agent Prompt
## Issue description
The new infrastructure implementation directly instantiates `HighlightError` variants instead of using domain-provided constructor methods.

## Issue Context
Add appropriate constructor methods alongside the domain error definition if they do not exist, then replace all direct `HighlightError` variant construction in the new highlighting implementation.

## Fix Focus Areas
- crates/mcb-infrastructure/src/services/highlight_sync_service.rs[86-136]
- crates/mcb-infrastructure/src/services/highlight_sync_service.rs[235-279]
- crates/mcb-domain/src/ports/services/browse.rs[27-40]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread .github/workflows/ci.yml
Add-Content -Path $env:GITHUB_PATH -Value $ortLib
Add-Content -Path $env:GITHUB_ENV -Value "ORT_DYLIB_PATH=$ortLib\onnxruntime.dll"
Add-Content -Path $env:GITHUB_ENV -Value "PATH=$ortLib;$env:PATH"
git clone --depth 1 https://github.com/${{ github.repository }}.git .

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.

Action required

3. Windows jobs clone twice 🐞 Bug ☼ Reliability

The Windows test-cross and release-build legs run actions/checkout and then clone into the
already populated workspace. git clone ... . therefore fails before either job reaches tests or
compilation.
Agent Prompt
## Issue description
Windows CI jobs clone into a workspace already populated by `actions/checkout`, causing deterministic failures.

## Issue Context
Both `test-cross` and `release-build` contain the duplicated checkout sequence. Preserve the existing checkout and use the native dependency action where dependencies are needed.

## Fix Focus Areas
- .github/workflows/ci.yml[320-338]
- .github/workflows/ci.yml[530-548]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

push:
tags:
- "v*"
# Recovery path: manually (re)publish a GitHub Release for an existing tag without

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.

Action required

4. Manual release builds wrong revision 🐞 Bug ≡ Correctness

The new manual release path accepts an arbitrary existing tag, but release-build checks out the
dispatch ref rather than that tag. It can consequently publish binaries built from a branch revision
under the requested tag.
Agent Prompt
## Issue description
Manual release artifacts are built from the workflow dispatch ref instead of the requested release tag.

## Issue Context
The input tag controls release naming and publication, but the build checkout has no matching `ref`. Ensure all tag-specific build and documentation jobs operate on the validated input tag.

## Fix Focus Areas
- .github/workflows/release.yml[20-27]
- .github/workflows/release.yml[64-67]
- .github/workflows/release.yml[132-191]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

"stdio-only mode: HTTP server disabled (port {})",
serve_params.port
);
wait_for_shutdown_signal().await;

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.

Action required

5. Stdio completion cannot exit 🐞 Bug ☼ Reliability

Stdio-only serving now waits exclusively for Ctrl+C or SIGTERM, while the stdio transport runs in a
detached task whose completion is ignored. When that transport shuts down, the main process remains
alive waiting for an unrelated OS signal.
Agent Prompt
## Issue description
Completion of the stdio transport does not terminate stdio-only serving, leaving the process running.

## Issue Context
The initializer drops the stdio task handle. Introduce a shared shutdown notification or retain and await the handle alongside OS signals, while preserving hybrid HTTP behavior.

## Fix Focus Areas
- crates/mcb/src/loco_app.rs[151-173]
- crates/mcb/src/initializers/mcp_server.rs[325-353]
- crates/mcb-server/src/transport/stdio.rs[34-53]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

kill_duplicate_rust_analyzers() {
printf "\n--- rust-analyzer duplicate cleanup -----------------------------------------\n"
local pids
pids=$(pgrep -a -f 'rust.analyzer|rust-analyzer' 2>/dev/null | grep -v 'grep' | awk '{print $1}' || true)

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.

Remediation recommended

6. Optimizer kills unrelated analyzers 🐞 Bug ☼ Reliability

Despite describing KEEP_RA as a per-project limit, the optimizer collects every matching
rust-analyzer process and retains only one globally. Running it with --apply can terminate active
analyzers serving unrelated repositories.
Agent Prompt
## Issue description
The destructive optimizer applies its rust-analyzer retention limit globally rather than per project.

## Issue Context
Group processes by a verified workspace or working directory before applying limits. Do not terminate a process unless its project ownership can be established safely.

## Fix Focus Areas
- scripts/dev-env-optimize.sh[18-20]
- scripts/dev-env-optimize.sh[107-150]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread makefiles/dispatch.mk
@case "$(WHAT)" in \
hooks) cp scripts/hooks/pre-commit .git/hooks/pre-commit; chmod +x .git/hooks/pre-commit; echo "✓ pre-commit hook installed" ;; \
tools) cargo install cargo-udeps cargo-audit cargo-tarpaulin 2>/dev/null || true; echo "✓ tools installed" ;; \
hooks) cp scripts/hooks/pre-commit scripts/hooks/pre-push .git/hooks/; chmod +x .git/hooks/pre-commit .git/hooks/pre-push; echo "✓ pre-commit + pre-push hooks installed" ;; \

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.

Remediation recommended

7. Setup overwrites beads hooks 🐞 Bug ≡ Correctness

The setup target directly replaces .git/hooks/pre-commit and pre-push, but only the replacement
pre-push delegates to Beads. Running setup after bd hooks install --chain therefore removes the
required Beads pre-commit integration and can leave hook policy noncompliant.
Agent Prompt
## Issue description
Project hook installation overwrites chained Beads hooks and drops Beads pre-commit execution.

## Issue Context
Make hook setup idempotently preserve or install the Beads chain for both hooks. Avoid plain copies over already installed hook entry points.

## Fix Focus Areas
- makefiles/dispatch.mk[303-308]
- scripts/hooks/pre-commit[1-7]
- scripts/hooks/pre-push[1-10]
- scripts/context/validate-beads-policy.sh[22-45]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 392a451

Comment thread Cargo.lock
Comment on lines +5337 to +5341
[[package]]
name = "protoc-bin-vendored-macos-aarch_64"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "343d3bd7056eda839b03204e68deff7d1b13aba7af2b2fd16890697274262ee7"

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.

Action required

1. Conflicting package duplicated in lockfile 📘 Rule violation ✧ Quality

The added protoc-bin-vendored 3.2.0 records duplicate existing package identities, including a
conflicting protoc-bin-vendored-macos-aarch_64 record with a different checksum and unrelated
dependencies copied from prost-build. This lockfile corruption may cause Cargo to reject or fail
to verify the lockfile, blocking locked builds, Clippy, tests, and CI.
Agent Prompt
## Issue description

`Cargo.lock` contains duplicated `protoc-bin-vendored` 3.2.0 package identities and a corrupted `protoc-bin-vendored-macos-aarch_64` record with a conflicting checksum and unrelated dependencies. This can cause Cargo to reject or fail to validate the committed lockfile.

## Issue Context

The added block repeats existing `protoc-bin-vendored` platform records, while the macOS ARM entry contains checksum and dependency data that do not belong to that platform-binary package. Regenerate the lockfile from the workspace manifests rather than manually retaining or editing the duplicated block, then verify the result with locked Cargo build, Clippy, and test commands.

## Fix Focus Areas

- Cargo.lock[5337-5415]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit a5c3d9f

@cubic-dev-ai cubic-dev-ai Bot 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.

40 issues found across 158 files

Confidence score: 2/5

  • In .github/workflows/ci.yml, the Windows matrix currently fails before compilation due to cloning into an already checked-out workspace and dropping required protoc/ONNX setup, which blocks test signal and Windows artifacts entirely — remove the extra clone step and restore the dependency install sequence.
  • In .github/workflows/release.yml (also reflected in docs/operations/CHANGELOG.md), manual recovery can publish binaries from the wrong commit/tag and still appear successful even when a platform build fails, creating misleading releases with missing artifacts — consistently check out workflow_dispatch.inputs.tag in all release jobs and fail/mark the release when any artifact is missing.
  • In crates/mcb-server/src/mcp_server.rs, the new persistence .await? path can abort before route_tool_call, so transient session/project save failures now block otherwise valid tool calls — make persistence non-blocking for routing (or degrade gracefully with logging/retry) to preserve tool availability.
  • In scripts/dev-env-optimize.sh, global PID cleanup can terminate rust-analyzer/Serena processes from other repositories, causing cross-project disruption — scope process discovery/termination to the current repo before applying cleanup.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name=".github/workflows/ci.yml">

<violation number="1" location=".github/workflows/ci.yml:147">
P1: The new tool-install and sccache steps execute third-party action code from mutable tags, creating an avoidable CI supply-chain and reproducibility risk. Pin every new `taiki-e/install-action` and `mozilla-actions/sccache-action` use to a reviewed full commit SHA, matching the rest of the workflow.</violation>

<violation number="2" location=".github/workflows/ci.yml:334">
P0: Every Windows test/release matrix leg fails before compilation because this clones into the workspace already populated by `actions/checkout`; the step also no longer installs the protoc/ONNX dependencies named by the step. Replace these duplicated Git blocks with `./.github/actions/native-deps` (and rely on the existing recursive checkout).</violation>

<violation number="3" location=".github/workflows/ci.yml:362">
P2: Windows regressions outside library unit tests and the single startup smoke test are no longer exercised, even though this leg now has a 240-minute timeout intended for the full suite. Keep the same full-suite command across matrix platforms rather than reducing the required Windows gate.</violation>
</file>

<file name=".github/workflows/release.yml">

<violation number="1" location=".github/workflows/release.yml:22">
P0: A manual recovery for an existing tag can publish binaries built from the wrong commit. `workflow_dispatch.tag` is only used when naming/verifying the release; both checkout steps still check out the dispatch ref. Consider setting the checkout `ref` to the input tag for manual runs (and the pushed tag ref otherwise) in both `release-build` and `create-release`.</violation>

<violation number="2" location=".github/workflows/release.yml:137">
P2: A branch, SHA, or non-version tag passes this “tag exists” check, so the recovery path proceeds without identifying the promised existing release tag. Validate the exact `refs/tags/$INPUT_TAG` ref and the required `v*` format via the canonical Make interface.</violation>

<violation number="3" location=".github/workflows/release.yml:191">
P1: A failed platform build now produces an official, successful-looking release with missing binaries, and the summary still claims all three artifacts exist. This turns a build failure into a partially published release rather than preserving release integrity. Consider requiring all expected assets before publishing (the manual dispatch path can still be used to recover after the failed leg is fixed).</violation>
</file>

<file name="docs/MCP_TOOLS.md">

<violation number="1" location="docs/MCP_TOOLS.md:216">
P2: Clients are now told that missing provenance aborts server startup and that `model_id` is discovered from model environment variables, but the runtime actually boots with `model_id = "UNKNOWN"` and validates provenance only when a relevant tool is called. This makes startup/runbook expectations and the documented `MCB_MODEL_ID` remediation unreliable; the section should describe the implemented defaults and call-time validation, or the runtime behavior needs to be implemented as documented.</violation>

<violation number="2" location="docs/MCP_TOOLS.md:222">
P1: Calls with `repo_path` but no `repo_id` are rejected, contrary to this conditional requirement; the documented ID source is also incorrect. Please mark `repo_id` required and describe its root-commit-derived value.</violation>

<violation number="3" location="docs/MCP_TOOLS.md:237">
P2: Plain filesystem workspaces do not currently have the documented “ultimate happy path”: discovery only accepts a path that the Git `VcsProvider` can open, after which index/search/memory calls reject missing `repo_path` and `repo_id`. The listed non-Git detectors and always-resolved `worktree_id` are also not implemented. This should be documented as Git-only until those fallbacks exist, otherwise users in non-Git directories will expect calls to work and receive missing-provenance errors.</violation>
</file>

<file name="scripts/dev-env-optimize.sh">

<violation number="1" location="scripts/dev-env-optimize.sh:110">
P1: Running `make dev-env-optimize APPLY=Y` can terminate active rust-analyzer and Serena processes belonging to other repositories. The PID lists are global even though the script promises per-project cleanup and computes `PROJECT_ROOT`. Consider identifying each process's project/cwd and filtering to this repository before applying the keep count or sending signals.</violation>

<violation number="2" location="scripts/dev-env-optimize.sh:137">
P1: Once cargo matching works, `--apply` terminates every cargo command older than 30 minutes, including legitimate builds, while ignoring `KEEP_CARGO`. Verify state/activity and retain the configured count before sending `TERM`.</violation>

<violation number="3" location="scripts/dev-env-optimize.sh:208">
P2: Stale cargo checking never finds a process because each `ps` row starts with its PID, not `cargo`. Match the command field instead.</violation>
</file>

<file name="crates/mcb-server/src/mcp_server.rs">

<violation number="1" location="crates/mcb-server/src/mcp_server.rs:280">
P1: Tool calls are now blocked whenever automatic session or project persistence fails. The new `.await?` propagates the `McpError` produced by both create paths before `route_tool_call` runs, despite this helper’s contract and logs describing DB failures as non-fatal. Consider swallowing repository failures after logging them, while propagating only the intended input-validation errors.</violation>

<violation number="2" location="crates/mcb-server/src/mcp_server.rs:391">
P1: A failed auto-initialization permanently marks the session/project as initialized. Because the `DashSet` insertion happens before the newly propagated validation, clock, and repository errors, the first call fails but later calls skip initialization and run without the corresponding record. Consider committing the guard only after successful creation/existence checks, or removing/reserving it with explicit rollback on every failure path so retries remain consistent.</violation>

<violation number="3" location="crates/mcb-server/src/mcp_server.rs:394">
P2: Missing model provenance still creates sessions with `"unknown"` rather than failing as this validation intends. `ToolExecutionContext::resolve` always receives the nonblank `RuntimeDefaults.model_id = FALLBACK_UNKNOWN`, and the HTTP bridge now sends no model header, so this `ok_or_else` cannot distinguish an absent model from a real one. Consider removing the fallback at context discovery/resolution and validating the actual request/transport source before creating the session.</violation>
</file>

<file name="docs/operations/CHANGELOG.md">

<violation number="1" location="docs/operations/CHANGELOG.md:21">
P1: Manual recovery can publish binaries from the workflow branch under a different existing tag because `release-build` never checks out `workflow_dispatch.inputs.tag`. The release jobs should consistently check out and build the requested tag before this is documented as recovery.</violation>
</file>

<file name="Makefile">

<violation number="1" location="Makefile:43">
P1: Fresh environments cannot bootstrap this dependency reliably: parsing even `make help` starts an unguarded install through the already-missing `sccache` wrapper, then suppresses failure and leaves Rust targets broken. An explicit `mcb.sh`/setup phase should install and verify `sccache` before exporting `RUSTC_WRAPPER`, without swallowing errors.</violation>
</file>

<file name="docs/archive/k8s/legacy-manifests.bak/README.md">

<violation number="1" location="docs/archive/k8s/legacy-manifests.bak/README.md:3">
P1: Readers entering this directory can mistake superseded manifests for a supported deployment path because this README explicitly instructs them to deploy it, contradicting the parent archive notice. Add a prominent warning here that these artifacts are historical only and link to the current deployment documentation.</violation>
</file>

<file name="scripts/docs/validate.sh">

<violation number="1" location="scripts/docs/validate.sh:363">
P1: The docs validation gate still passes when `check_outdated.py` crashes or returns a failure because `|| true` suppresses every nonzero status. Let the command propagate its exit code so scanner failures remain visible to CI.</violation>
</file>

<file name=".github/actions/native-deps/action.yml">

<violation number="1" location=".github/actions/native-deps/action.yml:48">
P1: Windows CI extracts and loads an ONNX Runtime DLL without verifying the archive, leaving this executable dependency vulnerable to corrupted or replaced release content. Add a pinned SHA-256 and reject a mismatch before `Expand-Archive`, matching the protoc and Unix ONNX paths.</violation>
</file>

<file name="crates/mcb-infrastructure/src/services/highlight_sync_service.rs">

<violation number="1" location="crates/mcb-infrastructure/src/services/highlight_sync_service.rs:162">
P1: TSX input never reaches this arm: `LanguageId::from_name("tsx")` currently resolves to `TypeScript`, so JSX is highlighted with `LANGUAGE_TYPESCRIPT` instead of `LANGUAGE_TSX`. Correct the duplicate `tsx` alias ordering/mapping in `LanguageId::NAME_EQUIVALENTS` and add a TSX syntax test.</violation>

<violation number="2" location="crates/mcb-infrastructure/src/services/highlight_sync_service.rs:210">
P2: C input never reaches this arm: `LanguageId::from_name("c")` resolves to `Cpp`, so the service silently uses the C++ grammar. Correct the duplicate `c` alias mapping in `LanguageId::NAME_EQUIVALENTS` and cover the C grammar explicitly.</violation>
</file>

<file name="docs/testing/INTEGRATION_TESTS.md">

<violation number="1" location="docs/testing/INTEGRATION_TESTS.md:81">
P2: Starting Docker alone does not make service-gated tests run: the availability helpers require URLs in `config/tests.toml`, whose entries are all commented out. Document the required host mappings (for example Milvus on `29530`, Ollama on `21434`, Redis on `26379`, and Postgres on `25432`) before this test command.</violation>

<violation number="2" location="docs/testing/INTEGRATION_TESTS.md:96">
P1: The documented containerized test command currently fails because `test-runner` invokes the nonexistent `make test-rust` target. Either fix the Compose runner to use a supported test verb or avoid advertising this command until it works.</violation>
</file>

<file name="scripts/context/validate-beads-policy.sh">

<violation number="1" location="scripts/context/validate-beads-policy.sh:42">
P2: The gate can report a valid `prepare-commit-msg` hook even when agent trailers run without `BD_ALLOW_AGENT_COMMIT_TRAILERS=1`, because it checks only string presence and not guard/delegation structure. Validate the installed hook's exact guarded block or its behavior with the variable unset, `0`, and `1`.</violation>

<violation number="2" location="scripts/context/validate-beads-policy.sh:48">
P2: Legacy beads guidance added to active onboarding or user documentation is not detected because those paths are omitted from `scan_paths`. Include all active documentation locations while explicitly excluding archival content.</violation>

<violation number="3" location="scripts/context/validate-beads-policy.sh:58">
P1: Legacy instructions such as `Run bd sync manually` pass this gate because `manual` anywhere on the line exempts the entire match. Restrict exemptions to an explicit negation/deprecation of the matched command rather than unrelated keywords.</violation>
</file>

<file name="scripts/lib/mcb.sh">

<violation number="1" location="scripts/lib/mcb.sh:99">
P1: Production violations in the excluded directories are now invisible to all three gates, including executable `unwrap()` calls and unjustified `#[allow]` attributes. Narrow exclusions to known citation/string matches rather than exempting whole source trees.</violation>

<violation number="2" location="scripts/lib/mcb.sh:104">
P2: The claimed string/declaration exclusions both allow real banned calls through and still flag harmless literal text because they classify entire lines rather than matched tokens. A quote-aware or syntax-aware scan should remove literal/comment spans before searching executable code.</violation>

<violation number="3" location="scripts/lib/mcb.sh:113">
P2: Staging one validator file defeats its new path and doc-comment exclusions, so harmless cited patterns can block the commit. The first two grep invocations should also force a filename with `-H` before applying filename-aware filters.</violation>

<violation number="4" location="scripts/lib/mcb.sh:125">
P1: A commit containing one Rust file can fail the `#[allow]` gate even when the next line has the required justification. `grep -rnE` omits the filename for a single operand, so this loop misparses the line number; forcing filenames with `-H` keeps the parser valid.</violation>
</file>

<file name="scripts/hooks/pre-push">

<violation number="1" location="scripts/hooks/pre-push:8">
P1: Issue-graph synchronization is silently skipped whenever `bd` is missing from `PATH`, despite this being documented as a no-bypass hook. Delegating unconditionally lets command-not-found fail the push instead of reporting success without the Beads gate.</violation>
</file>

<file name="crates/mcb/src/loco_app.rs">

<violation number="1" location="crates/mcb/src/loco_app.rs:170">
P1: Stdio-only processes remain alive after the MCP client closes stdin or the stdio server fails, because this branch can finish only on Ctrl+C/SIGTERM while the stdio task is detached. Retaining the stdio task completion signal and selecting it alongside OS shutdown would let MCP child processes exit normally.</violation>
</file>

<file name="makefiles/dispatch.mk">

<violation number="1" location="makefiles/dispatch.mk:120">
P1: `make hook WHAT=pre-commit` can fail before unit tests run because `$(MCB_TEST_UNIT)` depends on shell variable `T`, but this hook branch never initializes it. Initializing/sanitizing `T` in this branch (as done in `DISPATCH_TEST`) keeps the hook gate runnable.</violation>

<violation number="2" location="makefiles/dispatch.mk:233">
P1: Installation persists the JWT signing secret in the systemd unit, which is copied with ordinary unit-file permissions, even though the canonical secret file is restricted to `0600`. This exposes a credential in configuration/backups and duplicates its source of truth. Consider keeping the secret only in a restricted environment file referenced with `EnvironmentFile=` (with the file containing `JWT_SECRET=...`).</violation>
</file>

<file name="docs/operations/DEPLOYMENT.md">

<violation number="1" location="docs/operations/DEPLOYMENT.md:14">
P2: The documented development command exits with Clap's missing-subcommand error rather than starting a server. `make dev WHAT=run` invokes bare `cargo run`, while the binary requires the `serve` subcommand; the Make dispatch should pass `serve` before this is presented as a working runtime mode.</violation>
</file>

<file name="AGENTS.md">

<violation number="1" location="AGENTS.md:159">
P2: Kubernetes beads cannot satisfy this completion gate because `dese` and the `dese/prod/control` order have no repository-defined meaning. Reference a canonical deployment-environment document or omit this environment-specific interlock until that source exists.</violation>

<violation number="2" location="AGENTS.md:362">
P2: The documented `contributor` repair cannot make this repository healthy: the same section and `scripts/context/validate-beads-policy.sh` require `beads.role` to equal `maintainer`. The `maintainer|contributor` notation is also unsafe to paste because the shell treats `|` as a pipe. This repository-specific repair should name only the accepted `git config beads.role maintainer` command.</violation>
</file>

<file name="crates/mcb-server/src/tools/validation.rs">

<violation number="1" location="crates/mcb-server/src/tools/validation.rs:136">
P2: Servers constructed through the public `McpServer::new(..., None)` path now reject every tool call with `execution_flow is required`. Since the constructor and runtime defaults still explicitly support an absent flow, preserving the `StdioOnly` fallback (or making the constructor parameter non-optional throughout) would avoid this runtime regression.</violation>
</file>

<file name=".config/nextest.toml">

<violation number="1" location=".config/nextest.toml:17">
P2: All `mcb-server` test binaries are now serialized, including hundreds of unit, e2e, and contract tests unrelated to `SharedTestContext`. Narrowing this override to the tests that initialize the shared context would retain nextest parallelism for the rest of the package.</violation>
</file>

Shadow auto-approve: would not auto-approve because issues were found.
Tip: instead of fixing issues one by one fix them all with cubic

Re-trigger cubic

Comment thread .github/workflows/ci.yml
@@ -17,9 +17,11 @@ permissions:

@cubic-dev-ai cubic-dev-ai Bot Jul 29, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P0: Every Windows test/release matrix leg fails before compilation because this clones into the workspace already populated by actions/checkout; the step also no longer installs the protoc/ONNX dependencies named by the step. Replace these duplicated Git blocks with ./.github/actions/native-deps (and rely on the existing recursive checkout).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/ci.yml, line 334:

<comment>Every Windows test/release matrix leg fails before compilation because this clones into the workspace already populated by `actions/checkout`; the step also no longer installs the protoc/ONNX dependencies named by the step. Replace these duplicated Git blocks with `./.github/actions/native-deps` (and rely on the existing recursive checkout).</comment>

<file context>
@@ -330,69 +331,43 @@ jobs:
-          Add-Content -Path $env:GITHUB_PATH -Value $ortLib
-          Add-Content -Path $env:GITHUB_ENV -Value "ORT_DYLIB_PATH=$ortLib\onnxruntime.dll"
-          Add-Content -Path $env:GITHUB_ENV -Value "PATH=$ortLib;$env:PATH"
+          git clone --depth 1 https://github.com/${{ github.repository }}.git .
+          git fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +${{ github.sha }}:refs/remotes/origin/temp
+          git checkout ${{ github.sha }}
</file context>
Fix with cubic

- "v*"
# Recovery path: manually (re)publish a GitHub Release for an existing tag without
# re-tagging — e.g. when a build leg failed or a release needs re-running.
workflow_dispatch:

@cubic-dev-ai cubic-dev-ai Bot Jul 29, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P0: A manual recovery for an existing tag can publish binaries built from the wrong commit. workflow_dispatch.tag is only used when naming/verifying the release; both checkout steps still check out the dispatch ref. Consider setting the checkout ref to the input tag for manual runs (and the pushed tag ref otherwise) in both release-build and create-release.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/release.yml, line 22:

<comment>A manual recovery for an existing tag can publish binaries built from the wrong commit. `workflow_dispatch.tag` is only used when naming/verifying the release; both checkout steps still check out the dispatch ref. Consider setting the checkout `ref` to the input tag for manual runs (and the pushed tag ref otherwise) in both `release-build` and `create-release`.</comment>

<file context>
@@ -17,6 +17,14 @@ on: # yamllint disable-line rule:truthy
       - "v*"
+  # Recovery path: manually (re)publish a GitHub Release for an existing tag without
+  # re-tagging — e.g. when a build leg failed or a release needs re-running.
+  workflow_dispatch:
+    inputs:
+      tag:
</file context>
Fix with cubic

Comment thread docs/MCP_TOOLS.md
|-------|------|----------|-------------------|-------------------|
| `session_id` | string | **yes** | IDE session ID (`CURSOR_TRACE_ID`, `CLAUDE_SESSION_ID`, …) or traceable ID `<agent>-<host>-<pid>-<timestamp>` | — (always traceable) |
| `repo_path` | string | **yes** | Plugin-based workspace discovery: Git → Mercury → CVS → SVN → … → **Filesystem (CWD canonical)** | — (CWD is the ultimate happy path) |
| `repo_id` | string | if `repo_path` absent | Git remote `origin` URL hash; absent for plain filesystem workspaces | — |

@cubic-dev-ai cubic-dev-ai Bot Jul 29, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1: Calls with repo_path but no repo_id are rejected, contrary to this conditional requirement; the documented ID source is also incorrect. Please mark repo_id required and describe its root-commit-derived value.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/MCP_TOOLS.md, line 222:

<comment>Calls with `repo_path` but no `repo_id` are rejected, contrary to this conditional requirement; the documented ID source is also incorrect. Please mark `repo_id` required and describe its root-commit-derived value.</comment>

<file context>
@@ -213,21 +213,33 @@ Unified entity CRUD (vcs/plan/issue/org resources).
+|-------|------|----------|-------------------|-------------------|
+| `session_id` | string | **yes** | IDE session ID (`CURSOR_TRACE_ID`, `CLAUDE_SESSION_ID`, …) or traceable ID `<agent>-<host>-<pid>-<timestamp>` | — (always traceable) |
+| `repo_path` | string | **yes** | Plugin-based workspace discovery: Git → Mercury → CVS → SVN → … → **Filesystem (CWD canonical)** | — (CWD is the ultimate happy path) |
+| `repo_id` | string | if `repo_path` absent | Git remote `origin` URL hash; absent for plain filesystem workspaces | — |
+| `project_id` | string | no | Git remote `origin` (`owner/repo`); absent for plain filesystem workspaces | — |
+| `worktree_id` | string | no | `git rev-parse --git-dir` → `git worktree list` → `.git` dir → `"main"` → **CWD path** | — (always resolved) |
</file context>
Suggested change
| `repo_id` | string | if `repo_path` absent | Git remote `origin` URL hash; absent for plain filesystem workspaces | |
| `repo_id` | string | **yes** | Identifier derived from the repository root commit, or an explicit request metadata override | `Missing execution provenance for '<tool>': repo_id` |
Fix with cubic

kill_duplicate_rust_analyzers() {
printf "\n--- rust-analyzer duplicate cleanup -----------------------------------------\n"
local pids
pids=$(pgrep -a -f 'rust.analyzer|rust-analyzer' 2>/dev/null | grep -v 'grep' | awk '{print $1}' || true)

@cubic-dev-ai cubic-dev-ai Bot Jul 29, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1: Running make dev-env-optimize APPLY=Y can terminate active rust-analyzer and Serena processes belonging to other repositories. The PID lists are global even though the script promises per-project cleanup and computes PROJECT_ROOT. Consider identifying each process's project/cwd and filtering to this repository before applying the keep count or sending signals.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/dev-env-optimize.sh, line 110:

<comment>Running `make dev-env-optimize APPLY=Y` can terminate active rust-analyzer and Serena processes belonging to other repositories. The PID lists are global even though the script promises per-project cleanup and computes `PROJECT_ROOT`. Consider identifying each process's project/cwd and filtering to this repository before applying the keep count or sending signals.</comment>

<file context>
@@ -0,0 +1,288 @@
+kill_duplicate_rust_analyzers() {
+    printf "\n--- rust-analyzer duplicate cleanup -----------------------------------------\n"
+    local pids
+    pids=$(pgrep -a -f 'rust.analyzer|rust-analyzer' 2>/dev/null | grep -v 'grep' | awk '{print $1}' || true)
+
+    if [ -z "${pids}" ]; then
</file context>
Fix with cubic

&self.auto_init_projects,
)
.await;
.await?;

@cubic-dev-ai cubic-dev-ai Bot Jul 29, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1: Tool calls are now blocked whenever automatic session or project persistence fails. The new .await? propagates the McpError produced by both create paths before route_tool_call runs, despite this helper’s contract and logs describing DB failures as non-fatal. Consider swallowing repository failures after logging them, while propagating only the intended input-validation errors.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At crates/mcb-server/src/mcp_server.rs, line 280:

<comment>Tool calls are now blocked whenever automatic session or project persistence fails. The new `.await?` propagates the `McpError` produced by both create paths before `route_tool_call` runs, despite this helper’s contract and logs describing DB failures as non-fatal. Consider swallowing repository failures after logging them, while propagating only the intended input-validation errors.</comment>

<file context>
@@ -277,7 +277,7 @@ tools:
             &self.auto_init_projects,
         )
-        .await;
+        .await?;
 
         route_tool_call(request, &self.handlers, execution_context).await
</file context>
Fix with cubic

Comment thread .config/nextest.toml
serial-shared-context = { max-threads = 1 }

[[profile.default.overrides]]
filter = 'package(mcb-server) and kind(test)'

@cubic-dev-ai cubic-dev-ai Bot Jul 29, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: All mcb-server test binaries are now serialized, including hundreds of unit, e2e, and contract tests unrelated to SharedTestContext. Narrowing this override to the tests that initialize the shared context would retain nextest parallelism for the rest of the package.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .config/nextest.toml, line 17:

<comment>All `mcb-server` test binaries are now serialized, including hundreds of unit, e2e, and contract tests unrelated to `SharedTestContext`. Narrowing this override to the tests that initialize the shared context would retain nextest parallelism for the rest of the package.</comment>

<file context>
@@ -0,0 +1,23 @@
+serial-shared-context = { max-threads = 1 }
+
+[[profile.default.overrides]]
+filter = 'package(mcb-server) and kind(test)'
+test-group = 'serial-shared-context'
+# Defense-in-depth: the CI warm-up step (`make test SCOPE=warmup`) populates the
</file context>
Fix with cubic

Comment thread AGENTS.md
- Publication interlock: when Git is explicitly authorized for the lane, the coordinator stages only the bead's
scoped paths, commits with no agent attribution, pushes, records commit/push/CI evidence in `bd`, and keeps
the bead open until remote checks finish.
- GitOps interlock: for Kubernetes/GitOps changes, completion requires dese-first validation from ArgoCD/read-only

@cubic-dev-ai cubic-dev-ai Bot Jul 29, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: Kubernetes beads cannot satisfy this completion gate because dese and the dese/prod/control order have no repository-defined meaning. Reference a canonical deployment-environment document or omit this environment-specific interlock until that source exists.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At AGENTS.md, line 159:

<comment>Kubernetes beads cannot satisfy this completion gate because `dese` and the `dese/prod/control` order have no repository-defined meaning. Reference a canonical deployment-environment document or omit this environment-specific interlock until that source exists.</comment>

<file context>
@@ -75,26 +84,103 @@ types at the source; depend on declared contracts, not loosely-typed escape hatc
+- Publication interlock: when Git is explicitly authorized for the lane, the coordinator stages only the bead's
+  scoped paths, commits with no agent attribution, pushes, records commit/push/CI evidence in `bd`, and keeps
+  the bead open until remote checks finish.
+- GitOps interlock: for Kubernetes/GitOps changes, completion requires dese-first validation from ArgoCD/read-only
+  cluster evidence, then prod and control sync/soak in the documented dependency order after dese is green. The
+  bead cannot close while dese/prod/control validation is missing, red, skipped without justification, or only
</file context>
Fix with cubic


prepare_commit_msg="$(git -C "$MCB_ROOT" rev-parse --git-path hooks/prepare-commit-msg)"
[ -f "$prepare_commit_msg" ] || fail "prepare-commit-msg hook is missing"
rg -q 'BD_ALLOW_AGENT_COMMIT_TRAILERS' "$prepare_commit_msg" \

@cubic-dev-ai cubic-dev-ai Bot Jul 29, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: The gate can report a valid prepare-commit-msg hook even when agent trailers run without BD_ALLOW_AGENT_COMMIT_TRAILERS=1, because it checks only string presence and not guard/delegation structure. Validate the installed hook's exact guarded block or its behavior with the variable unset, 0, and 1.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/context/validate-beads-policy.sh, line 42:

<comment>The gate can report a valid `prepare-commit-msg` hook even when agent trailers run without `BD_ALLOW_AGENT_COMMIT_TRAILERS=1`, because it checks only string presence and not guard/delegation structure. Validate the installed hook's exact guarded block or its behavior with the variable unset, `0`, and `1`.</comment>

<file context>
@@ -0,0 +1,63 @@
+
+prepare_commit_msg="$(git -C "$MCB_ROOT" rev-parse --git-path hooks/prepare-commit-msg)"
+[ -f "$prepare_commit_msg" ] || fail "prepare-commit-msg hook is missing"
+rg -q 'BD_ALLOW_AGENT_COMMIT_TRAILERS' "$prepare_commit_msg" \
+  || fail "prepare-commit-msg must guard agent trailers with BD_ALLOW_AGENT_COMMIT_TRAILERS"
+rg -q 'bd hooks run prepare-commit-msg' "$prepare_commit_msg" \
</file context>
Fix with cubic

|| fail "prepare-commit-msg must still delegate to bd when explicitly enabled"

scan_paths=()
for path in AGENTS.md makefiles docs/modules docs/developer .beads/config.yaml; do

@cubic-dev-ai cubic-dev-ai Bot Jul 29, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: Legacy beads guidance added to active onboarding or user documentation is not detected because those paths are omitted from scan_paths. Include all active documentation locations while explicitly excluding archival content.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/context/validate-beads-policy.sh, line 48:

<comment>Legacy beads guidance added to active onboarding or user documentation is not detected because those paths are omitted from `scan_paths`. Include all active documentation locations while explicitly excluding archival content.</comment>

<file context>
@@ -0,0 +1,63 @@
+  || fail "prepare-commit-msg must still delegate to bd when explicitly enabled"
+
+scan_paths=()
+for path in AGENTS.md makefiles docs/modules docs/developer .beads/config.yaml; do
+  [ -e "$path" ] && scan_paths+=("$path")
+done
</file context>
Fix with cubic

Comment thread scripts/lib/mcb.sh
@@ -93,15 +93,45 @@ mcb_guard() {
src=$(find "$MCB_ROOT/crates" -name '*.rs' -not -path '*/tests/*' -not -path '*/benches/*' -not -path '*/target/*' 2>/dev/null || true)

@cubic-dev-ai cubic-dev-ai Bot Jul 29, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: The claimed string/declaration exclusions both allow real banned calls through and still flag harmless literal text because they classify entire lines rather than matched tokens. A quote-aware or syntax-aware scan should remove literal/comment spans before searching executable code.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/lib/mcb.sh, line 104:

<comment>The claimed string/declaration exclusions both allow real banned calls through and still flag harmless literal text because they classify entire lines rather than matched tokens. A quote-aware or syntax-aware scan should remove literal/comment spans before searching executable code.</comment>

<file context>
@@ -93,15 +93,45 @@ mcb_guard() {
+  local guard_excludes='mcb-validate/src/|mcb-utils/src/constants/validate/'
+
   # 1. unwrap/expect/panic/todo/unimplemented in non-test .rs
+  # Exclude: doc comments (///, //!), const/static declarations, string literals.
   hits=$(grep -rnE '\b(unwrap|expect)\(|\bpanic!|\btodo!|\bunimplemented!' $src 2>/dev/null \
-      | grep -vE '//.*(unwrap|expect)|#\[cfg\(test\)\]' || true)
</file context>
Fix with cubic

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