feat(chats): relocate managed chat worktrees via OPENCHAMBER_CHATS_DIR (#3135)
* feat(chats): relocate managed chat worktrees via OPENCHAMBER_CHATS_DIR
Projectless-chat worktrees were hard-pinned to
<home>/.config/openchamber/chats: the UI joined the path client-side,
workspace checks allowed only the config root, and identification matched
the literal path segment. When the OpenCode server runs as a separate
user (UID-separated setups), that root is unreachable — every chat
session answered HTTP 500 (EACCES on the session directory).
The server now owns the chats root. OPENCHAMBER_CHATS_DIR relocates it
(default unchanged: <config root>/chats); /api/fs/home answers
{ home, chatsRoot }; fs workspace checks accept the managed chats root
next to the config root; the client resolves the root from the server
(per-runtime cached, warmed at bootstrap so sync classification sees it)
and falls back to the home join for older servers.
Refs #3130
* chore: trim added comments to local precedent
* fix: forward managedChatsRoot through feature-routes-runtime to registerFsRoutes
* fix(chats): await the root warm-up and keep the legacy chats root owned
Review feedback on #3135:
- bootstrapGlobal now awaits warmChatsRootDirectory, so synchronous
session classification never sees an empty root cache (relocated
sessions were grouped as project sessions when the session list
outran /api/fs/home).
- managedProjectRoots keeps the legacy <config root>/chats entry next to
OPENCHAMBER_CHATS_DIR, so memory ownership of existing chats survives
relocation.
* fix(chats): distinguish chats-root fetch failure from older servers
* fix(sync): rehydrate managed chat sessions after the chats root warms
* fix(fs): pass managed roots through the symlink and git-dirs path checks after the main merge
* docs: drop changelog edits; changelog is the maintainer's release-time work
* fix(chats): keep legacy chat directories deletable while the root is relocated
* fix(chats): resolve roots before cleanup and initial session loads
* test(chats): type runtime spies against actual SDK contracts
---------
Signed-off-by: Steffen Mächtel <info@steffen-maechtel.de>
Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
committed by
GitHub
co-authored by
Bohdan Triapitsyn
parent
1d6b15bc04
commit
3df97908fe
@@ -1,3 +1,5 @@
|
||||
import { ensureChatsRootDirectory } from '@/lib/chatDirectories';
|
||||
import { opencodeClient } from '@/lib/opencode/client';
|
||||
import { describe, expect, test } from 'bun:test';
|
||||
import type { Session } from '@opencode-ai/sdk/v2';
|
||||
import type { Event } from '@opencode-ai/sdk/v2/client';
|
||||
@@ -331,3 +333,8 @@ describe('getDescendantIds', () => {
|
||||
expect(new Set(getDescendantIds(childrenMap, 'root')).size).toBe(3);
|
||||
});
|
||||
});
|
||||
|
||||
const originalHomeInfo = opencodeClient.getFilesystemHomeInfo;
|
||||
opencodeClient.getFilesystemHomeInfo = async () => ({ home: '/home' });
|
||||
await ensureChatsRootDirectory();
|
||||
opencodeClient.getFilesystemHomeInfo = originalHomeInfo;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { ensureChatsRootDirectory } from '@/lib/chatDirectories';
|
||||
import { opencodeClient } from '@/lib/opencode/client';
|
||||
import { describe, expect, test } from 'bun:test';
|
||||
import type { Session } from '@opencode-ai/sdk/v2';
|
||||
import { getRuntimeKey } from '@/lib/runtime-switch';
|
||||
@@ -250,3 +252,8 @@ describe('canShowSessionWorktreeMenu', () => {
|
||||
})).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
const originalHomeInfo = opencodeClient.getFilesystemHomeInfo;
|
||||
opencodeClient.getFilesystemHomeInfo = async () => ({ home: '/home/test' });
|
||||
await ensureChatsRootDirectory();
|
||||
opencodeClient.getFilesystemHomeInfo = originalHomeInfo;
|
||||
|
||||
Reference in New Issue
Block a user