Skip to content

_remember_handoff_is_tracked folds a git command failure into the permissive (untracked) branch #760

Closed

Description

@fdaviddpt

Filed while curating trap.d/721.git-command-failure-reads-as-untracked.md, an oss:auditor
finding from the #720/#721 review, ranked misreports/non-blocking and logged rather than fixed.
Still present at HEAD, scripts/session-start-hook.sh's _remember_handoff_is_tracked:

Both the exact-case check (git ls-files --error-unmatch ... guarded by >/dev/null 2>&1) and
the case-insensitive fallback (git ls-files -z ... guarded by 2>/dev/null, falling through to
return 1 on no match) collapse "git said not tracked" and "git could not answer at all" into
the same observable outcome: the function returns 1 (untracked), and the caller delivers the
handoff as trusted.

A transient git failure (corrupt object, interrupted process, repository mid-gc, any non-zero
exit for a reason other than "no match") is silently read as "safe to deliver" rather than "could
not determine, so refuse or say so" -- the permissive branch is reached on both a clean negative
and an error, which is the wrong-direction default for a security check.

This repo already has a considered three-state model for the identical hazard, in a different
file: scripts/lib-case-divergence.sh's REMEMBER_CASE_STATUS (ok / diverged /
unavailable), whose header comment states outright: "An absence produced by this check must
never read as agreement; that conflation is this repo's recurring defect (#296, #299, and the
0.12.0 entry's 'three states, not two')." _remember_handoff_is_tracked does not follow that
precedent yet.

Candidate fix: give _remember_handoff_is_tracked its own ok/tracked/unavailable states
mirroring lib-case-divergence.sh's shape, with unavailable routing to "refuse the delivery
and say why" rather than "deliver".

[AI-generated]

Activity

  1. added
    priority:low
    filed-by-loop
    lane-other
    on Sep 25, 2026
  2. added a commit that references this issue on Sep 25, 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

    filed-by-looplane-otherpriority:low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions