fix(desktop): new session inherits active project cwd when not entered (#66686) - #66898
fix(desktop): new session inherits active project cwd when not entered (#66686)#66898Enough1122 wants to merge 1 commit into
Conversation
a93945e to
f1930ab
Compare
|
The branch was force-pushed after an earlier triage bot comment ( Current diff is single-file and matches the PR description exactly:
This AI-assisted PR was drafted by Hermes Agent on behalf of @Enough1122. Happy to rebase / split / close if reviewers prefer a different shape. |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for isolating the previously accumulated commits; the current diff is focused, and apps/desktop/src/store/projects.ts:139-151 confirms the active-project fallback is a real resolver gap.
Problems
- This does not yet fix #66686 end-to-end. Fresh drafts seed cwd from the resolver in
apps/desktop/src/app/session/hooks/use-session-actions/index.ts:271-283, then invokerefreshHermesConfig()inapps/desktop/src/app/contrib/hooks/use-background-sync.ts:129-136. That handler overwrites cwd withconfig.terminal.cwdwhile no session is active (apps/desktop/src/app/session/hooks/use-hermes-config.ts:71-78). The PR fallback can therefore be overwritten by the reported path. - No regression test covers either
$activeProjectIdresolver precedence or that fresh-draft/config-refresh sequence;apps/desktop/src/store/projects.test.ts:126-168currently only verifies project creation updates the active-id atom.
Suggested changes
- Either re-scope this as the independent resolver fix, or preserve an explicit project cwd through the fresh-draft config refresh so it satisfies #66686.
- Add direct precedence and full fresh-draft regression coverage.
Automated hermes-sweeper review.
| // new sessions silently drop back to ~/AppData/Local/hermes/workspace | ||
| // even when the user has an active project bound to a real directory. | ||
| // See issue #66686. | ||
| const activeId = $activeProjectId.get() |
There was a problem hiding this comment.
This fallback fixes the resolver gap, but it cannot by itself fix #66686: after startFreshSessionDraft() seeds this cwd, the fresh-draft background effect calls refreshHermesConfig(), which replaces cwd with config.terminal.cwd whenever no session is active (use-hermes-config.ts:71-78). Please either cover that overwrite path or re-scope the PR away from Fixes #66686.
|
Per the review, this PR re-scopes to the resolver-only fix. The fresh-draft What's in this PR:
Updating the PR description: dropping the "Fixes #66686" claim, will re-scope as "Refs #66686 / independent resolver fix." A follow-up PR will cover the Branch: |
cf6a30e to
3069295
Compare
3069295 to
d061798
Compare
|
cc @teknium1 — rebased onto current upstream main. The fix is unchanged in content (2 files, +89/-8). Both commits preserved:
The fresh-draft Ready for maintainer re-review. — written by Hermes Agent on behalf of @Enough1122 |
d061798 to
d22428f
Compare
|
cc @teknium1 — final state for this PR on current upstream The headline
Why the diff stat looks big: this PR was originally authored against an older Verification:
Both commits preserved as authored: Ready for maintainer re-review. — written by Hermes Agent on behalf of @Enough1122 |
d22428f to
68aa99a
Compare
|
cc @teknium1 — re-pushed with cleaner cherry-pick. New head SHA: Verification (just ran on the new head, fresh evidence):
The 5 failures all live in Diff stat reality check (re-confirmed on new head): Headline is line-level add/remove count (includes reorder). Actual net change:
Ready for maintainer re-review. — written by Hermes Agent on behalf of @Enough1122 |
NousResearch#66686) - Add $activeProjectId fallback in resolveNewSessionCwd() so new sessions land in the active project directory even when the user has not explicitly entered it from the sidebar (common after project_create / project_switch). - View scope ($projectScope) still takes precedence; $activeProjectId is only consulted when scope is ALL_PROJECTS. - Add regression tests for resolver precedence: view-scope wins, $activeProjectId fallback, repo-path fallback, and no-match default. Re-scoped per review feedback on NousResearch#66898: the refreshHermesConfig() overwrite path (config.terminal.cwd) has been resolved on current main — use-hermes-config.ts no longer sets cwd from config.terminal.cwd, and use-hermes-config.test.ts already guards that boundary.
68aa99a to
d471fc9
Compare
|
cc @teknium1 — rebased onto current upstream Both commits preserved as authored:
**Verification (re-verified on new base):
Ready for maintainer re-review. — written by Hermes Agent on behalf of @Enough1122 |
|
Review feedback addressed — The |
|
Closing this stale PR for now: it has not reached a mergeable/reviewed state and is unlikely to be merged in its current form. Reopen or submit a fresh PR if the issue remains relevant. |
Summary
in only consulted (view state, set when the user enters a project from the sidebar overview). It ignored (durable pointer in , set by / ).
When a user has an active project but never explicitly enters it from the sidebar overview, stays at — so new sessions silently fall back to instead of the active project directory.
This matches the regression reported in #66686 (desktop build stamp ).
Fix
After the existing check fails (or scope is ), fall back to against the same . Only after both miss do we return .
The scope check still wins (entering a project is more specific), so the new path only fires for users with an active project they haven'''t drilled into from the sidebar.
Test plan
Fixes #66686.