Skip to content

search binary sessions.db in worktree-audit - #25

Merged
caelaxie merged 1 commit into
mainfrom
cursor/worktree-audit-rg-a-3e44
Oct 21, 2026
Merged

caelaxie merged 1 commit into
mainfrom
cursor/worktree-audit-rg-a-3e44

Conversation

@caelaxie

Copy link
Copy Markdown
Contributor

Closes #24

Add -a to the rg call in skills/poteto-mode/scripts/worktree-audit.sh so it searches the binary sessions.db store.

Open in Web Open in Cursor 

Add -a to the rg call so the SQLite session store is not skipped as a binary file.

Co-authored-by: Kaitian Xie <caelaxie@users.noreply.github.com>
@cursor

cursor Bot commented Oct 21, 2026

Copy link
Copy Markdown

harness proof

Head 31d9333742746205ec33139a19497454ab374303. The diff against main is the -a flag on L107 of skills/poteto-mode/scripts/worktree-audit.sh. The stat -f / date -r lines are unchanged.

One-row SQLite file sessions.db containing /tmp/example-wt/src. The header is SQLite format 3\0 and contains a NUL byte.

ripgrep 14.1.1 (the version named in #24) and ripgrep 15.1.0-cursor5 both do this when searching the directory:

$ rg -l -e '/tmp/example-wt/' .
exit:1

$ rg -l -a -e '/tmp/example-wt/' .
./sessions.db
exit:0

With a sibling logs/devin.log that also contains that path, rg -l without -a lists only ./logs/devin.log. With -a it lists ./sessions.db and ./logs/devin.log.

Local CI steps on this head: plugin validation (56 skills, 2 agents, 23 playbooks), bash -n on both shell scripts, bun run typecheck, and bun test (68 pass, 0 fail).

@caelaxie caelaxie left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

verdict: changes requested (proof only). posting as a comment since github blocks request-changes on own-account prs.

  • minimum changes: pass. the diff is exactly #24's smallest fix, one -a on L107, nothing else touched.
  • layout/target: pass.
  • parity: pass, no version or upstream text drift.
  • linkage: pass, Closes #24.
  • harness proof: missing. Validate plugin is green at 31d9333, but devin ci only does bash -n + bun tests and says itself that devin plugins install/list can't run there. this is a script behavior change, so ci isn't enough.

needed, at head 31d9333742746205ec33139a19497454ab374303:

  1. devin plugins install --local pinned to that full sha (devin fetches the repo itself; symlink proofs don't count) + devin plugins list showing pstack.
  2. behavior proof: run the installed worktree-audit.sh (or its rg line) against a devin cli dir whose sessions.db holds a worktree path, and show LAST_CHAT / the rg hit now comes from sessions.db (before vs after is ideal, like the repro in #24).

post it as a pr comment or in the body and i'll merge.

last="-"; last_ts=0
if [ -d "$transcripts" ]; then
f=$(rg -l -e "${wt}/" -e "${wt}\"" "$transcripts" 2>/dev/null \
f=$(rg -l -a -e "${wt}/" -e "${wt}\"" "$transcripts" 2>/dev/null \

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

matches #24's fix. just need proof this line now hits sessions.db from the installed copy.

Copy link
Copy Markdown
Contributor Author

harness proof

Real Devin CLI on a local box (no cloud agent, no git clone). PR head 31d9333742746205ec33139a19497454ab374303 (cursor/worktree-audit-rg-a-3e44), which I checked with git ls-remote refs/pull/25/head before installing and again before posting. The diff is one line: rg -l → rg -l -a at L107. Expected version: 0.15.29.

  • CLI: devin 3000.11.92 (7f4e64980e22), devin auth status → Logged in (via Devin).
  • Read-only throughout. I did not run the full script, because it does git fetch. I ran only its L66 path expansion and its L107 rg call.
# step result
1 devin plugins list before: only thermos v1.0.0 ✅ recorded
2 --local wrapper pinned to the full head sha ✅ PASS
3 devin plugins list shows pstack v0.15.29 (required), and both plugin.json files say 0.15.29 ✅ PASS
4 installed worktree-audit.sh is a regular file and is byte-identical to head (cmp) ✅ PASS
5 installed L107 reads rg -l -a -e "${wt}/" -e "${wt}\"" "$transcripts" ✅ PASS
6 that rg call with -a hits sessions.db (and sessions.db-wal) ✅ PASS
7 the same call without -a gets no sessions.db hit (only logs/) ✅ PASS (contrast confirmed)

1–3. before list, install, after list

$ devin plugins list          # before
Installed plugins

  • thermos v1.0.0

$ cat /workspace/devin-harness/wrap-pr25/.devin-plugin/plugin.json
{ "name": "pstack-harness-pr25", "version": "0.0.0",
  "requiredPlugins": [ { "source": "github", "repo": "pstack-ports/devin-pstack",
                         "sha": "31d9333742746205ec33139a19497454ab374303" } ] }
$ devin plugins install --local -y /workspace/devin-harness/wrap-pr25
✓ Installed pstack-harness-pr25.
  auto-installed required plugins: pstack
$ devin plugins list
Installed plugins

  • thermos v1.0.0
  • pstack-harness-pr25 v0.0.0
  • pstack v0.15.29 (required)

4–5. installed cache copy

$ cd ~/.local/share/devin/cli/plugins/cache/github.com_pstack-ports_devin-pstack-816793bb/0.15.29
$ grep -n '"version"' .devin-plugin/plugin.json plugin.json
.devin-plugin/plugin.json:3:  "version": "0.15.29",
plugin.json:4:  "version": "0.15.29",
$ stat -c '%F %s %n' skills/poteto-mode/scripts/worktree-audit.sh
regular file 6022 skills/poteto-mode/scripts/worktree-audit.sh
$ curl -fsSL https://raw.githubusercontent.com/pstack-ports/devin-pstack/31d9333742746205ec33139a19497454ab374303/skills/poteto-mode/scripts/worktree-audit.sh -o /tmp/pr25-wta.sh && cmp skills/poteto-mode/scripts/worktree-audit.sh /tmp/pr25-wta.sh && echo IDENTICAL
IDENTICAL
$ sha256sum skills/poteto-mode/scripts/worktree-audit.sh /tmp/pr25-wta.sh   # first 16 hex
a5f2ea7f6a10f8dd skills/poteto-mode/scripts/worktree-audit.sh
a5f2ea7f6a10f8dd /tmp/pr25-wta.sh
$ grep -n 'rg -l' skills/poteto-mode/scripts/worktree-audit.sh
107:		f=$(rg -l -a -e "${wt}/" -e "${wt}\"" "$transcripts" 2>/dev/null \
$ sed -n 64,66p skills/poteto-mode/scripts/worktree-audit.sh
# 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}"

6–7. L107's rg call, built the way the script builds it

wt is the scratch dir that every recent Devin CLI session on this box ran in, so it is known to be in sessions.db.

$ transcripts="${DEVIN_SESSIONS_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/devin/cli}"   # line 66, verbatim
$ wt=/workspace/devin-harness/scratch                                                  # dir every recent harness session ran in
$ echo "$transcripts"
~/.local/share/devin/cli
$ rg -l -a -e "${wt}/" -e "${wt}\"" "$transcripts" 2>/dev/null | grep -c . ; ... | grep sessions.db    # line 107 (PR, with -a)
files matched: 18
~/.local/share/devin/cli/sessions.db-wal
~/.local/share/devin/cli/sessions.db
$ rg -l -e "${wt}/" -e "${wt}\"" "$transcripts" 2>/dev/null ...    # same line without -a (before PR)
files matched: 16
(no sessions.db hit)
# where the non-sessions.db hits come from (both variants):
     16 ~/.local/share/devin/cli/logs
$ rg -c -a -e "${wt}/" -e "${wt}\"" "$transcripts/sessions.db"   # match count inside the db
32
# rest of the line-107/108 pipeline on GNU/Linux, for reference:
$ rg -l -a ... | xargs stat -f "%m %N" 2>/dev/null | sort -rn | head -1
f=[Inodes: Total: 2064384    Free: 1904420]  (exit of stat discarded; BSD stat -f syntax)

With -a, the hits include sessions.db and sessions.db-wal, and there are 32 matching lines inside the db. Without -a, rg skips the db as binary, and the only hits are the 16 files under logs/. That is the fix #24 asked for.

⚠️ remaining (outside #24's scope, already present before this PR)

On GNU/Linux the rest of the L107–110 pipeline still can't turn a hit into a date. stat -f '%m %N' is BSD syntax, and GNU stat prints filesystem info instead (f=[Inodes: Total: …] above). date -r <epoch> on GNU expects a file. So LAST_CHAT still ends up empty or - on Linux even though the right file now matches. A possible follow-up is a stat -c '%Y %n' / date -d @<ts> fallback. I flagged the same thing as concern A on #23.

No code was changed, and the full script (with its git fetch) was not run. No secrets appear in this comment.

@caelaxie caelaxie left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

re-review at 31d9333: lgtm. diff is only the -a on L107 from #24's smallest fix. proof shows a --local wrapper pinned to the full head sha, pstack v0.15.29 (required) in devin plugins list, the installed script cmp-identical to head, and L107 hitting sessions.db (with no hit without -a). closes #24, not a draft, Validate plugin green. the gnu stat -f/date -r issue is out of scope and is an upstream follow-up. merging.

@caelaxie
caelaxie merged commit 595fa3f into main Oct 21, 2026
1 check passed
@caelaxie
caelaxie deleted the cursor/worktree-audit-rg-a-3e44 branch October 21, 2026 02:30
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.

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

2 participants