Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

ci(codeql): load local Rust models explicitly

AkitaOnRails2e69576497f7
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
index 4c98a69b..239e55fe 100644
--- a/.github/workflows/codeql.yml
+++ b/.github/workflows/codeql.yml
@@ -4,8 +4,8 @@ name: CodeQL
# results pass through .github/codeql/filter_test_alerts.py before upload, so
# the name-based Rust queries stop re-opening alerts on synthetic test
# fixtures. Languages, triggers and the weekly schedule match what default
-# setup ran. The model packs in .github/codeql/extensions still load
-# automatically.
+# setup ran. Rust runs the same code-scanning suite through the CLI so the
+# repository's local model pack is loaded explicitly.
on:
push:
@@ -43,18 +43,34 @@ jobs:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- - uses: github/codeql-action/init@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
+ - id: init
+ uses: github/codeql-action/init@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
- name: Build the macOS companion
if: matrix.language == 'swift'
run: swift build --package-path companions/ai-memory-macos
- - uses: github/codeql-action/analyze@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
+ - id: analyze
+ uses: github/codeql-action/analyze@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
with:
category: /language:${{ matrix.language }}
+ skip-queries: ${{ matrix.language == 'rust' }}
upload: never
output: sarif-results
+ - name: Analyze Rust with local models
+ if: matrix.language == 'rust'
+ env:
+ CODEQL_CLI: ${{ steps.init.outputs.codeql-path }}
+ CODEQL_DATABASE: ${{ fromJSON(steps.analyze.outputs.db-locations).rust }}
+ run: |
+ mkdir -p sarif-results
+ "$CODEQL_CLI" database analyze "$CODEQL_DATABASE" \
+ codeql/rust-queries:codeql-suites/rust-code-scanning.qls \
+ --additional-packs=.github/codeql/extensions \
+ --model-packs=akitaonrails/ai-memory-models \
+ --format=sarif-latest \
+ --output=sarif-results/rust.sarif
- name: Test the alert filter
run: python3 -I -m unittest discover -s .github/codeql
- name: Drop name-only alerts on test code
diff --git a/crates/ai-memory-cli/tests/suite/repo_layout.rs b/crates/ai-memory-cli/tests/suite/repo_layout.rs
index a0ef4d93..6feac79e 100644
--- a/crates/ai-memory-cli/tests/suite/repo_layout.rs
+++ b/crates/ai-memory-cli/tests/suite/repo_layout.rs
@@ -167,3 +167,27 @@ fn codeql_model_targets_exist() {
problems.join("\n")
);
}
+
+/// Advanced CodeQL setup does not reliably auto-load repository-local model
+/// packs. Keep the explicit Rust analysis path wired to the checked-in pack.
+#[test]
+fn codeql_workflow_loads_local_models() {
+ let workflow = fs::read_to_string(
+ crates_dir()
+ .parent()
+ .expect("crates/ lives in the repository root")
+ .join(".github/workflows/codeql.yml"),
+ )
+ .expect("read CodeQL workflow");
+ for required in [
+ "skip-queries: ${{ matrix.language == 'rust' }}",
+ "--additional-packs=.github/codeql/extensions",
+ "--model-packs=akitaonrails/ai-memory-models",
+ "codeql/rust-queries:codeql-suites/rust-code-scanning.qls",
+ ] {
+ assert!(
+ workflow.contains(required),
+ "CodeQL workflow omitted {required}"
+ );
+ }
+}