Repository navigation
feat(opencode): support OpenCode 2.1.x transfers - #27
Closed
jason-murray wants to merge 1 commit into
Closed
jason-murray wants to merge 1 commit into
jason-murray wants to merge 1 commit into
Conversation
OpenCode 2.1 keeps the 2.0 session export/import commands and flat transfer layout, but renames provider-owned data to `native` (text and reasoning `state`, tool `providerState`/`providerResultState`, assistant and compaction `providerState`), drops a summary compaction's stored `recent` tail in favour of a `metadata.keepID` reference, moves a provider compaction window to `native.messages`, and adds an optional `idle.error`. Every compacted 2.1 export currently fails with "compaction has invalid summary", and the version gate rejects 2.1 for native import. Project 2.1 transfers onto the validated 2.0 schema before validation, inverting OpenCode's own SessionLegacy upgrade, so omission codes stay the same across releases. Rebuild a missing `recent` from the keepID range with a port of SessionRecentText.messageToText, or take OpenCode's upgraded `metadata.recent`. Accept `idle.error`. Keep writing the 2.0 schema for 2.1 targets; stock 2.1 upgrades it on import. Accept the 2.1 series in the version gate, validate 2.1.4, and add an `opencode-v2.1` native CI job pinned to @opencode/cli@2.1.4 that runs the existing v2 native tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WW649bqoSmoitkj96NB5WB
|
🔴 Contributor eligibility requirements not met for @jason-murray.
See the contributor eligibility policy. Closing this PR because these requirements were not met. This policy is intended to reduce spam from AI agents; it is not an assessment of the quality of your change. |
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.
Closes #26.
Problem
OpenCode 2.1 (2.1.0 released 2026-10-20; 2.1.4 current) is refused for native import (
unsupported OpenCode CLI version: 2.1.4). Any compacted 2.1 export fails to read withOpenCode v2 compaction has invalid summary, because 2.1 no longer writesrecent. Uncompacted exports read, but report 2.1'snativefield as an unknown content field. Details and OpenCode source references are in #26.Change
_VERSIONaccepts2.0.xand2.1.x;2.1.4joinsVALIDATED_VERSIONS. Other 2.1 releases get the existingunvalidated_target_versionwarning, and 2.2/3.x still fail closed._from_2_1()projects a 2.1 transfer onto the 2.0 schema before_validate_native, applied into_legacyandloss_events. It's the inverse of OpenCode's ownSessionLegacyupgrade:native→stateon text/reasoning, and →providerStateon tools, assistant steps and compactions, so omission codes are the same for 2.0 and 2.1 sources. If both names are present, the 2.0 name wins.recenton a running/completed compaction is rebuilt from the messages betweenmetadata.keepIDand the compaction with_recent_text, a port of OpenCode'sSessionRecentText.messageToText, so the kept tail still appears as "Recent context" in conversions. It comes frommetadata.recentinstead when OpenCode upgraded the compaction from 2.0 storage, and is""otherwise. A present non-stringrecentstill fails closed.native.messageswindow is counted as private state and doesn't retire readable history, same as 2.0'sproviderContext.idle.erroris an accepted field (already validated and counted asopencode_v2_error).opencode-v2.1matrix job installs@opencode/cli@2.1.4and runs the same assigned v2 native tests. The native tests now acceptopencode_v2.VALIDATED_VERSIONSinstead of a hard-coded 2.0 set. The installer records 2.1.4 before 2.0.23, soallkeeps 2.0.23 as the default.docs/opencode-v2.md, plus version-family wording in the CLI reference, troubleshooting, compatibility, native-testing and development docs.Two existing expectations change on purpose:
test_version_schema_gate(2.1.0is now accepted;2.2.0and2.10.0added as rejected), and the running-compaction row intest_opencode_v2_review.py, whererecentis no longer required. A presentNone/[]/non-stringrecentis still rejected, covered by a new test.Testing
tests/test_opencode_v2_1.py(11 tests): native renames and their omission codes,keepIDtail reconstruction, fallbacks (no metadata, unresolvedkeepID, upgradedmetadata.recent), provider window privacy,idle.error, malformedrecent, and_recent_textagainst OpenCode's rendering (skills, attachments, truncation at 1,250 code points, tool error/streaming, background shell). 8 of the 11 fail onmain, withcompaction has invalid summaryand the missing helper; the other 3 are fail-closed checks that pass on both.ruff check .,ruff format --check …,git diff --checkandpython -m unittest discover .github/testspass.pytestwas run on Windows only (no Linux machine available). Failing test IDs are identical betweenmainand this branch (1181 each, all pre-existing Windows-environment failures), so there are no new failures. I'm relying on CI for the Linux suite and the newopencode-v2.1native job.target_cli_version="2.1.4", with no warnings. It imported throughinstall_opencode_artifact, the coldsession export --standalonereturned a 2.1-shaped compaction (norecent), and this branch re-parsed it with content and compaction intact. 0.12.0 fails on that same export. The repo's own native tests can't start OpenCode's standalone server on Windows because their stripped environment (PATH=/usr/bin:/bin) lacksSYSTEMROOT/APPDATA, so they need the Linux CI job.🤖 Generated with Claude Code
https://claude.ai/code/session_01WW649bqoSmoitkj96NB5WB