dashboard session_count disagrees with recall_repo for sessions launched from parent dir #46

Open
opened 2026-05-23 20:55:26 +00:00 by coilysiren · 0 comments
Owner

Originally filed by @coilysiren on 2026-05-12T07:57:19Z - https://github.com/coilysiren/repo-recall/issues/90

Observed

For repo coilyco-ai (id 21):

  • `recall_dashboard` returns the repo with `session_count: 0` (from the precomputed aggregate on the Repo record).
  • `recall_repo(repo_id=21)` returns 5 sessions in its `sessions` array, including current sessions whose cwd was `/home/kai/projects/coilysiren`.

Same scan, same repo, two answers.

Hypothesis

The dashboard's per-repo `session_count` comes from `finalize_repo_aggregates` at the end of refresh (per AGENTS.md). The per-repo detail view (`recall_repo`) reads the `session_repos` join table directly.

The `session_repos.match_type = 'cwd'` join uses longest-prefix-wins (per `join.rs` MVP note). When a session's cwd is `/home/kai/projects/coilysiren` (the parent dir containing all 25 sub-repos), no single sub-repo path is a prefix of that cwd, so the strict longest-prefix join attaches no row. But the per-repo detail call seems to fire on a looser "is this repo a child of this session's cwd" relation, which catches the parent-cwd case.

Net effect: every Claude Code session launched from the workspace parent dir vanishes from the dashboard's per-repo counts while still showing in the per-repo detail view.

Repro

```
mcporter call repo-recall recall_dashboard | jq '.repos[] | select(.id==21).session_count'

-> 0

mcporter call repo-recall recall_repo --arg repo_id 21 | jq '.sessions | length'

-> 5

```

(Session cwds in the second result are all `/home/kai/projects/coilysiren`.)

Suggested fix

Pick one source of truth. Either:

  • Tighten the per-repo detail view to use the same strict longest-prefix-wins join, so the dashboard count and the detail-view list always agree. Sessions from the parent dir show in neither. Cleaner but lossier.
  • Loosen `finalize_repo_aggregates` so a session whose cwd is an ancestor of the repo path counts as that repo's session. Matches Kai's actual usage pattern (sessions launched from the workspace parent dir touch many sub-repos). Adds a second `match_type` row.

Per AGENTS.md ("`session_repos.match_type` is the extension point"), the second option fits the design intent. Add a new `match_type = 'parent_cwd'` row for the ancestor case, and have both the precompute and the detail view count both types.

_Originally filed by @coilysiren on 2026-05-12T07:57:19Z - [https://github.com/coilysiren/repo-recall/issues/90](https://github.com/coilysiren/repo-recall/issues/90)_ ## Observed For repo coilyco-ai (id 21): - \`recall_dashboard\` returns the repo with \`session_count: 0\` (from the precomputed aggregate on the Repo record). - \`recall_repo(repo_id=21)\` returns 5 sessions in its \`sessions\` array, including current sessions whose cwd was \`/home/kai/projects/coilysiren\`. Same scan, same repo, two answers. ## Hypothesis The dashboard's per-repo \`session_count\` comes from \`finalize_repo_aggregates\` at the end of refresh (per AGENTS.md). The per-repo detail view (\`recall_repo\`) reads the \`session_repos\` join table directly. The \`session_repos.match_type = 'cwd'\` join uses longest-prefix-wins (per \`join.rs\` MVP note). When a session's cwd is \`/home/kai/projects/coilysiren\` (the parent dir containing all 25 sub-repos), no single sub-repo path is a prefix of that cwd, so the strict longest-prefix join attaches no row. But the per-repo detail call seems to fire on a looser "is this repo a child of this session's cwd" relation, which catches the parent-cwd case. Net effect: every Claude Code session launched from the workspace parent dir vanishes from the dashboard's per-repo counts while still showing in the per-repo detail view. ## Repro \`\`\` mcporter call repo-recall recall_dashboard | jq '.repos[] | select(.id==21).session_count' # -> 0 mcporter call repo-recall recall_repo --arg repo_id 21 | jq '.sessions | length' # -> 5 \`\`\` (Session cwds in the second result are all \`/home/kai/projects/coilysiren\`.) ## Suggested fix Pick one source of truth. Either: - Tighten the per-repo detail view to use the same strict longest-prefix-wins join, so the dashboard count and the detail-view list always agree. Sessions from the parent dir show in neither. Cleaner but lossier. - Loosen \`finalize_repo_aggregates\` so a session whose cwd is an ancestor of the repo path counts as that repo's session. Matches Kai's actual usage pattern (sessions launched from the workspace parent dir touch many sub-repos). Adds a second \`match_type\` row. Per AGENTS.md ("\`session_repos.match_type\` is the extension point"), the second option fits the design intent. Add a new \`match_type = 'parent_cwd'\` row for the ancestor case, and have both the precompute and the detail view count both types.
coilysiren added
P3
and removed
P2
labels 2026-05-31 07:01:13 +00:00
Sign in to join this conversation.
No labels
P0
P1
P2
P3
P4
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
coilyco-flight-deck/repo-recall#46
No description provided.