task.py archive commit sweeps unrelated edits from other archived tasks
Summary
task.py archive sweeps unrelated edits from other archived tasks into its chore(task): archive <name> commit. With a task name, safe_archive_paths_to_add still stages the whole archive root (.trellis/tasks/archive) instead of only the task that was just archived, so the pathspec-scoped commit added for #579 still includes them.
Reproduction (main @ e77ae89)
python3 .trellis/scripts/task.py archive 09-23-other # auto-commits
echo "unrelated note" >> .trellis/tasks/archive/2026-09/09-23-other/prd.md # unstaged edit
python3 .trellis/scripts/task.py create "Second" --slug second --assignee alice --description second
git add .trellis/tasks/09-23-second && git commit -m "add second"
python3 .trellis/scripts/task.py archive 09-23-second
git show --stat HEADActual:
chore(task): archive 09-23-second
.trellis/tasks/archive/2026-09/09-23-other/prd.md | 1 +
.trellis/tasks/{ => archive/2026-09}/09-23-second/prd.md | 0
.trellis/tasks/{ => archive/2026-09}/09-23-second/task.json | 4 ++--Expected: only 09-23-second in the commit; the edit to 09-23-other/prd.md stays unstaged, matching the helper's docstring ("Scoped to ONLY the paths the archive operation actually touched").
Proposed fix
In common/safe_commit.py safe_archive_paths_to_add, stage the concrete archived task directory rather than the archive root when task_name is given, e.g. have the caller pass the destination returned by archive_task_dir (archive/<YYYY-MM>/<task_name>):
if task_name is not None:
if archived_task_dir is not None and archived_task_dir.is_dir():
paths.append(archived_task_dir.relative_to(repo_root).as_posix())
for child_name in modified_children or []:
paths.append(f"{DIR_WORKFLOW}/{DIR_TASKS}/{child_name}")
return pathsSource: mindfold-ai/Trellis