Scope threat models to the current run instead of caching them on disk - #1178
Merged
Conversation
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
Greptile SummaryThe PR replaces the target-wide threat-model cache with scan-owned state while preserving that state across an interrupted scan.
Confidence Score: 5/5The PR appears safe to merge. The previously reported resume failure is resolved because threat models and amendments are now mirrored under the scan’s state directory and rehydrated when that scan resumes; no blocking failure remains. Important Files Changed
Reviews (2): Last reviewed commit: "Mirror the run's threat models into its ..." | Re-trigger Greptile |
Contributor
Author
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.
Summary
Threat models were persisted to
~/.strix/threat-models/<sha>.json, keyed by target identity rather than run id, so any later scan against the same host or checkout on the same machine read back a model an earlier run derived. This makes the model scan-scoped: it lives in memory for the run and is mirrored into that run's own state directory, exactly like the coverage ledger, so a resumed scan keeps the baseline its earlier agents agreed on while a new scan against the same target starts withfound: falseand derives its own.hydrate_threat_models_from_disk(state_dir)is called from the runner next to the todo/notes/coverage hydration, andsave/amendmirror under the same lock they mutate under (serialize + rename in one critical section, so a writer holding an older serialization cannot roll back a concurrent agent's amendment).Everything that only existed to keep a cross-run cache honest is gone:
_target_identityreturns just the identity now, noHEAD) and thestale/cached_revision/created_atresponse fields;_MAX_AGE_DAYS,_is_expired,_staleness).Target-identity normalization and
_snap_to_scan_targetstay: within one run agents still spell the same target several ways (handed URL, page under test, checkout path) and must converge on one document. A side effect of dropping revision pinning is that a commit mid-run no longer drops the model — covered by a test.Prompt and copy updates so agents and the UI no longer describe the model as cached across scans:
system_prompt.jinja,skills/coordination/root_agent.md, and the TUI/viewer renderers (empty state is now "No model derived for this target yet"; stale/revision rendering removed).Tests assert the three properties that matter: nothing lands outside the run (empty
$HOME), a resumed run in a fresh process reads back the model and its amendments, and a different run's state dir starts with no model.Link to Devin session: https://app.devin.ai/sessions/7e0f68d368e545da8d701d92009cc474