Repository navigation
refactor(ocm): pair linked servers with native OpenCode links and drop legacy CLI stubs - #498
Conversation
…p legacy CLI stubs
| body: JSON.stringify({ nonce, proof }), | ||
| headers: { | ||
| Accept: 'application/json', | ||
| Authorization: buildOpenCodeBasicAuth(token, OPENCODE_SERVER_USERNAME), |
There was a problem hiding this comment.
Hardcoded username
Renewal always authenticates as OPENCODE_SERVER_USERNAME, not the server's stored username. A server whose username was edited after pairing, or that has a manually entered password matching the token pattern under a custom username, fails renewal with 401 on every cycle.
PR Reviewer Guide 🔍(Review updated until commit 6c6011e)Since the last review — 3 findings were open on the previous HEAD
Here are some key observations to aid the review process:
✅ Resolved findingsbackend/src/services/opencode-server-registry.ts:323-324Silent expiry When a pairing token has already expired ( backend/src/services/opencode-server-registry.ts:326-328Renewal race
|
|
Persistent review updated to latest commit 6c6011e |
User description
Summary
OpenCode now ships its own pairing (
opencode pair), so the Manager no longer needs ocm-cli's custom server-linking protocol.https://<host>/auth/connect/<code>link or the QR JSON ({code, urls, name?}) thatopencode pairprints, redeems the code for a session token, and stores it as the server password.POST /api/pairwith the current token. Plain passwords are never touched, and a failed renewal is logged and retried while the old token is still valid.ocm link, its one-shot/redeemlistener, theocm://linkserver-link schema and the HMAC/AES-GCM pairing crypto, along with their tests and theuqrdependency. The Manager app's ownocm://linkpairing for the mobile app is unchanged.POST /mirror,GET/POST /mirror/target).opencode pair --remote(oropencode pairon the same network).Tests
Registry tests cover link and QR parsing, redemption, renewal inside and outside the window, plain passwords, disabled servers and renewal failures. The event hub test covers renewal on start, every 12 hours, and stopping on shutdown. Typecheck and lint pass. Frontend (4126) and ocm-cli (437) tests pass. Backend tests pass except the macOS-only sandbox suites and the real-binary OAuth/provider tests that #497 fixes for OpenCode 2.4.
PR Type
Enhancement, Tests
Description
Adopt native OpenCode pairing instead of custom protocol
https://…/auth/connect/<code>links and QR JSON payloadsRenew pairing tokens automatically
Remove legacy code paths
ocm link, the/redeemlistener and HKDF/AES-GCM cryptoPOST /mirrorand/mirror/targetUpdate dialog copy, README and tests for the new flow
Diagram Walkthrough
File Walkthrough
5 files
Remove legacy 410 mirror upgrade stubsRemoveocm linkcommand and its usage entriesDelete one-shot pairing server and service discoveryRemove pairing crypto exports from shared packageDelete HMAC proof and AES-GCM pairing module4 files
Redeem native connect codes and renew pairing tokensSchedule pairing token renewal on start and intervalParse native connect links and update pairing guidanceReplace server link schema with connect link parser8 files
Cover native pairing parsing and token renewal pathsDrop tests for removed legacy mirror stubsAssert pairing failures use native connect endpointTest renewal timer start, interval and shutdownReplace opencode link tests with connect link testsTest native link prefill, errors and renewal noteForce linux platform to avoid Keychain promptsDelete tests for removedocm linkmodule1 files
Documentopencode pairworkflow and dropocm link1 files
Drop unuseduqrQR rendering dependency