Skip to content

Widen vanished-working-dir guard to silence self-check race noise - #52

Merged
sagnik11 merged 1 commit into
mainfrom
posthog-self-driving/fixdaemon-widen-vanished-working-dir-110814
Aug 19, 2026
Merged

Widen vanished-working-dir guard to silence self-check race noise#52
sagnik11 merged 1 commit into
mainfrom
posthog-self-driving/fixdaemon-widen-vanished-working-dir-110814

Conversation

@posthog

@posthog posthog Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Problem

  • autter doctor's self-check emits self-inflicted error-tracking noise: it deletes its diagnostic scratch repo while daemon side effects can still be in flight, and the guard meant to swallow that race missed two of its shapes.
  • The scratch repo lives under ~/.autter/internal/debug-self-checks/, so no user data or attribution is at risk. The cost is signal quality — every autter doctor run can add another false exception that buries the real daemon side-effect failures we want to see.
  • is_missing_working_dir_error (src/daemon.rs) only matched exit-128 git errors whose stderr contained No such file or directory. The vanished directory surfaces in three shapes, not one.
Shape Where Matched before
fatal: cannot change to '...': No such file or directory git exit 128 yes
fatal: not a git repository (or any of the parent directories) git exit 128 no
IO error: The system cannot find the path specified. (os error 3) IoError, not GitCliError (Windows) no

Changes

  • Widen the benign-race guard to also treat exit-128 not a git repository and any IoError with ErrorKind::NotFound as the same vanished-directory race, so the daemon skips the side effect quietly instead of reporting an exception.
  • Add unit tests for both new shapes and a negative case (an IoError with PermissionDenied is still a real fault).

Scope note

This addresses the reported symptom (the guard misses two of the three ways the vanished-dir race appears). The report also mentions two optional hardenings — waiting for the daemon family to go quiet before remove_dir_all, or suppressing telemetry for debug_self_check_root() paths. Those are not included; the guard widening is the root-cause fix the report identifies as sufficient.

Testing

  • No Rust toolchain is available in this environment, so task test / task lint / task fmt were not run. Please run them in CI. The added tests are missing_working_dir_error_detects_exit_128_not_a_git_repository, missing_working_dir_error_detects_io_not_found, and the extended missing_working_dir_error_ignores_other_git_failures.

Created with PostHog Desktop from this inbox report.

The daemon guard `is_missing_working_dir_error` only matched exit-128 git
errors whose stderr contained "No such file or directory". When `autter
doctor` deletes its diagnostic scratch repo while a daemon side effect is
still in flight, git often reports "not a git repository" instead, and on
Windows the read fails first as an IoError with a not-found kind. Both
slipped through and were reported as async side-effect exceptions, which is
self-inflicted error-tracking noise from a throwaway repo we created and
deleted ourselves.

Widen the guard to also treat exit-128 "not a git repository" and any
IoError with `ErrorKind::NotFound` as the same benign vanished-directory
race.

Generated-By: PostHog Desktop
Task-Id: 47985953-a2e0-4ee9-be0f-7060ed7ab133
@sagnik11
sagnik11 marked this pull request as ready for review August 19, 2026 18:01
@sagnik11
sagnik11 merged commit e32aae6 into main Aug 19, 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