Skip to content

fix(daemon): use the command head when the stash commit is not in the repo - #73

Open
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixdaemon-handle-missing-git-objects-in-86370a
Open

posthog[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixdaemon-handle-missing-git-objects-in-86370a

Conversation

@posthog

@posthog posthog Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Problem

  • One side effect failed for one user (CLI 2.2.0, Windows), so the daemon lost the attribution work for that git operation. The git command itself worked.
  • resolve_stash_create_head_for_event calls find_commit on the stash oid with ?. When the repo does not have that object, git cat-file -t exits 128 with "could not get object info", and the whole side effect fails at error level.
  • The repo still exists, so the vanished-repo guard from #67 does not catch it.
  • The error log does not name the git subcommand, so we cannot tell which caller failed.

Origin

  • Error tracking: issue
  • First signal: 2026-10-16
  • Inbox report: open
  • Likely cause: c2b5f87
  • Task started by: auto-start, after the report was rated P3 and ready to fix

Changes

  • New classifier is_missing_object_error: git exit 128 with "could not get object info" (current git) or "Not a valid object name" (older git).
  • The stash-create resolver now treats a missing stash commit as "not found". It logs at warn level and falls back to the command head that it already uses when no stash sha is present. Other errors still propagate.
  • log_side_effect_error adds a command field (the git subcommand, for example stash). The sentry layer forwards fields as event context, so the next failure names its caller.
Caller from the report Before After
resolve_stash_create_head_for_event ? fails the side effect, error level warn, falls back to command head
Chain walk in first_parent_commit_chain_exclusive All 4 callers already catch the error at debug level unchanged

Note

The chain walk cannot raise this error to ingest_trace_payload_fast, because every caller of attempt_materialize_commit_chain_authorship catches it at debug level. So I did not change it. If the error comes from a caller outside these two, the new command field will show it.

Testing

  • New unit tests: missing_object_error_detects_cat_file_failures and stash_create_head_uses_command_head_when_stash_commit_is_missing. The second test runs real git cat-file against a missing oid, so the classifier matches real git output.
  • cargo test --lib daemon::tests:: passes.
  • cargo test --test integration stash passes (74 tests, with CI=true to suppress the sandbox root-user warning).
  • cargo clippy --all-targets -- -D warnings and cargo fmt -- --check pass.
  • I did not run the full integration suite or the Windows and macOS jobs. CI covers them.

Agent context

  • Root cause of the missing object is still a hypothesis (dropped or garbage-collected stash commit, or a partial repo). The event has no data to confirm it.
  • I did not downgrade all missing-object errors in log_side_effect_error. That would also hide real bugs where the daemon asks for a wrong oid.

Created with PostHog Desktop from this inbox report.

🤖 Generated with Claude Code


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

… repo

The stash-create side effect looked up the stash commit with find_commit
and failed the whole side effect when git reported that the repository does
not have the object (cat-file -t exit 128, "could not get object info").
The repository still exists, so the vanished-repo guard does not apply.

The resolver now logs at warn level and falls back to the command head. The
side-effect error log also records the git subcommand, so the next failure
names its caller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Generated-By: PostHog Desktop
Task-Id: f0461f86-4b19-4c6d-87cc-1b3fbc72374b
@posthog
posthog Bot requested a review from sagnik11 October 16, 2026 06:07
@posthog
posthog Bot marked this pull request as ready for review October 16, 2026 06:25
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