mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
fix: check the Assistant config inside its lock and pass bare stream events through (OM-179)
ensureAssistantMode now checks whether opencode.json exists after taking the file lock, so a conversion that ran in between cannot leave it acting on a stale result. The browser event stream again delivers a message frame that carries a typed event without the directory envelope, as it did before the client migration, instead of dropping it silently.
This commit is contained in:
1 parent
052b501963
commit
8b6ed7a861
3 files changed
+20
-4
No files matched your search
@@ -1183,8 +1183,6 @@ export async function ensureAssistantMode(
|
||||
const assistantAgentPath = getAssistantDefaultAgentPath(assistantDir)
|
||||
|
||||
const agentsMdExists = await fileExists(agentsMdPath)
|
||||
const opencodeJsonExists = await fileExists(opencodeJsonPath)
|
||||
|
||||
const overwriteOpenCodeConfig = options?.overwriteOpenCodeConfig ?? false
|
||||
|
||||
const overwriteAgentsMd = options?.overwriteAgentsMd ?? false
|
||||
@@ -1212,6 +1210,7 @@ export async function ensureAssistantMode(
|
||||
}
|
||||
|
||||
const opencodeJsonUpdated = await withFileLock(opencodeJsonPath, async () => {
|
||||
const opencodeJsonExists = await fileExists(opencodeJsonPath)
|
||||
const existingOpenCodeJsonContent = opencodeJsonExists ? await readFileContent(opencodeJsonPath) : undefined
|
||||
const parsedOpenCodeConfig = existingOpenCodeJsonContent === undefined
|
||||
? undefined
|
||||
|
||||
Reference in new issue
Block a user