Skip to content

fix: treat missing git objects as a benign teardown race in the daemon - #64

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixdaemon-treat-missing-git-objects-as-d20598
Draft

posthog[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixdaemon-treat-missing-git-objects-as-d20598

Conversation

@posthog

@posthog posthog Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Problem

  • Hits the team, not users: a temp-repo teardown race opens a fresh single-occurrence error-tracking issue that costs triage time. Attribution is never broken — the side effect is skipped either way.
  • The snapshot side effect committed_file_snapshot_between_commits runs ls-tree -r -z --name-only <tree oid>. Commit::tree trusts the loose-object fast reader and checks only the oid's shape, never its existence, so a vanished object reaches git as a normal argument.
  • When a temp repo is torn down mid-operation, its directory can survive while its objects are gone. git then answers fatal: not a tree object (exit 128).
  • The daemon guard is_missing_working_dir_error matched only No such file or directory and not a git repository, so this shape slipped past it, hit tracing::error!, and SentryLayer turned the ERROR into an exception.

Changes

  • Widen is_missing_working_dir_error in src/daemon.rs to also treat the missing-object exit-128 stderr strings as the same benign race, so the side effect skips quietly at debug level:
 stderr.contains("No such file or directory")
     || stderr.contains("not a git repository")
+    || stderr.contains("not a tree object")
+    || stderr.contains("bad object")
+    || stderr.contains("unknown revision")
  • Update the doc comment to describe the missing-object shape.
  • Add a unit test covering the three new stderr strings; the existing "ignores other git failures" test still passes (not a valid object name matches none of the new substrings).

Expected impact

  • Baseline is 1 occurrence over 60 days for this exact message, and 0 after the fix, since the guard swallows the whole class.
  • No user-facing metric should move. The real gain is that no further single-occurrence issue opens from temp-repo teardown.

Testing

  • The sandbox has no Rust toolchain, so the build and test suite could not run locally. CI validates them. The change is a contained classifier widening plus a unit test.

Created with PostHog Desktop from this inbox report.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Widen is_missing_working_dir_error to match the missing-object exit-128
stderr strings ("not a tree object", "bad object", "unknown revision").

A snapshot side effect passes a tree oid to `ls-tree` in
committed_file_snapshot_between_commits. When a temp repo is torn down
mid-operation its directory can survive while its objects are gone, so
git answers "fatal: not a tree object". The old classifier matched only
"No such file or directory" and "not a git repository", so this shape
slipped past the guard, hit tracing::error!, and SentryLayer turned it
into a fresh error-tracking issue for a benign race. The side effect is
skipped either way, so the daemon now skips it quietly at debug level.

Generated-By: PostHog Desktop
Task-Id: c4d492f8-b2ae-45e7-ba2b-52ef0fe09bdd
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.

0 participants