fix(penpal): add All Markdown source, lazy scanning, and fix review findings - #535
Conversation
…indings Add an always-present __all_markdown__ source type that discovers all .md files in any project, solving the issue where projects without recognized source markers (thoughts/, .rp1/, ANCHORS.md) showed no files. Key changes: - Register __all_markdown__ as a proper SourceType with GroupFiles, always appended by DetectSources() - Replace eager full-scan at startup with cheap HasFiles bool check (projectHasAnyMarkdown) + lazy scan on first project open - Replace FileCount/Badges on API types with HasFiles bool - Remove dead seedRecentActivity; seed activity per-project on first lazy scan - Fix AllFiles() to deduplicate __all_markdown__ entries (prefer typed source) - Align projectHasAnyMarkdown with full scan (gitignore, .hg/.svn skips) - Fix EnsureProjectScanned TOCTOU race via write-lock gating - Fix handleProjectInfo to use project.HasFiles instead of triggering lazy scan - Fix search handler walking into .git dirs via __all_markdown__ source - Skip __all_markdown__ in add-source conflict check Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…-file-dis * origin/main: fix(penpal): ensure repo badges are generated when repos are added (#534) fix(penpal): show agent selector dropdown below trigger button (#532) fix(penpal): filter ANCHORS.md from anchors source (#533) fix(penpal): show wave animation in sidebar when run phase is unknown (#531) fix(penpal): anchor stability improvements and code block highlights (#530) refactor(penpal): decompose Layout.tsx into focused components (#528) # Conflicts: # apps/penpal/frontend/src/components/Layout.tsx
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a03536c0b9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| c.projectScanned[projectName] = true | ||
| c.mu.Unlock() | ||
|
|
||
| c.RefreshProject(projectName) |
There was a problem hiding this comment.
Block until initial scan completes before returning project files
EnsureProjectScanned marks a project as scanned before RefreshProject finishes, so a concurrent GET /api/project/{name} can observe projectScanned=true and then read an empty ProjectFiles slice while the first scan is still in progress. In practice this shows up when two requests hit the same unopened project at once (e.g., multiple tabs/windows): one request does the scan, the other can return an empty sidebar response even though files exist.
Useful? React with 👍 / 👎.
Summary
__all_markdown__source type so projects without recognized source markers (thoughts/, .rp1/, ANCHORS.md) now show all their .md filesHasFilesbool check + lazy scan on first project open, making startup faster for large workspaces🤖 Generated with Claude Code