* docs: add SDK v1.17.12 migration plan — phase 4 (session.permission) * feat(permissions): verify pending permission before auto-accept via SDK v1.17.12 Adds createPermission() and fetchPermission() wrappers on OpencodeService for the new v2.session.permission endpoints (OpenCode SDK 1.17.12). fetchPermission() is used by the auto-accept sweep in resyncBlockingRequestsForDirectory to verify a permission is still pending before replying. The auto-accept flow now skips permissions that are already resolved, returning a null from fetchPermission() rather than blindly calling respondToPermission on a stale entry. createPermission() is exposed for future programmatic permission creation; the V1 list/reply path used by the UI is unchanged. The plan doc at plans/opencode-v1.17.12-sdk/ was rebased onto origin/main in the prior commit to keep the PR diff focused on this change. Closes #1972 * fix(permissions): drop confirmed-resolved permissions from auto-accept resync fetchPermission() now returns a tagged FetchPermissionResult so the auto-accept loop can distinguish a server-confirmed 404 (the permission is no longer pending) from a fetch failure (network error or pre-v1.17.12 server). Previously both cases collapsed to null, so a permission the server had already answered would still appear in the resync output and trigger a spurious 'Permission needed' toast. The auto-accept loop in resyncBlockingRequestsForDirectory now tracks both accepted and resolved permissions, then drops both from the 'grouped' map before it falls through to the toast path. On a pre-v1.17.12 server (no V2 endpoint) the call still returns 'unknown' and the permission stays in the resync output so the user can answer manually — fail-closed, no false-resolved signals. Adds a focused unit test for fetchPermission (4 cases: 200 ok, 404 resolved, 500 unknown, network throw) mocking the V2 SDK client shape. --------- Co-authored-by: bashrusakh <bashrusakh@users.noreply.github.com>
1.5 KiB
1.5 KiB
Handover — Session 1 (2026-07-01)
Current state
Plan created for OpenCode v1.17.12 SDK migration. No code changes made yet.
What was done
- Verified SDK v1.17.9 types against v1.17.12 release notes
- Identified 3 actually-new methods:
session.interrupt(),session.events(),session.permission - Identified 2 existing-but-unused:
Session3.messages()with cursor,Session3.message() - Created 4-phase plan with implementation details
- Created 4 GitHub issues (#1968, #1969, #1971, #1972)
- Created 4 draft PRs (#1973, #1974, #1976, #1977)
- Answered bot questions on all issues
Key findings
session.interrupt()is the highest-impact change — fixes abort propagation to upstream providersession.events()andsession.permissionmust be verified in SDK types before implementationSession3API has different parameter shape thanSession2—directoryis client-scoped,beforereplaced bycursorglobal.event()is already used correctly — no changes needed- Custom WebSocket/SSE in
event-pipeline.tsis OpenChamber-specific (coalescing, routing, backpressure) — not a replacement for SDK
Next safe action
- Bump
@opencode-ai/sdkto^1.17.12and runbun install - Verify new SDK types exist (
session.interrupt,session.events,session.permission) - Start Phase 1: replace
session.abort()→session.interrupt()in 3 call sites
Blockers
- SDK v1.17.12 must be published and installable
session.events()andsession.permissionexistence unconfirmed