Skip to content

fix(sleep): add Windows AppData support for default OpenCode database discovery (#56) - #230

Merged
Yifan Yang (Yif-Yang) merged 1 commit into
microsoft:mainfrom
RohithPariki:fix/opencode-windows-db-path
Aug 20, 2026
Merged

fix(sleep): add Windows AppData support for default OpenCode database discovery (#56)#230
Yifan Yang (Yif-Yang) merged 1 commit into
microsoft:mainfrom
RohithPariki:fix/opencode-windows-db-path

Conversation

@RohithPariki

@RohithPariki RohithPariki commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #56 by adding native Windows %LOCALAPPDATA% and %APPDATA% environment variable resolution to default_opencode_db().

When running on Windows systems with XDG_DATA_HOME unset, skillopt-sleep --source opencode previously defaulted to ~/.local/share/opencode/opencode.db (a POSIX path that does not exist on native Windows). OpenCode on Windows stores its database under %LOCALAPPDATA%\opencode\opencode.db or %APPDATA%\opencode\opencode.db.


Key Changes :-

  1. skillopt_sleep/harvest_opencode.py:

    • Updated default_opencode_db() to inspect sys.platform == "win32" and check LOCALAPPDATA and APPDATA environment variables before falling back to ~/.local/share.
  2. tests/test_harvest_opencode.py:

    • Added test_default_database_honors_windows_appdata to verify Windows environment variable path resolution for default_opencode_db().
  3. Documentation (docs/reference/cli.md & plugins/README.md):

    • Documented the Windows %LOCALAPPDATA% / %APPDATA% default database path auto-discovery.

Verification

  • Ran unit tests: pytest tests/test_harvest_opencode.py (28/28 passed).
  • Ran code style check: ruff check skillopt_sleep/harvest_opencode.py tests/test_harvest_opencode.py (All checks passed!).

@Yif-Yang
Yifan Yang (Yif-Yang) merged commit 16671b1 into microsoft:main Aug 20, 2026
1 check passed
Yifan Yang (Yif-Yang) added a commit that referenced this pull request Aug 20, 2026
Two defects that shipped with the merged PRs:

harvest_opencode: the APPDATA branch added by #230 was unreachable.
`LOCALAPPDATA or APPDATA` resolves to the former in virtually every
Windows session, so a database that really lives under Roaming was never
found. Probe the candidate roots in order and pick the one that holds
opencode.db, falling back to the Local root for messaging when no
database exists yet; a relative OPENCODE_DB resolves below the same
selected root.

minimax_backend: configure_minimax_chat applied the region default
unconditionally and wrote it into MINIMAX_BASE_URL, so a proxy or
private gateway configured through the environment was silently
discarded as soon as model.minimax_region was set — trainer and
eval_only pass `cfg.get('minimax_base_url') or None`, i.e. None for the
common case. Track whether the base URL was chosen explicitly and only
fill in the region default when it was not, matching what the docs
already state.

Co-authored-by: Yif-Yang <Yif-Yang@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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.

Feat: Add Windows support for opencode plugin

2 participants