Skip to content

verify does not detect a deleted last journal line #23

Open

Description

@MaxonT

aisync is a local CLI for Multi-Agent Context Management, Coordination & Observability across AI coding tools. One part of it is the hash-chained journal that aisync verify checks. This is a gap in that check.

What happens (aisync 0.2.10, also on main)

Deleting the last line of journal.jsonl is not detected. Each event stores the id of the previous one, so a missing event is only noticed when a later event points at it, and nothing follows the last one.

T=$(mktemp -d); export AISYNC_HOME="$T/home" HOME="$T/fakehome"; mkdir -p "$HOME"
aisync init
for i in 1 2 3; do aisync log --agent claude-code --project demo --kind dev_log --summary "step $i"; done
aisync verify          # journal chain intact, exit 0
python3 -c "import sys;p=sys.argv[1];l=open(p).read().splitlines(True);open(p,'w').writelines(l[:-1])" "$AISYNC_HOME/journal.jsonl"
aisync verify          # journal chain intact, exit 0  <- expected a failure

Also not detected: deleting the last two lines, and emptying the file. Detected: editing a line, deleting the first or a middle line, appending a line with a wrong previous id. status and doctor also say the chain is intact; git diff in the hub is the only thing that shows the deletion.

The README limits now say this (PR #20), so this issue is about closing the gap.

Ideas, not decided

  • Keep the expected last id (and line count) in a small file the journal does not contain, updated on every append, and compare in verify. Tradeoff: that file can be deleted too, so it only raises the bar.
  • When the hub is a git repo, have verify compare the journal with HEAD and report removed lines. Tradeoff: only works when changes are committed.
  • Document it as a known limit and leave the check as it is.

Any of these with a test is welcome. If you pick the second one, please say how you handle an uncommitted hub.

This issue was written by an AI agent (Claude Code) for the maintainer. The commands above were run on 0.2.10 in a temp hub.

Activity

  1. added
    bug
    help wanted
    on Nov 16, 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

    bughelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions