Repository navigation
Preflight v2: correlate preflight with recorded sessions via workspace digest (schema 1.3.0) - #526
Merged
Merged
Conversation
…digest Step 3 of preflight v2, privacy-preserving by construction. Hooks now compute workspace_sha256, the SHA-256 of the normalized absolute cwd, in-process before anything crosses the wire; the canonical event schema bump is additive (1.2.0 to 1.3.0, optional field, older events simply lack it). The workspace path itself is never stored or sent. `scan --preflight PATH --with-trail` joins the static report with the recorder's trail: it matches sessions by workspace digest and reports aggregate counts only (events, sessions, first/last timestamps, and the detection rule names that fired in those sessions). Event contents, commands and arguments are never read into the report. Touches both sides deliberately and is reviewable as one unit: hook (agentmetry/hooks/ingest.py map_hook), ingest model (ExternalIngestBody), canonical mapping (canonical.py outbox path, external.py adapter path), schema doc, and the new scanner correlate module. Detection-frozen files are untouched, so the ruleset fingerprint does not move. Note: the live recorder emits workspace_sha256 only after it is upgraded to a release carrying this change; until then --with-trail reports zero matched sessions. Tests: 303 pass across scanner, ingest, roundtrip and audit suites; ruff clean. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <[email protected]>
blitzcrieg1
force-pushed
the
feat/preflight-trail-correlation
branch
from
November 28, 2026 19:51
a13a47e to
720c94b
Compare
blitzcrieg1
added a commit
that referenced
this pull request
Nov 28, 2026
Preflight v2 ships as one release: preflight follows referenced scripts (#524), a read-only GitHub preflight at a pinned commit (#525), and preflight correlation with recorded sessions (#526). The canonical event schema moves to 1.3.0 with the additive workspace_sha256 field. Version and changelog move together per the version provenance tests. Generated by Mistral Vibe. Co-authored-by: Mistral Vibe <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 3 of preflight v2: join the static report with what the recorder observed, without ever storing the workspace path.
Recorder side (additive schema 1.2.0 to 1.3.0): hooks compute
workspace_sha256(SHA-256 of the normalized absolute cwd) in-process inmap_hook, before hashing;ExternalIngestBodydeclares the field;canonical.py(outbox path) andexternal.py(adapter path) pass it through as an optional event field. Older events simply lack it; 1.2.0 consumers ignore the unknown key per the documented additive rule. The path itself is never sent, stored, or printed.Scanner side:
agentmetry scan --preflight PATH --with-trailmatches recorded sessions by workspace digest and reports aggregate counts only: events, sessions, first/last timestamps, and detection rule names that fired in those sessions. Event contents, commands and arguments are never read into the report. Read-only SQLite (mode=ro).This is the blue-team view: what was declared at open versus what actually ran in that workspace.
Verification: 303 tests pass across scanner, ingest, roundtrip, audit, atlas, identity, sentinel suites (incl. new hook test asserting the path string never appears in the payload, and a roundtrip test asserting the digest survives the HTTP model); ruff clean; collected count 3150 (README updated). Detection-frozen files untouched, ruleset fingerprint unmoved.
Note: the live recorder emits
workspace_sha256only after upgrading to a release with this change; until then--with-trailreports zero matched sessions on existing trails. Stacks on #524 and #525.