Skip to content

feat(sleep): add OpenCode integration and backend#55

Open
norandom wants to merge 1 commit into
microsoft:mainfrom
norandom:feat/opencode-sleep-backend
Open

feat(sleep): add OpenCode integration and backend#55
norandom wants to merge 1 commit into
microsoft:mainfrom
norandom:feat/opencode-sleep-backend

Conversation

@norandom

Copy link
Copy Markdown

Summary

  • add an OpenCode integration with /sleep command, skill, installer, and MCP wiring
  • mine native OpenCode sessions from ~/.local/share/opencode/opencode.db via read-only SQLite
  • add --backend opencode using opencode run for model-backed replay, judging, mining, and reflection
  • wire OpenCode path/model/source options through CLI, MCP, experiments, docs, and tests

Validation

  • python3 -m py_compile skillopt_sleep/backend.py skillopt_sleep/main.py skillopt_sleep/cycle.py skillopt_sleep/experiments/run_experiment.py skillopt_sleep/experiments/run_gbrain.py skillopt_sleep/experiments/run_transfer.py skillopt_sleep/experiments/sweep.py plugins/copilot/mcp_server.py
  • python3 -m pytest -q

Note: I did not run a live opencode model call to avoid spending user budget; subprocess behavior is covered with mocked tests.

@norandom

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree [company="Because Security"]
@microsoft-github-policy-service agree company="Because Security"

@norandom

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@Yif-Yang

Copy link
Copy Markdown
Contributor

Review feedback

Thanks for the OpenCode integration — the SQLite session mining and --backend opencode support are useful additions.

However, this PR cannot be merged as-is because it removes existing features that are actively used on main:

Removed Impact
ThreadPoolExecutor parallelism in replay_batch() / multi_rollout() All replay becomes serial — significantly slower for real API backends
scheduler.py (138 LoC) + schedule/unschedule CLI commands Built-in cron scheduling removed
_task_guardrail() function SpreadsheetBench output-contract safety check removed
TaskRecord.system field Research benchmarks with custom rollout system prompts break
sample_id threading from attempt() / replay_one() Cache-safe K-rollout removed
Gate-off path in consolidate.py Now always runs val scoring even when gate is off (wasted API cost)

The PR is net −906 lines — most of those deletions are existing features, not dead code.

Requested action: Please rebase onto the latest main and keep only the additive changes:

  • New OpenCodeBackend class + harvest_opencode.py (SQLite mining)
  • --source opencode / --backend opencode CLI wiring
  • Tests for the new backend
  • Plugin files (plugins/opencode/)
  • Doc updates

All existing backends, parallelism, scheduler, guardrails, and TaskRecord.system should be preserved as they are on main. The rebase conflicts are all in docs/scripts — the Python-side conflict in backend.py is just adding your new dispatch alongside the existing ones.

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