Repository navigation
fix(agent-discovery): save scan risk tags and reconcile statuses - #4324
Open
Anish Mehta (anishmehta24) wants to merge 1 commit into
Open
Anish Mehta (anishmehta24) wants to merge 1 commit into
Anish Mehta (anishmehta24) wants to merge 1 commit into
Conversation
The inventory only wrote to disk inside ingest(), so the risk tags that scan adds afterwards and the statuses that reconcile sets were never stored. scan printed "Inventory saved", but a later inventory command showed every agent as unknown with no risk. Add a public save() and call it at the end of scan and after reconcile. Signed-off-by: Anish Mehta <mehtaanish111@gmail.com>
Anish Mehta (anishmehta24)
requested review from
MohammadHaroonAbuomar,
liamcrumm and
Prayag (prayagupa)
as code owners
October 15, 2026 11:56
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
PR Review Summary
Verdict: AI review comments are untrusted advisory output. The summary reports workflow-generated completion status only, not model-authored pass/fail claims. |
|
🔴 Contributor Check: HIGH
Automated check by AGT Contributor Check. |
This branch has not been deployed
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.
Related Issue
None. Problem & Solution, Impact and Alternatives are filled in below.
Problem & Solution
Problem:
AgentInventoryonly writes to disk insideingest(),remove()andclear(). Thescancommand adds therisk_level/risk_scoretags afteringest(), andreconcilemarks agents REGISTERED or SHADOW in memory only, so neither reaches the stored inventory.scanprints "Inventory saved to ..." but the file has no risk tags, andagent-discovery inventoryafterwards shows every agent asunknown.Solution: add a public
AgentInventory.save()and call it at the end ofscanand right afterreconcile.Impact on Your Work
After
scanand thenreconcile --registry-file ...(which printed Registered: 1, Shadow: 2),agent-discovery inventory -o summarystill reported all three agents as unknown, so the inventory couldn't be used to track which agents were registered.Timeline
None
Alternatives Considered
Having
Reconciler.reconcile()save the inventory itself. I kept the save in the CLI, which already owns the storage path, so the library classes stay side-effect free.Type of Change
Package(s) Affected
Governance & security:
Testing
Unit Testing
test_scan_and_reconcile_save_resultsintests/test_cli.pyrunsscanand thenreconcilewithCliRunnerand reloads the inventory from disk after each step. It fails on main (norisk_leveltag, statusunknown) and passes with the change. The agent-discovery suite passes (58 tests).Manual Testing
Ran
scanandreconcilefrom the CLI and checked the stored JSON before and after the change.Checklist
Attribution & Prior Art
Prior art / related projects (if any):
AI Assistance
If AI tools materially shaped this change, briefly note what was used:
Claude Code helped find the bug and draft the fix and test. I reviewed the change and ran the tests.
IP, Patents, and Licensing