Merge pull request #2663 from makeittech/fix/ope-236-question-tool-stuck

fix(sync): route question/permission replies by the request's own session directory
This commit is contained in:
Serhii Dziupin
2026-08-06 11:39:53 +03:00
committed by GitHub
4 changed files with 256 additions and 4 deletions
+4
View File
@@ -257,6 +257,10 @@ Examples of global-store updates performed in `session-actions.ts`:
- `deleteSession()` / `deleteSessions()` -> wait for server confirmation or `404`, then remove the session and its persisted state
- `moveSessionToDirectory()` -> move the session between directory stores and update the global directory index
### Blocking-request (question/permission) reply routing
`respondToQuestion`, `rejectQuestion`, `respondToPermission`, and `dismissPermission` route the reply through `resolveDirectoryForBlockingRequest`. The directory chosen decides which OpenCode instance resolves the pending request, so it must be the **session record's own server-confirmed directory** (ownership), never the containing child-store key (containment): a project store legitimately holds its worktree sessions, and a reply addressed to the parent instance makes the server answer `QuestionNotFoundError` while the question stays pending in the worktree instance — the session is then stuck on the running question tool with no recovery. When a reply/reject comes back not-found, the stale request is removed locally and a `settled-running-tool` tail materialization is enqueued so the trailing tool part converges to the server's actual state instead of leaving the UI on "asking question" forever.
### Restore (unarchive) contract
The OpenCode server cannot clear `time.archived` over HTTP: `session.update`