feat(ai): skip already-shipped agent activity via a local cursor#1261
Draft
amascia-gg wants to merge 2 commits into
Draft
feat(ai): skip already-shipped agent activity via a local cursor#1261amascia-gg wants to merge 2 commits into
amascia-gg wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## amascia/agent-activity-metadata #1261 +/- ##
==================================================================
Coverage ? 93.38%
==================================================================
Files ? 190
Lines ? 10700
Branches ? 0
==================================================================
Hits ? 9992
Misses ? 708
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Ship full AI-agent session activity to GitGuardian, not just MCP tool calls. ggshield discovers each agent's on-disk transcripts / databases and sends the raw records verbatim; GitGuardian scans them and strips secrets server-side before storing them, so the client stays "dumb" and the data shape never depends on the ggshield version. Sources cover Claude Code, Codex, Cursor, Copilot CLI and VSCode (Copilot Chat). Records are batched (by count and by bytes) and posted to the agent-activity endpoint; the server deduplicates per record. Issue: NHI-1628 Co-Authored-By: Paul Beslin <paul.beslin-ext@gitguardian.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
44898bb to
a29f94b
Compare
`ggshield ai discover --history` re-read every agent transcript on each run and re-sent every record (which the server then re-scans and deduplicates). It now keeps a per-source high-water mark in a JSON cursor file under the cache dir, so append-only transcripts only ship records added since the last run. - Cursor is scoped to the (instance, API key) pair; the raw key is never stored. - Best-effort and fail-open: a missing/corrupt/unwritable cursor just causes a full re-scan (the server deduplicates), never incorrect data. Delete the file to force one. - A source's mark only advances over the contiguous successfully-ingested prefix; a failed batch freezes its sources so the next run resends the gap. - Only append-only JSONL transcripts resume; database-backed sources (Cursor) keep full re-scan, since rows are edited in place. Issue: NHI-1628 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
650e508 to
4ebdff6
Compare
1170e1f to
52f4a66
Compare
e6d19e6 to
e3443bb
Compare
f44db2d to
96484ae
Compare
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.
What
Stacked on #1259.
ggshield ai discover --historyre-read every agent transcript on each run and re-sent every record (which GitGuardian then re-scans and deduplicates server-side). This adds a local cursor so append-only transcripts only ship records added since the last run.How
agent_activity_cursors.json) holds a per-source line-index high-water mark, keyedscope → agent → source_kind → source_path.sha256(base_uri + api_key)[:16]— switching instance/credential starts clean; the raw key is never stored.supports_resume=True); database-backed sources (Cursorstate.vscdb) keep full re-scan, since rows are edited in place.Tests
test_cursors.py(store: roundtrip, scope isolation, never-backwards, fail-open load/save) and resume tests intest_sources.py/test_orchestrator.py(advance-on-success, freeze-on-failure-gap, non-resumable-not-tracked, plus a real-chain integration test: Claude source + cursor across two runs ships only the appended line).cursors.pyandorchestrator.pyat 100% line coverage; 409 AI tests pass.🤖 Generated with Claude Code