You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7c158b6
Browse filesBrowse the repository at this point in the historyBrowse files
fix(chat): scope /question and /permission list+reply by directory
opencode's WorkspaceRoutingMiddleware filters the in-memory pending maps
for /question, /permission, and their /reply endpoints by the request's
`?directory=` query (or the matching header / cwd fallback). bui was
calling all four unscoped, with three consequences for any session whose
worktree wasn't the server's default:
1. Initial-mount fetch of /question returned [] even when a question
was live. The transcript's `question` tool sat `state: running`
forever and the QuestionCard never appeared. The `que_…` reply
token was already broadcast once on the scoped SSE stream, so
panels that mounted late lost the only handle they had on it.
Manual recovery required a CLI curl with `?directory=` set.
2. Same shape for /permission: PermissionCards never appeared on
non-default-workspace sessions, blocking the tool indefinitely.
3. /permission/:id/reply silently no-op'd when posted unscoped — the
UI flipped optimistically, the server kept the request pending,
the tool stayed paused until the user noticed.
Thread `sessionId` through opencodePermissions / opencodeQuestions /
opencodePermissionReply (renderer → preload → ipc → main → fetch). In
main/opencode.ts, append `?directory=` from the existing
`getSessionDirectoryQuery` helper before issuing the request. The
helper already powers prompt_async, replyQuestion, rejectQuestion, and
others — list/reply are the last unscoped holdouts.
Update the obsolete chatUtils.ts comment that claimed `GET /question`
always returns empty for live questions; the fix makes that path
authoritative, with the SSE event still driving live in-session
updates as a no-round-trip optimization.
Verified live against opencode 1.15.5:
curl /question → []
curl /question?directory=<session-cwd> → full pending list with que_…
References anomalyco/opencode#27907 (busy-session deadlock symptom) and the
prior tilde-directory fix (memory: opencode-tilde-directory-corruption).
All 238 tests pass; tsc clean on web + node configs.
Co-Authored-By: WOZCODE <[email protected]>
0 commit comments