fix: preserve desktop workspace cwd across continuations - #49860
fix: preserve desktop workspace cwd across continuations#49860kemaldoganay wants to merge 1 commit into
Conversation
|
Related: #42228 (issue — compressed sessions drift to "No workspace" when continuation cwd is null), #42240 / #42233 (narrower compression-cwd-inheritance fixes in This PR is the multi-layer fix: it combines the compression-rotation cwd inheritance ( |
|
Thanks for working on this. I reproduced the core bug on current We need the narrow fix locally now, but do not want to create an uncoordinated competing PR. I’m preparing a clean, minimal branch from current upstream that will:
Are you planning to rebase #49860? If so, I’m happy to keep our branch local and share tests/evidence. Otherwise, would you or the maintainers prefer a small superseding PR that credits and references this work plus #42240/#41678? |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for pursuing the cross-layer workspace-drift issue. The underlying rotation defect remains on current main, but this branch needs a focused salvage.
Problems
- The new continuation call copies only
cwd(agent/conversation_compression.py:606in this PR). Current rows also carrygit_branchandgit_repo_rootthroughSessionDB.update_session_cwd()(hermes_state.py:2126-2162), so workspace metadata remains incomplete after rotation. - Current projection replaces root metadata with every tip field, including null
cwd,git_branch, andgit_repo_root(hermes_state.py:3517-3524). The PR does not change that persisted historical-list path, so existing null-tip continuations can still lose their workspace grouping.
Suggested changes
- Preserve or recompute the full workspace metadata when creating the continuation, and retain nearest non-null lineage metadata during tip projection.
- Add focused tests for a null-metadata continuation and a multi-rotation lineage; the current test only covers a non-null tip cwd (
tests/test_hermes_state.py:4105-4121). - Reapply the gateway/Desktop portion to current deferred-resume/session-action structure before salvage.
Automated hermes-sweeper review.
| @@ -598,6 +606,7 @@ def _release_lock() -> None: | |||
| model=agent.model, | |||
There was a problem hiding this comment.
This preserves only cwd. Current session rows also retain git_branch and git_repo_root (hermes_state.py:2126-2162), while projected sidebar rows replace all three from the continuation (hermes_state.py:3517-3524). Please preserve or recompute the git metadata here as well, and add the null-tip projection fallback.
Summary
cwdwhen context compression rotates into a continuation session.Test plan
venv/bin/python -m pytest tests/test_tui_gateway_server.py tests/agent/test_compression_logging_session_context.py -q289 passed, 8 warningsnpm --prefix apps/desktop run typechecknpm --prefix apps/desktop run test:ui -- src/store/session.test.ts21 passedNotes
This fixes a Desktop sidebar drift case where compression continuation sessions could reappear under
No workspaceafter app restart even though their parent session belonged to a concrete workspace.