Skip to content

feat(sleep): add OpenCode CLI backend for plain replay - #218

Merged
Yifan Yang (Yif-Yang) merged 4 commits into
microsoft:mainfrom
YingqiDuan:feat/opencode-integration
Aug 13, 2026
Merged

Yifan Yang (Yif-Yang) merged 4 commits into
microsoft:mainfrom
YingqiDuan:feat/opencode-integration

Conversation

@YingqiDuan

@YingqiDuan YingqiDuan commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Part of #56

Implemented

  • Added OpenCode as a SkillOpt Sleep backend (--backend opencode) and wired it through the CLI, config, backend factory, and sleep cycle.
  • Added plain replay through the installed OpenCode CLI, using the user's existing OpenCode login, provider environment variables, and file-based global configuration.
  • Plain replay runs from a temporary working directory with project configuration, tool use, external plugins, and configured MCP servers disabled.
  • Added JSONL response parsing. Calls stop before model execution if SkillOpt cannot verify that all configured MCP servers are disabled, and failed calls are not cached.
  • Added focused tests, opt-in real-CLI smoke tests, documentation, and a changelog entry.

Validation

  • Focused automated tests: 61 passed, 2 skipped. The two opt-in live tests are skipped by default.
  • Live tests used OpenCode 1.18.15 with its built-in opencode provider and the free opencode/deepseek-v4-flash-free model. No SkillOpt-specific provider credentials were configured.
  • The real plain-replay and cycle-level smoke tests passed on Windows.
  • The same tests passed on Ubuntu 26.04 under WSL2 with Python 3.12.13.
  • Wheel and sdist builds passed, and the installed wheel passed a CLI smoke test.
  • Documentation built successfully with python -m mkdocs build --strict.
  • Full Windows test run: 932 passed, 17 skipped, 37 failed. The 37 failures were outside the OpenCode tests and were concentrated in existing Windows-specific Devin, Superpowers, Pi, and Cursor tests.

Scope and follow-ups

This PR covers the core OpenCode CLI backend and plain replay.

Separate follow-up work will cover:

  • OpenCode transcript harvesting and --source opencode
  • Structured tool replay with explicit opt-in
  • A native OpenCode Sleep plugin or command
  • Optional OpenCode support in the Copilot and Devin Sleep MCP integrations
  • A documented OpenCode version range and improved error reporting

@YingqiDuan

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@Yif-Yang

Copy link
Copy Markdown
Contributor

Thanks for starting this integration. A plain prompt/reply replay backend is a useful first OpenCode slice; transcript harvesting, structured tool replay, and plugin support can be separate follow-up PRs.

For the first mergeable version, could you please:

  • Validate it against the real OpenCode CLI (not only mocked subprocesses), and report the CLI version plus the auth/provider setup used.
  • Add a cycle-level end-to-end test or smoke-test report showing SkillOpt invoking OpenCode successfully. Please cover Linux and Windows if both are claimed as supported.
  • Make the security boundary explicit: project configuration, tools, plugins, and MCP integrations should be disabled by default for replay, with any broader capability requiring deliberate opt-in.
  • Document installation, the exact command/configuration, supported behavior, and current limitations, and add a changelog entry.
  • Change Closes #56 to Refs #56 or Part of #56, since the broader integration requested there is not completed by plain replay alone.

Once these points are covered, we will be happy to review the focused backend.

@YingqiDuan YingqiDuan changed the title feat(sleep): add OpenCode CLI integration feat(sleep): add OpenCode CLI backend for plain replay Aug 12, 2026
@YingqiDuan

Copy link
Copy Markdown
Contributor Author

Thanks for the clear guidance. I’ve updated the PR.

@YingqiDuan
YingqiDuan marked this pull request as ready for review August 12, 2026 03:17
@Yif-Yang
Yifan Yang (Yif-Yang) merged commit e1d62b0 into microsoft:main Aug 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants