Experience
Projects
My Stack
Case studies
Contact me
Open my CV

·5 min read

My task check said nothing happened, but git evidence was failing silently

DailyBrief's task check could say "no activity" about a card whose repo had moved on. Reading the code, I found four ways it could happen: the commits sat on another branch, the baseline sha it compared against had been amended away, the folder had moved, and the first failing git log took the whole task's evidence down with it. None of them showed an error.

Project
DailyBrief
Date
Oct 2026
Stack
PowerShell 5.1, git, Electron
Commit
4511fe7

What the check was supposed to see

DailyBrief links each kanban card to a project folder. A check run builds a digest per task: which files changed, which commits landed, what is uncommitted. That digest goes to the model, which writes a note or, with enough evidence, marks the card done. The model is only as good as the digest, and the digest only as good as the git calls behind it.

The old code was short. For a linked git folder it took the head sha stored at the last scan and ran:

powershell
$range = [string]$scan.head + '..HEAD'
$newCommits = @(git -C $sdir log --oneline $range 2>$null | Select-Object -First 10 | ForEach-Object { [string]$_ })

That looks fine until you list what it assumes. HEAD is the branch where the work happens. The stored sha still exists. The folder is where it was. And "since the last check" is the right window for deciding that a task is finished. All four were wrong in practice.

Four ways the range lied

Other branches are invisible. <sha>..HEAD only walks the checked-out branch. DailyBrief's execute mode commits on a dailybrief/<id> branch, and any feature branch is the same. Commits there never appeared. The new code asks for --branches --source and labels a commit with its branch only when it is not the current one, because the label costs tokens on every line.

A rewritten baseline fails forever. After an amend, rebase or reset the stored sha no longer exists, and sha..HEAD fails. With 2>$null nothing is reported; the task just stops collecting evidence. The window now checks the sha first with git cat-file -e <sha>^{commit}. If it is gone, only the baseline's timestamp (--since) bounds the window.

PowerShell 5.1 turns stderr into an exception. This was the nastiest one. With $ErrorActionPreference = 'Stop', PS 5.1 treats any stderr line from a native command as a terminating error, even when you redirect it. One "unknown revision" from a rewritten baseline threw away the task's entire scanDiff. So git now runs behind one wrapper, and the exit code is the only success signal:

powershell
function Invoke-Git([string]$dir, [string[]]$gitArgs) {
    $ErrorActionPreference = 'Continue'
    $out = @(& git -C $dir @gitArgs 2>$null)
    $script:gitExit = $LASTEXITCODE
    return @($out | ForEach-Object { [string]$_ })
}

Noise pushes out signal. A build commit rewriting 50 files under dist\ used to fill the capped list, so the one real source file was cut. Noise is now dropped per commit before anything is capped, and a commit that touched only generated files is skipped entirely.

Why the time bound stays even with a sha

It is tempting to use --branches --not <sha> and drop the date when the sha is valid. The code comment records why not: the baseline only covers the history of the branch it was taken on, so every commit of an old unmerged branch would count as new, forever. The time bound therefore applies in both modes:

powershell
$logArgs = @('log', '--branches', '--source', '-n', '200', '--name-only', '--relative',
             '--date=format:%Y-%m-%d %H:%M', '--format=%x1e%H%x1f%h %ad %s%x1f%S') + $rangeArgs
if ($negArgs.Count -gt 0) { $logArgs += @('--not') + $negArgs }
$logArgs += @('--', '.')

The trailing -- . with --relative matters for a task linked to app\ inside a bigger repo: it must not see commits that only touched sibling folders.

Two baselines instead of one

The second design bug was in what "since" meant. The baseline moved after every check that touched the task. A task finished over several days therefore never showed enough at once to be closed: each check saw only the last slice. scan-folder.ps1 now stores two points in one file. head/scannedAt move on every check and feed the notes. linkedHead/linkedAt are set once, when the task gets its folder, and feed the done decision and subtask ticks. Older scan files are upgraded by treating their current head as the link point, the oldest baseline they still remember.

The prompt changed to match: scanDiff is "since the last check", sinceLinked is cumulative, and an open subtask can be ticked only if it carries its own evidence in the digest. The script ignores ticks for anything else.

Projects move

The last case was a folder moving from OneDrive\Desktop to another drive. A task pointing at the old path collected no evidence and said nothing. Now the check looks for the moved folder by its leaf name, to depth 3 under the work roots and skipping node_modules, vendor, dist and similar, and proves it is the same repo by root commit and subpath (git rev-list --max-parents=0 HEAD). If exactly one candidate qualifies, the task is relinked and the scan file keeps its baselines, since the shas are still valid. Zero or several candidates means no guess: the card gets a "linked folder missing" warning, shown once, not on every check.

Testing it without a model

The commit adds -DigestOnly: build and write the digest, then stop, with no model call and no write to kanban.json or scans\. A relink is only reported as "would relink". scripts/fixture-git-check.ps1 (256 lines in this commit) uses it to build throwaway repos and check the digest directly.

What I took from it

The model was never the weak part; it answered honestly from a digest that said nothing happened. When an automated check reports "no activity", the first thing to verify is whether the evidence collector can fail without saying so. Mine could, in four separate ways, and every one of them looked like a quiet week.

#powershell#git#debugging#electron

Keep reading

Have a project in mind?