Skip to content

Archival can silently destroy state: writes to untracked destinations are deletions #1783

Closed

Description

@bradygaster

Summary

Squad's archival routine (decision-record archiving and agent-history summarization) can permanently destroy state when .squad/ is git-excluded.

Archival works by moving content out of a source file and into an archive file. If the archive destination is untracked, the removal from the tracked source commits — but the destination never does. The content is gone with no error, no warning, and a success report.

How it was found

During the gh-aw pre-E2E triage session, Scribe reported "no archival required" while having actually archived 25 decision records and 3 agent-history entries to new, untracked files.

Staging the result produced 752 deletions vs 265 insertions. It was caught only because a human git-safety rule (stop and inspect if the diff looks wrong) fired before commit. Nothing in the tooling flagged it.

Repaired in #1782 by re-homing all content into already-tracked archive destinations. Verified via literal containment: 23 + 6 + 2 + 2 headings removed, 0 lost.

Why it happens

.squad/ is git-excluded in this checkout (.git/info/exclude). Under that condition:

  • files already tracked still commit normally
  • files newly created are silently never added

Archival creates timestamped destination files (e.g. history-archive-<timestamp>.md, decisions/archive/<date>-archived-pre7d.md). Those are new, therefore untracked, therefore uncommittable. The source file's removal is tracked and commits fine.

Result: archival becomes deletion.

Impact

Any user with a git-excluded or gitignored .squad/ is exposed. This is not specific to this repository — excluding .squad/ is a reasonable and common choice, and the archival path is automatic. The failure is silent and the reported outcome is success.

Proposed fix

Before any archive write, verify the destination is tracked:

git ls-files --error-unmatch <destination>
  • exit 0 → proceed
  • non-zero → redirect to an existing tracked archive, or abort with a clear error

Never move content out of a tracked file into a destination that cannot be committed.

Two supporting lessons worth encoding

  1. Verify archival by entry count, not file size. decisions.md shrank while the report claimed growth, because a merge added entries and an archive removed entries in the same pass. Size is not a valid integrity signal here.
  2. Never report a gate outcome that wasn't verified. The "no archival required" claim was the reason nobody looked. A gate that reports without measuring is worse than no gate.

Success criteria

  • Archival refuses to write to an untracked destination, or redirects to a tracked one
  • Archival reports entry counts moved (source removed / destination added), not file sizes
  • A test proves the failure: with .squad/ excluded, trigger archival and assert no content is lost across a commit boundary. The test must fail against the current pre-fix behavior.

Notes

Activity

  1. github-actions commented on Aug 21, 2026

    @github-actions
    Contributor

    📋 Assigned to Scribe (Session Logger)

    Issue: #1783 — Archival can silently destroy state: writes to untracked destinations are deletions

    Scribe will pick this up in the next Copilot session.

    For Copilot coding agent: If enabled, this issue will be worked automatically.
    Otherwise, start a Copilot session and say:
    Scribe, work on issue #1783

  2. added
    squadSquad triage inbox — Lead will assign to a member
    on Aug 21, 2026
  3. bradygaster commented on Aug 21, 2026

    @bradygaster
    CollaboratorAuthor

    Sibling of #1774 — same routine, two distinct failure modes. Recording the relationship so they get one fix, not two.

    #1774 #1783 (this)
    Delete half happens happens
    Append half never executes — destination byte-identical executes correctly
    Destination decisions-archive.md (tracked) new, untracked file
    Why data is lost nothing was written written somewhere uncommittable
    Detection destination unchanged destination fine on disk, absent from the commit

    Both produce the same user-visible outcome — a tracked source shrinks and the content is gone — and both were self-reported as successful.

    Suggest a single fix at the archive call site that satisfies both:

    1. Resolve the destination and assert it is tracked (git ls-files --error-unmatch <dest>); if not, redirect to an existing tracked archive or abort.
    2. Perform the append first, verify the entry count landed, and only then perform the delete.
    3. Report entry counts moved (source removed / destination added), never file sizes. Size is not a valid integrity signal — in tonight's incident decisions.md shrank while a merge was simultaneously adding entries.

    Either failure mode alone destroys history. A fix for one does not close the other.

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

    bugSomething isn't workingsquadSquad triage inbox — Lead will assign to a member

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions