Repository navigation
Add the opencode adapter (six agent CLIs now) - #53
Merged
Merged
Conversation
Resume mechanism confirmed against the live CLI reference (opencode.ai/docs/cli) and opencode's own dev-tip source: `opencode --session <id>` resumes exactly; `--continue` is never emitted, since anomalyco/opencode#2086 shows it can resume a subagent's thread instead of the parent's. Sessions are confirmed to live in one global SQLite database (packages/core/src/{global,database/database}.ts), not a directory of per-session files, so session_root/session_id_from_path/ owns_session_file stay at the trait default (None/Unknown) rather than faking a scannable path — documented in the module doc as a researched limitation, not an oversight.
Declares the module and adds it to adapter_specs() right after gemini — matching the research doc's priority ranking (codex, gemini, opencode) — so registry() and picker_ids() both pick it up.
…ferred Adding the opencode adapter made the picker test's one-letter 'p' query match two rows instead of one, so its 'no second row survives' assertion failed. The test's point is that type-ahead narrows to exactly one row, not that any particular adapter is alone under a single letter — so the query is now 'pi', with an added assertion that opencode (the other 'p' match) is the row that drops. README's roadmap line still listed opencode as deferred and predated native selection.
Owner
Author
|
Merging on local verification: GitHub Actions is in a major outage, so CI cannot run. Verified against the rebased merge result — 657 tests pass, clippy unchanged. The one red is |
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.
Adds the opencode adapter, the third of the three the competitive research recommended. roost now covers six agent CLIs: pi, Claude Code, shell, codex, gemini, opencode.
The research changed the design, which is why it was worth doing first. The published troubleshooting docs describe per-project
project/<slug>/storage/session directories. That is stale — opencode's own source (packages/core/src/global.ts,database/database.ts) stores sessions in one global SQLite database at$XDG_DATA_HOME/opencode/opencode.db. There are no session files to scan.So
session_root,session_id_from_pathandowns_session_filestay at the trait default and detection degrades honestly toSessionState::Unknown, rather than fabricating a directory that doesn't exist. Reading the database would mean a new SQL dependency or shelling out, neither of which this crate does anywhere. That limitation is documented in the module as a researched conclusion, not left looking like an oversight — the same shape as codex's date-bucketed (not cwd-bucketed) sessions.Confirmed against source rather than assumed:
opencode --session <id>(-s).--continueis never emitted — opencode --continue should not resume from subagent tasks anomalyco/opencode#2086 is exactly the hazard of it resuming a subagent's thread instead of the parent's. A test guards its absence.ses_plus 26 base62 characters (packages/schema/src/session-id.ts), comfortably inside the existingvalid_session_idguard — no loosening needed.Five tests: launch shape, resume shape plus the
--continue/-cabsence guard, id round-trip throughvalid_session_id,session_rootis None across two different cwds,session_statealways Unknown, anddetect_sessionreturning None with a populatedtakenset.Two fixes outside the adapter, both caused by it:
the_picker_draws_both_columns_and_the_live_filterasserted that a one-letterpquery leaves exactly one row. Addingopencodegavepa second match, so it failed. The test's actual point is that type-ahead narrows to one row — not that some adapter happens to be alone under a single letter — so the query is nowpi, with an added assertion thatopencodeis the row that drops.644 unit tests plus all integration green; clippy unchanged.
opencodeisn't installed on the build host, so there is no live subprocess smoke test.