feat(agent-adapter): probe and spawn opencode from the resolved binary (CODE-76)#244
Open
lucas77778 wants to merge 2 commits into
Open
feat(agent-adapter): probe and spawn opencode from the resolved binary (CODE-76)#244lucas77778 wants to merge 2 commits into
lucas77778 wants to merge 2 commits into
Conversation
Greptile SummaryThis PR adds probe-based OpenCode binary resolution and centralizes its server lifecycle. The main changes are:
Confidence Score: 5/5This looks safe to merge. No blocking issues found in the changed code.
What T-Rex did
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
Probe[Probe OpenCode runtime] --> Managed{Managed binary?}
Managed -->|Yes| Spawn[Spawn opencode serve]
Managed -->|No| Detected{Detected binary?}
Detected -->|Yes| Spawn
Detected -->|No| Fallback[Bare PATH fallback]
Fallback --> Spawn
Spawn --> Session[Per-session server]
Spawn --> History[Shared history server]
Session --> Ready[Wait for listening URL]
History --> Ready
Ready --> Client[Create SDK client]
Session --> Stop[SIGTERM then SIGKILL]
History --> Reap[Idle reap]
Reap --> Stop
Reviews (1): Last reviewed commit: "feat(agent-adapter): spawn opencode serv..." | Re-trigger Greptile |
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.
Extracts the CODE-76 work from the code-248 branch as a standalone PR, rebased onto latest master (two cherry-picked commits).
Changes
OpencodeProbe(src/probe/opencode.ts): detects a user-installed opencode CLI — daemon PATH scan plus the official install location~/.opencode/bin, each candidate verified via--version(bare semver, anchored whole-output match).opencodejoinsProbeableKindand the default prober set, so it now appears in theagent-runtime.listwire resource.opencode/serve.ts: allopencode servespawns (per-session live server and the shared history server) now go through one owned spawn path — binary fromagentRuntimeProber.resolveBinary('opencode')(managed → detected), bare-name PATH fallback for unprobed hosts. Replaces the SDK'screateOpencodeServer, which hard-codes bare-name PATH resolution, cannot set cwd, and doesn't setwindowsHide(Invariant 6).history-server.tsslims down to the manager logic, delegating spawn/readiness/termination toserve.ts.Conflict resolution notes
The original commits were authored on the code-248 branch; cherry-picking onto master required resolving conflicts in
AGENTS.md(root + agent-adapter) andhistory-server.tsimports. CODE-248 (pi adapter) context that leaked into the conflict hunks was deliberately excluded — this PR carries only the CODE-76 changes.Verification
pnpm check:ci— 0 errorspnpm test— 222 files / 1735 tests passed