Skip to content

fix(backup): don't stage targets for skipped missing-source items - #29

Merged
k9ert merged 1 commit into
mainfrom
kn/argit-skip-missing-targets
Jun 10, 2026
Merged

fix(backup): don't stage targets for skipped missing-source items#29
k9ert merged 1 commit into
mainfrom
kn/argit-skip-missing-targets

Conversation

@k9ert

@k9ert k9ert commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Problem

argit backup aborts with:

git add failed: fatal: pathspec 'hermes/data/scripts/' did not match any files

_git_commit staged it.target for every non-secret manifest item, including items whose source was absent on the agent and therefore skipped during the copy phase (§4–7). The destination was never written, so git add failed and took down the whole backup.

This triggers whenever the running agent lacks a path the bundled manifest declares — e.g. the hermes-2026.5.4-1 manifest declares scripts/, whatsapp/, memory_store.db, workspace/, but a 2026.5.7 Hermes build doesn't create them. Found while wiring argit into Hermes provisioning (bot-provisioning-poc#12) — the systemd backup unit failed on first run and left a .argit/in-progress marker that blocked every retry.

Fix

Stage only targets that actually exist on disk after the copy phase:

if it.target and (repo_root / it.target).exists():
    paths_to_add.append(it.target)

General and version-agnostic — a manifest will never perfectly match every Hermes patch release, so backup should tolerate declared-but-absent paths (it already logs and skips them during copy; this aligns staging with that).

Test

Adds test_git_commit_skips_items_with_missing_target to tests/unit/test_backup_review_staging.py — a present-target item is staged, a missing-target item is not. Full unit suite green.

🤖 Generated with Claude Code

_git_commit appended it.target to the git-add list for every non-secret
manifest item, even when the item's source was absent and therefore skipped
during copy (§4-7). The target was never written, so `git add` aborted the
whole backup with `pathspec '<target>' did not match any files`.

This bites any time the live agent lacks a path the bundled manifest declares
— e.g. a hermes-2026.5.4 manifest against a 2026.5.7 Hermes build that has no
~/.hermes/scripts/ or whatsapp/. Stage only targets that actually exist on
disk after the copy phase.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@k9ert
k9ert merged commit 4b3777c into main Jun 10, 2026
2 of 3 checks 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.

2 participants