Skip to content

Name a missing Base branch as the Cause of a Security run's pre-audit failure #1055

Closed

Description

@JacobStephens2

This was generated by AI during triage.

A Security run that fails because its Base branch is missing sends a Run notification whose only Cause is pre-audit checks failed. The real cause, a Base branch the command named that does not exist, is a configuration mistake with nothing private in it. The email should say so.

Observed incident

On 2026-10-22 at 03:44:11 UTC, host stephens sent [thirdshift] JacobStephens2/thereish Security run: pre-audit failed with Audit: not started, Cause: pre-audit checks failed, Took: 0s. The thereish cron entry still read thirdshift secure base main from a crontab saved at 03:43:39, but the repository's branch is master. At 03:44:12, ~/.thirdshift/logs/cron.log shows base branch main does not exist on origin or locally; create or obtain that branch first, or select a valid Base branch. The same error repeated at 03:45:02 and 03:45:12. The crontab was corrected at 03:45:46, and thereish's 03:46 Security run started normally.

Diagnosing it meant correlating interleaved, unattributed stderr lines in the shared cron log with journald crontab edits. The email alone gave no hint.

Source verification

The Security run's pre-audit stage calls the Pass launch, which calls LaunchDirectory::prepare_base_branch before command logging starts. When the audit never started, ending accounting takes the notification's Cause from operational_cause, which classifies only GitHub failures (GitHub dependency failure / GitHub rate-limit exhaustion). Every other pre-audit error falls back to pre-audit checks failed. #740 deliberately limits the Cause to fixed categories so that raw diagnostics never reach email. This issue keeps that rule and adds fixed categories.

This was generated by AI during triage.

Agent Brief

Category: enhancement
Summary: Give Base-branch preflight failures of a Security run a fixed, safe Cause in its Run notification instead of the generic fallback.

Current behavior:
When a Security run fails before its audit starts, the Run notification shows Result: pre-audit failed, Audit: not started, and a Cause. Only GitHub dependency failures get a specific Cause. A failure of Base branch preparation (the named branch missing on origin and locally, the branch present locally but not pushed, a detached HEAD with no branch named, or a local Base branch with commits origin lacks) shows Cause: pre-audit checks failed. That gives the reader nothing to act on.

Desired behavior:
A Base-branch preparation failure in a Security run's pre-audit stage gets a fixed Cause that names the category. For example, Base branch not found for a branch missing everywhere, and suitable fixed wording for the other Base-branch preparation failures (one shared category is acceptable if it is still clearly about the Base branch). The Cause must be a fixed string chosen by error type, not the raw error text. It is acceptable, but not required, to include the Base branch name the command itself supplied, since that came from the user's own command line and not from a provider. GitHub categories keep their current wording. Unclassified pre-audit failures keep the generic fallback. Subject, Result, Audit and the diagnostic-route line are unchanged.

Key interfaces:

  • LaunchDirectory::prepare_base_branch failures - make them identifiable by type (e.g. a typed error that the classifier can downcast), not by matching message text.
  • The pre-audit Cause classifier used by run_ending::read (currently github::operational_cause with a pre-audit checks failed fallback) - extend it with the Base-branch category or categories, keeping it &'static str.
  • The Security run scenario tests that already assert pre-audit notifications (review_acquisition_failure_is_pre_audit, the GitHub-dependency scenarios) - follow their fake-Resend pattern.

Acceptance criteria:

  • A fake-Resend scenario running secure base <missing-branch> email ... exits nonzero, starts no audit session, and sends exactly one notification with Result: pre-audit failed, Audit: not started, and the fixed Base-branch-not-found Cause.
  • At least one other Base-branch preparation failure (e.g. branch present locally but absent on origin) gets a Base-branch Cause, not pre-audit checks failed.
  • Existing GitHub pre-audit scenarios still report GitHub dependency failure / GitHub rate-limit exhaustion unchanged.
  • An unclassified pre-audit failure (e.g. the existing review-acquisition scenario) still reports pre-audit checks failed.
  • No raw error text, stderr, or provider diagnostics reach the notification beyond the fixed strings (and optionally the command's own Base branch name).

Out of scope:

Activity

  1. added
    enhancement
    ready-for-agent
    in-progress
    and removed
    ready-for-agent
    on Oct 22, 2026
  2. removed
    in-progress
    on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions