Repository navigation
3.3.0: OpenCode 2 support - #9
Merged
Merged
Conversation
…istories OpenCode 2 writes service.json (with a plaintext password) into both the config and the state directory. The config directory is the repository worktree, so git add -A published it; includeState copied the state copy. Both are now ignored, untracked from repositories an older version wrote, and this machine's copy survives pulls of such commits.
…ject OpenCode 2 resolves OpenCode 2 stores sessions in session_v2/session_message/session_part; a fresh 2.2.5 database has no session table, so 3.2.0 failed every push with 'no such table: session'. Databases are now detected per machine and v2 sessions travel as formatVersion 2 shards with their event sequence, instruction and attachment rows. Runtime flags are reset so a receiving machine never resumes a conversation by itself. On import a session is placed in the project OpenCode 2 resolves for its directory (creating the deterministic directory project, mapping the exporting machine's home, parking unknown directories in the home project), otherwise /session never lists it. Shards of the other major version are skipped and kept.
Sessions OpenCode 2 migrated from 1.x keep the synthetic global project or a stale project row of the same worktree, so /session never lists them. repair-sessions moves each one into the project OpenCode 2 resolves for its directory, parks global sessions without one in the home project, and is a dry run unless --apply is given.
OpenCode 2 keeps accounts in the credential table and reads auth.json at most once; a database created fresh by 2.x never reads it at all, so syncing auth.json did nothing. With includeCredentials on, the bridge copies the account OpenCode uses into auth.json before a push and applies incoming entries after a pull. Change detection uses per-integration fingerprints in a machine-local file (hashes only). Rotated OAuth tokens update in place, a later expiry wins a conflict, a missing incoming entry never logs a machine out, and a broken auth.json is left untouched.
With credential sync on, every machine holds the same ChatGPT OAuth login and a refresh invalidates the old refresh token, so machines refreshing independently log each other out. The scheduled job now claims refs/leases/openai with --force-with-lease (atomic on the server) before refreshing three days ahead of expiry; a claim older than 15 minutes may be taken over. The token request runs in a child process so the configured proxy applies, and the token travels on stdin. On by default with includeCredentials, off with openaiRefreshLease: false.
…to lazyalex616 cli.json (OpenCode 2 interface preferences) joins the config category; plugin entries pointing into this machine's global plugins folder are dropped before staging. OpenCode 2 reloads configuration by itself, so the restart hint now says when a restart is still needed. Repository URLs follow the account rename.
…ocal copy Found in the two-home OpenCode 2.2.5 sandbox: after importing a session, the receiving machine re-exported it on its next push because its shard bytes differ (origin home, placement), so every received session bounced back as a change. An existing shard at least as new as the local session is now kept as it is.
Version bump, CHANGELOG (en, zh-CN) and README sections: what is never synced, OpenCode 2 sessions, credentials and the OpenAI lease, repair-sessions, Upgrading to OpenCode 2.
Restructured around what users do: install, first run, what gets synced, an OpenCode 2 overview, autosync, overrides, sessions, credentials, safety, menu, plugin, commands, settings reference, troubleshooting and upgrading. Adds requirements, the credential bridge and OpenAI lease, repair-sessions, and OpenCode 2 troubleshooting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OpenCode 2 support (3.3.0).
service.json(config and state folder, both hold a password) is never committed and is untracked from repositories 3.2.x wrote it into. Lock files and per-machine histories are machine-local.session_v2etc.); a fresh 2.x database has nosessiontable, so 3.2.0 failed every push there. Imported sessions are placed in the project OpenCode 2 resolves, so they show in/session. OpenCode 1 and 2 machines can share a repository.opencode-sync repair-sessions [--apply]for sessions OpenCode's own 1.x migration hid.auth.jsonand the OpenCode 2credentialtable.refs/leases/openai,--force-with-lease).cli.jsonshared without machine plugin paths; restart hints updated; URLs moved to lazyalex616.Verified locally:
npm run check(255 passed), and end to end with two isolated OpenCode 2.2.5 homes and a local bare remote (session visible viaopencode session liston the other machine, account switch propagated, plugin loads without errors). All test values are fake.