Skip to content

fix(coding-agents): stop unsafe gitlog cleanup - #3879

Open
r266-tech wants to merge 1 commit into
vectorize-io:mainfrom
r266-tech:fix/coding-agents-safe-gitlog-cleanup
Open

fix(coding-agents): stop unsafe gitlog cleanup#3879
r266-tech wants to merge 1 commit into
vectorize-io:mainfrom
r266-tech:fix/coding-agents-safe-gitlog-cleanup

Conversation

@r266-tech

Copy link
Copy Markdown
Contributor

Summary

  • stop coding-agents from enumerating and deleting bank-wide source:git-log documents during sync
  • make every internal multi-tag strategy probe use all_strict, while preserving listDocumentIds()'s existing public default
  • treat a git-log snapshot as current only when the current-HEAD query contains this repository's canonical document; otherwise perform an idempotent upsert

Fixes #3877.

Why

The document listing endpoint can include untagged documents for the legacy inclusive all mode. The old deepen path then treated every returned non-canonical document as stale and deleted it. Because document deletion cascades to facts, a routine coding-agents sync could remove unrelated memories from a shared bank.

This change removes that destructive cleanup entirely. Git-log sync now owns only its canonical document and never deletes other document IDs.

Compatibility and remaining limitation

The optional tags_match parameter defaults to all, matching the existing client behavior for external callers. Coding-agents' internal strategy checks opt into all_strict explicitly.

Canonical git-log IDs remain gitlog:<repoName> for backward compatibility. Consequently, unrelated same-named repositories or forks can still share that legacy ID; changing the namespace safely requires a separate ownership/migration design. This patch prevents cross-document deletion but does not attempt that migration.

Validation

  • npx tsc --noEmit
  • npx vitest run src/core/hindsight.test.ts src/core/git.gitlog.test.ts src/core/status.test.ts src/core/session-start.test.ts (69 tests)
  • npm test (663 tests)
  • npm run build
  • git diff --check

The repository-wide lint hook could not load the control-plane @eslint/js dependency from this sparse worktree; the package typecheck, complete test suite, build, and diff checks pass.

@strix-security

strix-security Bot commented Aug 29, 2026

Copy link
Copy Markdown

Strix Security Review

Warning

This pull request has 1 commit after the last Strix review (c4c9524). Strix has not reviewed these changes.
Automatic review on push is off for this repository. To review the latest changes, tag @strix-security in a comment, or turn on re-review on push.

No security issues found.

Updated for c4c9524.


Reviewed by Strix
Re-run review · Configure security review settings

@r266-tech
r266-tech force-pushed the fix/coding-agents-safe-gitlog-cleanup branch from c4c9524 to 762a6f8 Compare August 29, 2026 16:57

@koriyoshi2041 koriyoshi2041 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified at 762a6f8. The destructive bank-wide cleanup is gone, internal tag probes use strict matching, and the current-HEAD check now requires this repository's canonical document ID. I also ran the 69 focused tests, TypeScript typecheck, package build, and diff hygiene successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document tag filter returns untagged documents; coding-agents gitlog sweep then deletes them and ON DELETE CASCADE wipes their facts

2 participants