fix(background-agent): pass query directory to session.get in 4 call-sites (#2937)
resolveSubagentSpawnContext and related lookups called client.session.get without the query.directory parameter, causing project-scoped sessions to 404 under newer OpenCode SDK versions. Threaded directory through SpawnerContext/BackgroundManager so all four call-sites pass it. 🤖 Generated with OhMyOpenCode assistance https://github.com/code-yeongyu/oh-my-opencode
This commit is contained in:
@@ -35,9 +35,16 @@ function isSessionNotFoundError(error: unknown): boolean {
|
||||
return message.includes("not found") || message.includes("missing")
|
||||
}
|
||||
|
||||
export async function verifySessionExists(client: OpencodeClient, sessionID: string): Promise<boolean> {
|
||||
export async function verifySessionExists(
|
||||
client: OpencodeClient,
|
||||
sessionID: string,
|
||||
directory?: string
|
||||
): Promise<boolean> {
|
||||
try {
|
||||
const response = await client.session.get({ path: { id: sessionID } })
|
||||
const response = await client.session.get({
|
||||
path: { id: sessionID },
|
||||
...(directory ? { query: { directory } } : {}),
|
||||
})
|
||||
|
||||
if (response.error !== undefined && response.error !== null) {
|
||||
return !isSessionNotFoundError(response.error)
|
||||
|
||||
Reference in New Issue
Block a user