Skip to content

fix(opencode): skip V2 setup when the context has no checkout directory - #4879

Merged
thedotmack merged 3 commits into
thedotmack:mainfrom
drakeo338:claude/4878-fix
Oct 19, 2026
Merged

thedotmack merged 3 commits into
thedotmack:mainfrom
drakeo338:claude/4878-fix

Conversation

@drakeo338

Copy link
Copy Markdown
Contributor

Fixes #4878.

OpenCode 1.18.35 also calls the plugin's setup() with a host registry that has no location or directory. setupV2 defaulted the directory to an empty string there, logged the loading banner, and registered every hook, so each worker write went out without a cwd and was rejected with "Missing cwd when ingesting observation". It now resolves the directory from location.directory (falling back to a top-level directory) and, when neither is a non-empty string, warns once and returns a no-op cleanup before creating the core.

The contract test that expected an empty-string fallback is updated; a new test covers the host-registry shape. The opencode contract tests pass on this commit (34 passed, 0 failed).

I used an AI coding assistant for this change and reviewed and tested it myself.

OpenCode 1.18.35 also calls the plugin's setup() with a host registry that
carries no `location`. setupV2 defaulted the directory to "" there, logged
the loading banner, created the core and registered every hook, so each
worker write went out without a cwd and was rejected with "Missing cwd when
ingesting observation".

Resolve the directory from `location.directory`, falling back to a top-level
`directory`. When neither is a non-empty string, warn once and return a
no-op cleanup before the banner and createCore.

Fixes thedotmack#4878
@greptile-apps

This comment has been minimized.

@greptile-apps

greptile-apps Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issues were found.

Summary

setupV2 now skips setup when the context has no non-empty directory.

  • OpenCode skips plugin setup when a context has no checkout.

Reviews (2) · Last reviewed commit: "test(opencode): cover an empty location...." · Reviewed by Greptile

@thedotmack
thedotmack merged commit cdd6810 into thedotmack:main Oct 19, 2026
8 checks passed
@thedotmack

Copy link
Copy Markdown
Owner

Merged, thank you @drakeo338! When OpenCode calls the plugin's setup() without a checkout directory (the extra host-registry call in 1.18.35), claude-mem now warns once and stays out of the way instead of registering hooks whose every write fails with "Missing cwd".

What I pushed:

  • merged main
  • added the empty location.directory case Greptile asked for, so that path has a regression guard too

It's on main and ships in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants