Skip to content

Tolerate a missing reflog end cut in trace normalizer - #53

Merged
sagnik11 merged 1 commit into
mainfrom
posthog-self-driving/fixdaemon-tolerate-missing-reflog-end-d14b5f
Aug 21, 2026
Merged

Tolerate a missing reflog end cut in trace normalizer#53
sagnik11 merged 1 commit into
mainfrom
posthog-self-driving/fixdaemon-tolerate-missing-reflog-end-d14b5f

Conversation

@posthog

@posthog posthog Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Problem

  • A checkout in a temp repo lost its trace attribution entirely: the daemon reported "trace ingest error" and dropped the command.
  • finalize_root_exit in src/daemon/trace_normalizer.rs needs a reflog end cut to work out which refs a mutating command touched. When the cut is absent, the only tolerated commands are clone and init — every other command hit a hard AutterError::Generic.
  • The temp repo (family=/tmp/backend-plugin-*/.git) was most likely cleaned up before the exit hook delivered its end cut. The family key is still recoverable from the worktree, so the code entered the mutation branch with no cuts and errored instead of degrading.
  • The branch rejects any mutating command that loses its end cut — the same temp-repo race can recur on commit, merge, rebase, and others.

Changes

  • Treat a missing reflog end cut as a benign race: keep Confidence::Low, log a warning, and still emit the normalized command — rather than failing the whole ingest.
  • This mirrors the existing precedent for a vanished working directory (is_missing_working_dir_error, src/daemon.rs).
  • Add a test: a checkout with no reflog end cut normalizes to a family-scoped command at low confidence.

Testing

  • cargo test --lib trace_normalizer — 20 passed.
  • cargo build — clean.

Created with PostHog Desktop from this inbox report.

A mutating git command whose reflog end cut never arrives no longer fails
the whole trace ingest. This happens when a temp repo is cleaned up before
the exit hook delivers its cut. The family key stays recoverable from the
worktree, so the command now records with low confidence instead of hitting
a hard error in finalize_root_exit.

This mirrors how the daemon already tolerates a working directory that
vanished mid-operation (is_missing_working_dir_error).

Generated-By: PostHog Desktop
Task-Id: fb1ea41b-8b9e-406e-bff5-0b25f963e123
@sagnik11
sagnik11 marked this pull request as ready for review August 21, 2026 12:04
@sagnik11
sagnik11 merged commit 5ee18df into main Aug 21, 2026
1 check passed
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.

1 participant