Skip to content

audit: worktree-audit.sh rg skips sessions.db as binary #24

Closed

Description

@caelaxie

port: skills/poteto-mode/scripts/worktree-audit.sh L64–66 and L106–108 at 9309f40 (after #23):

# CLI session store: ~/.local/share/devin/cli/sessions.db
# ($XDG_DATA_HOME or DEVIN_SESSIONS_DIR when set). No per-OS branch.
transcripts="${DEVIN_SESSIONS_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/devin/cli}"
...
	if [ -d "$transcripts" ]; then
		f=$(rg -l -e "${wt}/" -e "${wt}\"" "$transcripts" 2>/dev/null \

upstream pstack/skills/poteto-mode/scripts/worktree-audit.sh L64–66 and L106–108 at 88d4751 (pstack 0.15.29):

# Transcripts dir: ~/.cursor/projects/<slugified-repo-path>/agent-transcripts.
slug=$(printf '%s' "$main_wt" | sed 's#^/##; s#/#-#g')
transcripts="$HOME/.cursor/projects/$slug/agent-transcripts"
...
	if [ -d "$transcripts" ]; then
		f=$(rg -l -e "${wt}/" -e "${wt}\"" "$transcripts" 2>/dev/null \

why it's a port divergence: upstream greps a directory of .jsonl text transcripts. The port now points transcripts at the Devin CLI dir, where session history is the SQLite file sessions.db. When rg recurses into a directory, it stops reading a file at the first NUL byte, and the SQLite header has NUL bytes, so sessions.db never matches. Any hit comes from logs/*.log instead, so LAST_CHAT reads - or a log date. Reproduced with ripgrep 14.1.1 on a one-row sqlite file: rg -l -e '<path>/' . exits 1, and rg -l -a -e '<path>/' . lists ./sessions.db. The #23 harness proof saw the same on a real ~/.local/share/devin/cli.

(The stat -f '%m %N' / date -r on L108–110 is macOS-only, but upstream has the same lines, so it's an upstream bug and not part of this issue.)

smallest fix: L107: add -a so rg searches the binary store:

		f=$(rg -l -a -e "${wt}/" -e "${wt}\"" "$transcripts" 2>/dev/null \

found by the whole-port audit against upstream 88d4751 (pstack 0.15.29). fix with Closes #24.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions