sessions, usage: a Claude Code, Qoder or Cowork project folder inside projects/ that is a junction lists no session or call (the entry shape #2250 left out), and a Hermes profile likewise
A Claude Code project folder inside projects/ that is a link reads as no project at all: the Sessions page lists none of that project's sessions, and Usage lists none of its calls, tokens or cost. A session's own folder (<id>/, holding its subagents/) behind a link loses its subagent transcripts the same way, and a Hermes profile behind a link loses that profile's sessions.
On Windows the link is a junction - the layout #2233 found normal for .codex on this class of machine (%USERPROFILE%\.codex there holds 22 of them) - and Go reports a junction as irregular, not as a symlink: its lstat is no directory and Type()&os.ModeSymlink is 0, so ccFiles' entry test IsDir() || Type()&ModeSymlink skips it. ccFiles is what reads Claude Code's own store (callFiles), Qoder's, Qoder CN's and Cowork's local-agent homes.
This is one level in from #2250. There the links are walk roots and its patch resolves a root before filepath.WalkDir; here they are entries a reader decides whether to descend into, which WalkDir's root fix cannot reach. #2250's own "not run" note names this pair - "ccFiles/hermes ... don't know Windows junctions (Go 1.23+'s lstat of a junction is ModeIrregular, not ModeSymlink) - a Windows-only shape this machine cannot build, not verified, out of scope" - so this is the remaining half of that family, and this box can build the shape.
Impact
- Who: Windows users who keep a heavy Claude Code project's sessions on another drive with a junction left in
projects/- the manual form of the move magpie's own "Relocate project" performs, and the same pattern #2233 documents for.codex; Qoder / Qoder CN / Cowork users the same, and a Hermes profile store likewise. - Severity: silent wrong results, not an error. Sessions: the project disappears whole. Usage and the ledger: its calls, tokens and cost leave every total, all-time included, and the per-session rows are gone. Nothing warns.
- Persists in every release until fixed; no reader ever learns to descend through a junction.
- Same class fixed twice in 24 hours on the same reasoning: #2233 merged, #2250 pending.
Reproduction
Windows 11, upstream main 5618ade1, go1.25.9, real mklink /J junctions.
(a) What Windows reports, for the exact test ccFiles makes (temp paths shortened):
go: go1.25.9 windows/amd64
symlink failed (developer mode off): symlink C:\Temp\...: A required privilege is not held by the client.
Lstat link: mode=?rw-rw-rw- dir=false symlink=false irregular=true regular=false
Stat link: mode=drwxrwxrwx dir=true symlink=false irregular=false regular=false
ReadDir entry link: type=?--------- dir=false symlink=false irregular=true
ReadDir through link: 1 entries, err: <nil>
WalkDir entries seen under link: 1
ccFiles test on link: accepted=false
ccFiles test on link: accepted=false is the predicate itself: IsDir() || Type()&ModeSymlink != 0.
(b) End to end. A sandbox HOME (every agentenv.Vars entry cleared, CLAUDE_CONFIG_DIR and magpie's own folders pointed into it) whose Claude store holds internal/sessions/testdata/claude; the -work-app project folder moved to another folder with a junction left in its place:
===== usage all, pre-fix binary, project folder behind a junction =====
no calls all time · route an agent through magpie and its usage shows up here
C:\Temp\q7m2\e2e\home\.config\magpie\usage.jsonl
===== usage all, fixed binary, same junction =====
no calls through magpie all time
not through magpie · the agents' own requests, read from their session files
1.3K tokens all time · 3 calls · no price (3 calls unpriced)
in 1.1K out 170 cache read 5.2K cache write 1.0K reasoning 0
agents
Claude Code 100% 1.3K 3 calls no price
models
local session/claude-haiku-4-5-20251001 88% 1.1K 2 calls no price
local session/claude-opus-5-5 12% 150 1 call no price
sessions
Claude Code 11111111-2222-3333-4444-555555555555 100% 1.3K 3 calls no price
C:\Temp\q7m2\e2e\home\.config\magpie\usage.jsonl
===== sessions (plain), pre-fix binary, same junction =====
no sessions yet · Claude Code's, Codex's, OpenCode's and Pi's sessions on this computer show up here
~\.claude · ~\.codex
The same fixture without the junction, pre-fix binary: sessions --json lists the session (id 11111111-2222-3333-4444-555555555555, ~\.claude\projects\-work-app\11111111-....jsonl) and usage all answers the same Claude Code 3 calls. The only difference is the junction.
(c) The minimal repro in the repo's own form - go test -tags nogui -count=1 -run 'TestClaudeProjectFolderBehindALink|TestClaudeSessionFolderBehindALink|TestHermesProfileBehindALink' ./internal/sessions/ without the change:
--- FAIL: TestClaudeProjectFolderBehindALink (0.33s)
link_entry_test.go:45: Claude session files behind a link: [], want [C:\Temp\...\-work-app\11111111-2222-3333-4444-555555555555.jsonl C:\Temp\...\-work-app\11111111-2222-3333-4444-555555555555\subagents\agent-a1.jsonl C:\Temp\...\-work-app\22222222-2222-3333-4444-555555555555.jsonl]
--- FAIL: TestClaudeSessionFolderBehindALink (0.20s)
link_entry_test.go:69: a Claude session folder behind a link: [...two main files...], want [...those and its subagent...]
--- FAIL: TestHermesProfileBehindALink (0.63s)
link_entry_test.go:92: Hermes sessions behind a link: 1, want 2
FAIL
FAIL github.com/yetone/magpie/internal/sessions 1.353s
FAIL
With the change all three pass (ok github.com/yetone/magpie/internal/sessions 1.366s).
Root cause
internal/sessions/sessions.go, ccFiles:
- project entry:
if !project.IsDir() && project.Type()&os.ModeSymlink == 0 { continue }- a junction is neither, so the project is skipped whole; - session entry:
} else if e.IsDir() || e.Type()&os.ModeSymlink != 0 {- subagents and workflow agents behind a junctioned session folder are never read.
internal/sessions/hermes.go, HermesDirs: the same test on a profiles/ entry, so the profile is skipped.
os.ReadDir reports a junction entry as ModeIrregular with IsDir() == false; only os.Stat follows it, and the readers never stat an entry they are deciding about.
Fix
linkedFolder - the sessions package's copy of linkEntry, which internal/library/skills.go already carries for junctions (ModeSymlink || GOOS == "windows" && ModeIrregular) - replaces the entry test in all three places. Off Windows nothing changes (ModeIrregular is not a link there), and a path through the link is read as before, the filesystem resolving it.
Branch (this repository takes no PR - README: "This repository doesn't take pull requests. Only maintainers can open them"; this issue is the Discord-described patch behind it): https://github.com/JasonBuildAI/magpie/tree/fix/cc-link-entries-q7m2
commit a804fc870b4d2a0c96556fc87ad6ffec12d00568 (base 5618ade1), git format-patch -1 --stdout:
0001-sessions-...patch
From a804fc870b4d2a0c96556fc87ad6ffec12d00568 Mon Sep 17 00:00:00 2001
From: JasonBuildAI <[email protected]>
Date: Thu, 15 Oct 2026 07:45:27 +0800
Subject: [PATCH] sessions: a Claude Code, Qoder, Qoder CN or Cowork project
folder inside projects/ that is a junction is read too, and a Hermes profile
likewise
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
ccFiles decided whether to descend into an entry of an agent's projects/
folder — a project folder, then a session's own folder for its subagents —
with IsDir() or Type()&ModeSymlink. A junction is neither: Go reports it as
irregular (its lstat is no directory, and no symlink either), so a project
folder kept on another drive with a junction left in projects/ — the layout
#2233 found normal for .codex on Windows — was skipped whole: the Sessions
page listed none of the project's sessions, and Usage none of its calls,
tokens or cost. A session's own folder behind a junction lost its subagent
transcripts the same way, and HermesDirs skipped a profile behind a link,
losing that profile's sessions. linkedFolder is the entry test in all three
places; a path through the link is read as before, the filesystem resolving
it.
Run:
- TestClaudeProjectFolderBehindALink, TestClaudeSessionFolderBehindALink
and TestHermesProfileBehindALink (new), mklink /J on the Windows box:
with the three entry tests put back as they were they fail "Claude
session files behind a link: [], want [...]", "a Claude session folder
behind a link: [its two main files], want [those and its subagent]" and
"Hermes sessions behind a link: 1, want 2"; with the change they pass.
- go test -tags nogui -count=1 ./internal/sessions/: ok, 499.630s.
- gofmt -l on the changed files: nothing. go vet ./..., GOOS=linux go vet
-tags nogui ./..., GOOS=windows go vet ./...: nothing. go build,
GOOS=linux go build -tags nogui, GOOS=windows go build: ok.
- magpie usage all and magpie sessions, on a sandbox HOME whose Claude
store is the testdata/claude fixture with the -work-app project folder
moved aside and a junction left behind: a binary built without the
change answers "no calls all time" and "no sessions yet"; with it, the
same junction answers 3 calls (Claude Code) and lists the session.
---
internal/sessions/hermes.go | 2 +-
internal/sessions/link_entry_test.go | 104 +++++++++++++++++++++++++++
internal/sessions/sessions.go | 14 +++-
3 files changed, 117 insertions(+), 3 deletions(-)
create mode 100644 internal/sessions/link_entry_test.go
diff --git a/internal/sessions/hermes.go b/internal/sessions/hermes.go
index ecd888b1..09b2b30f 100644
--- a/internal/sessions/hermes.go
+++ b/internal/sessions/hermes.go
@@ -34,7 +34,7 @@ func HermesDirs() []string {
}
dirs := []string{root}
for _, e := range readDirectory(filepath.Join(root, "profiles")) {
- if !strings.HasPrefix(e.Name(), ".") && (e.IsDir() || e.Type()&os.ModeSymlink != 0) {
+ if !strings.HasPrefix(e.Name(), ".") && (e.IsDir() || linkedFolder(e)) {
dirs = append(dirs, filepath.Join(root, "profiles", e.Name()))
}
}
diff --git a/internal/sessions/link_entry_test.go b/internal/sessions/link_entry_test.go
new file mode 100644
index 00000000..e2fc45ae
--- /dev/null
+++ b/internal/sessions/link_entry_test.go
@@ -0,0 +1,104 @@
+package sessions
+
+import (
+ "os"
+ "path/filepath"
+ "reflect"
+ "sort"
+ "testing"
+)
+
+// ccFilePaths is every session file ccFiles found, by path: one that stops
+// being listed, or is listed from somewhere else, stands out.
+func ccFilePaths(fs []file) []string {
+ out := make([]string, 0, len(fs))
+ for _, f := range fs {
+ out = append(out, f.path)
+ }
+ sort.Strings(out)
+ return out
+}
+
+// A Claude Code project folder inside projects/ that is a link is read all
+// the same. It is the shape of a heavy project's sessions kept on another
+// drive with a junction left where they were, the layout this machine's
+// ~/.codex already has 22 of. Go reports a junction as irregular, not as a
+// symlink (its lstat is not a directory either), so ccFiles skipped the
+// folder whole: Sessions listed none of the project's sessions and Usage
+// none of its calls (#2233's shape inside a store, the case #2250 left out).
+func TestClaudeProjectFolderBehindALink(t *testing.T) {
+ claude, _ := setup(t)
+ before := ccFiles("claude", claude)
+ if len(before) == 0 {
+ t.Fatal("the fixture has no Claude session files")
+ }
+ listed := len(ListAgent("claude"))
+ live := filepath.Join(claude, "projects", "-work-app")
+ elsewhere := filepath.Join(t.TempDir(), "-work-app")
+ if err := os.Rename(live, elsewhere); err != nil {
+ t.Fatal(err)
+ }
+ linkFolder(t, elsewhere, live)
+
+ after := ccFiles("claude", claude)
+ if !reflect.DeepEqual(ccFilePaths(after), ccFilePaths(before)) {
+ t.Fatalf("Claude session files behind a link: %v, want %v", ccFilePaths(after), ccFilePaths(before))
+ }
+ if got := len(ListAgent("claude")); got != listed {
+ t.Fatalf("Claude sessions behind a link: %d, want %d", got, listed)
+ }
+}
+
+// The session's own folder — where its subagents and their workflows live —
+// being a link is read too.
+func TestClaudeSessionFolderBehindALink(t *testing.T) {
+ claude, _ := setup(t)
+ before := ccFiles("claude", claude)
+ if len(before) == 0 {
+ t.Fatal("the fixture has no Claude session files")
+ }
+ live := filepath.Join(claude, "projects", "-work-app", "11111111-2222-3333-4444-555555555555")
+ elsewhere := filepath.Join(t.TempDir(), "11111111-2222-3333-4444-555555555555")
+ if err := os.Rename(live, elsewhere); err != nil {
+ t.Fatal(err)
+ }
+ linkFolder(t, elsewhere, live)
+
+ after := ccFiles("claude", claude)
+ if !reflect.DeepEqual(ccFilePaths(after), ccFilePaths(before)) {
+ t.Fatalf("a Claude session folder behind a link: %v, want %v", ccFilePaths(after), ccFilePaths(before))
+ }
+}
+
+// A Hermes profile folder that is a link is read too: HermesDirs skipped it
+// the same way and the profile's sessions were gone from Sessions and Usage
+// (#2250 named this check beside ccFiles as the uncovered pair).
+func TestHermesProfileBehindALink(t *testing.T) {
+ setup(t)
+ root := filepath.Join(t.TempDir(), "hermes")
+ t.Setenv("HERMES_HOME", root)
+ hermesFixture(t, root, "", "link-default", true)
+ hermesFixture(t, root, "work", "link-work", true)
+ if got := hermesSessions(); got != 2 {
+ t.Fatalf("Hermes sessions: %d, want 2", got)
+ }
+ live := filepath.Join(root, "profiles", "work")
+ elsewhere := filepath.Join(t.TempDir(), "work")
+ if err := os.Rename(live, elsewhere); err != nil {
+ t.Fatal(err)
+ }
+ linkFolder(t, elsewhere, live)
+ if got := hermesSessions(); got != 2 {
+ t.Fatalf("Hermes sessions behind a link: %d, want 2", got)
+ }
+}
+
+func hermesSessions() int {
+ n := 0
+ for _, s := range List(0) {
+ if s.Agent == "hermes" {
+ n++
+ }
+ }
+ return n
+}
diff --git a/internal/sessions/sessions.go b/internal/sessions/sessions.go
index 0a2aab68..f550b171 100644
--- a/internal/sessions/sessions.go
+++ b/internal/sessions/sessions.go
@@ -410,6 +410,16 @@ func stat(f *file) bool {
return true
}
+// linkedFolder is whether e is a link to a folder rather than a folder of
+// its own: a symlink, or on Windows a junction, which Go reports as
+// irregular, not as a symlink — its lstat is no directory either. A reader
+// that descends only into IsDir() or ModeSymlink entries walks past it
+// (#2233's shape, one level in); a path through the link is read as usual,
+// the filesystem resolving it.
+func linkedFolder(e os.DirEntry) bool {
+ return e.Type()&os.ModeSymlink != 0 || runtime.GOOS == "windows" && e.Type()&os.ModeIrregular != 0
+}
+
// ccFiles are the session files of an agent that keeps them as Claude Code
// does, under its folder's projects/: a session's own <id>.jsonl in its
// project's folder, its subagents' in <id>/subagents/, and the agents of
@@ -419,7 +429,7 @@ func ccFiles(agent, dir string) []file {
projects := filepath.Join(dir, "projects")
var out []file
for _, project := range readDirectory(projects) {
- if !project.IsDir() && project.Type()&os.ModeSymlink == 0 {
+ if !project.IsDir() && !linkedFolder(project) {
continue
}
root := filepath.Join(projects, project.Name())
@@ -430,7 +440,7 @@ func ccFiles(agent, dir string) []file {
if stat(&f) {
out = append(out, f)
}
- } else if e.IsDir() || e.Type()&os.ModeSymlink != 0 {
+ } else if e.IsDir() || linkedFolder(e) {
subs := filepath.Join(path, "subagents")
for _, sub := range readDirectory(subs) {
if sub.IsDir() || !strings.HasSuffix(sub.Name(), ".jsonl") {
--
2.49.0.windows.1
Verification
go test -tags nogui -count=1 ./internal/sessions/:ok github.com/yetone/magpie/internal/sessions 499.630s.gofmt -lon the changed files: nothing.go vet ./...,GOOS=linux go vet -tags nogui ./...,GOOS=windows go vet ./...: nothing.go build,GOOS=linux go build -tags nogui,GOOS=windows go build: ok.- Broken on purpose: with
linkedFolderforced tofalse, the three tests fail with the FAIL lines above; restored, they pass. - The (b) pair is the same tree - the base commit's build and the fix's build - reading the same fixture.
Not run
- The full
go test -tags nogui ./...suite of the code standards: started on this box (it carries the known Windows failures of #1827); this change's only package,internal/sessions, is green above.
AI disclosure: this change was drafted with AI assistance at my request, under my direction and review; the junctions are real and the raw outputs above were produced on this machine.
Thanks @JasonBuildAI for the clear report and the patch. Fixed in 2b0037f41.
A junction inside a folder that magpie reads shows up as ModeIrregular, not as a folder or ModeSymlink, so readers skipped it. There is now a single check, dirent.IsFolder: an entry counts as a folder when it is one, or when it is a symlink or junction that os.Stat follows to a folder. A broken link, a link to a file and other irregular entries (dedup or cloud placeholder files, for example) are not treated as folders. That Stat is the difference from the patch in the issue.
It is used everywhere magpie picks folders out of an agent's store this way:
- sessions: Claude Code / Qoder / Qoder CN / Cowork project folders, a session's own folder (its subagents), workflow runs, Hermes profiles, and Antigravity conversations;
- agent: Hermes and oh-my-pi profiles;
- library: Claude Desktop's skill org and account folders.
Walks that copy, hash or delete deliberately still don't follow links.
What was run:
- New tests make real links:
mklink /Jon Windows and a symlink elsewhere. They include TestClaudeProjectFolderBehindALink, TestClaudeSessionFolderBehindALink and TestHermesProfileBehindALink, plus the same check for each reader above. - On a Windows 11 box with real junctions, all of them pass. With the old check put back, every one fails (e.g. "Claude session files behind a link: [], want [...]").
- The full test suite passes on macOS.
It ships in the next release. Could you confirm there that your junctioned projects, subagents and Hermes profiles show up in Sessions and Usage? I'll keep this open until you do.
Released in v0.1.1247 (2b0037f41): project folders, session folders and Hermes profiles behind a junction are read now. I'll leave this open until you can confirm on your machine.