Skip to content

fix(daemon): skip carryover capture for non-repository worktrees - #57

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixdaemon-skip-carryover-capture-when-34bc64
Draft

posthog[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixdaemon-skip-carryover-capture-when-34bc64

Conversation

@posthog

@posthog posthog Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Problem

  • The daemon files its own exceptions into error tracking — self-inflicted noise aimed at the team, no end user affected.
  • capture_carryover_snapshot_for_command resolves a repo from the traced command's worktree hint. When that hint is a temporary, non-repository directory (e.g. a skills-publish scratch dir under /private/tmp), discovery returns AutterError::Generic("No git repository found for path without exec").
  • That Generic error is logged as a tracing::error! → one $exception per occurrence. The benign-race guard is_missing_working_dir_error only matches GitCliError exit 128 and IoError not-found, so the Generic error slips past it.
  • This is a recurring class: the same stage=repo_discovery shape recurs across several git subcommands (ls-remote, add, commit, credential, config, git-remote-https, worktree), and each new subcommand opens a fresh error-tracking issue for someone to triage.

Changes

  • Treat "no repository at the worktree hint" as a benign no-snapshot case: carryover capture returns Ok(None) instead of reporting an error.
  • Add is_no_repository_discovered_error in git/repository.rs to classify the discovery outcome, backed by a shared message-prefix constant so the producer and the classifier cannot drift.
  • Keep every real capture failure reporting exactly as before — bad heads, tracked-file reads, and other discovery faults (e.g. an unreadable git config) still surface.
let repo = match discover_repository_in_path_no_git_exec(input.worktree) {
    Ok(repo) => repo,
    Err(error) if is_no_repository_discovered_error(&error) => return Ok(None),
    Err(error) => return Err(with_stage("repo_discovery", error)),
};

Tests

  • carryover_capture_in_non_repository_worktree_returns_no_snapshot — a commit traced in a temp non-repo dir returns Ok(None), not an error.
  • discovery_in_non_repository_path_is_recognised_as_benign — discovery on a non-repo dir is classified benign.
  • other_errors_are_not_recognised_as_no_repository — a different Generic fault and an IoError are not misclassified.

Why

Repo discovery over a temporary, non-repository directory is a normal, expected outcome — there is simply no carryover state to snapshot. Reporting it as an exception pollutes error tracking and spawns a new issue for each git subcommand, without any user-facing failure to fix.


Created with PostHog Desktop from this inbox report.

Carryover snapshot capture ran repo discovery on the traced command's
worktree hint. When that hint is a temporary, non-repository directory,
discovery returns a Generic "no repository found" error that the daemon
logged as an exception, filing self-inflicted noise into error tracking.

Treat "no repository found" as a benign no-snapshot case: return Ok(None)
instead of reporting. Real discovery faults still surface.

Add is_no_repository_discovered_error to classify the discovery outcome,
and reuse the message via a shared prefix constant.

Generated-By: PostHog Desktop
Task-Id: 83371094-8d8a-4a81-8bdc-6f06020f7127
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