Skip to content

fix: refresh command auto-activates newly discovered projects#73

Merged
jdillon merged 1 commit into
mainfrom
fix/refresh-rediscover-projects
Mar 23, 2026
Merged

fix: refresh command auto-activates newly discovered projects#73
jdillon merged 1 commit into
mainfrom
fix/refresh-rediscover-projects

Conversation

@jdillon

@jdillon jdillon commented Mar 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • After bd init in an existing workspace folder, the "Beads: Refresh" command discovered the new project but never activated it — views stayed empty
  • refresh() now auto-activates the first discovered project when no project is active, mirroring the existing initialize() behavior
  • 3-line fix in BeadsProjectManager.refresh()

Fixes #64

Test plan

  • Open a workspace with no .beads/ directory
  • Run bd init in the terminal
  • Run "Beads: Refresh" command
  • Verify the project appears and activates in the sidebar

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Fixed project auto-activation behavior where newly discovered projects were not automatically activated during refresh when no project was currently active. The first discovered project will now be properly activated.

After `bd init` in an existing workspace, the refresh command discovered
the new project but never activated it, leaving views empty. Mirror the
auto-activation logic from `initialize()` so the first discovered
project becomes active.

Fixes: #64

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jdillon jdillon self-assigned this Mar 23, 2026
@coderabbitai

coderabbitai Bot commented Mar 23, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

A new investigation document analyzes Issue #64, and the BeadsProjectManager.refresh() method is updated to automatically activate the first discovered project when no project is currently active, addressing a functional gap in the refresh/discovery workflow.

Changes

Cohort / File(s) Summary
Investigation Documentation
sandbox/issue-64-investigation.md
New markdown document analyzing refresh/discovery behavior in the Beads extension, documenting the original v0.12.0 bug fix and identifying a remaining gap where newly discovered projects are not auto-activated when activeProject is unset. Proposes a minimal code change solution.
Project Manager Auto-activation
src/backend/BeadsProjectManager.ts
Updated refresh() method to automatically activate the first discovered project via setActiveProject() when no project is currently active, before firing the _onDataChanged event.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A refresh command once bare and plain,
Now seeks the first project without strain.
When none is set, we light the way—
Discover, activate, save the day! 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: auto-activation of newly discovered projects during refresh, which directly addresses the PR's core objective.
Linked Issues check ✅ Passed The code changes implement the primary requirement from issue #64: calling discoverProjects() and auto-activating the first discovered project when none is active, fixing the refresh command's failure to detect projects initialized after extension activation.
Out of Scope Changes check ✅ Passed All changes are directly scoped to issue #64: the three-line change in BeadsProjectManager.refresh() and investigation documentation are both focused on fixing the refresh command's project auto-activation behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/refresh-rediscover-projects

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@sandbox/issue-64-investigation.md`:
- Around line 3-6: Update the investigation doc to remove the stale claim that
discovered projects aren’t auto-activated: change the status/summary
table/“Remaining Gap” text to reflect that auto-activation is implemented, and
cite the implementation in the BeadsProjectManager class (the
discovery/activation method) as the source of truth; remove or reword the lines
that assert auto-activation is missing so the write-up no longer contradicts the
current code.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 71000f61-0bf8-41d2-9a0c-dc644d5d8ef4

📥 Commits

Reviewing files that changed from the base of the PR and between 797ef48 and fced8cb.

📒 Files selected for processing (2)
  • sandbox/issue-64-investigation.md
  • src/backend/BeadsProjectManager.ts

Comment on lines +3 to +6
## Status: Partially Fixed

The original bug (early-return preventing discovery) was fixed in the v0.13.0 refactor. A secondary gap remains: discovered projects aren't auto-activated.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Doc is now stale relative to the code in this PR.

Line 3 and the “Remaining Gap”/summary table still say auto-activation is missing, but src/backend/BeadsProjectManager.ts (Line 121-Line 123) now implements it. Please update this write-up to avoid future confusion.

📝 Suggested doc update
-## Status: Partially Fixed
+## Status: Fixed (for manual refresh flow)

-The original bug (early-return preventing discovery) was fixed in the v0.13.0 refactor. A secondary gap remains: discovered projects aren't auto-activated.
+The original bug (early-return preventing discovery) was fixed in the v0.13.0 refactor. This PR closes the secondary gap by auto-activating the first discovered project during refresh when no active project exists.
...
-## Remaining Gap
+## Previous Gap (now addressed in this PR)
...
-| New projects auto-activated | No | No (gap remains) |
+| New projects auto-activated | No | Yes (fixed in this PR) |

Also applies to: 54-63, 106-111

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@sandbox/issue-64-investigation.md` around lines 3 - 6, Update the
investigation doc to remove the stale claim that discovered projects aren’t
auto-activated: change the status/summary table/“Remaining Gap” text to reflect
that auto-activation is implemented, and cite the implementation in the
BeadsProjectManager class (the discovery/activation method) as the source of
truth; remove or reword the lines that assert auto-activation is missing so the
write-up no longer contradicts the current code.

@jdillon jdillon merged commit 7e620d9 into main Mar 23, 2026
2 checks passed
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.

fix: refresh command does not re-discover projects initialized after extension activation

1 participant