Repository navigation
fix(core): the newest installed copy of a harness is launched - #5
Merged
Merged
Conversation
When a harness was installed more than once, discovery took the first hit on PATH and the pin cache kept that file until its own mtime changed, so a newer copy elsewhere was never launched. Discovery now collects every copy on PATH and in the well-known dirs, runs `--version` on each and launches the newest. The pin is keyed on the whole candidate set (paths, mtimes, sizes), so an unchanged machine admits without a probe and any install, upgrade or removal re-probes. `subturn status` lists the older copies it skipped. Claude Fable 5.1 in Claude Code. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e517856f79
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A shim that dispatches to another file at run time keeps its mtime and size when its target is upgraded, so the candidate-set key alone would keep a stale choice. A pin older than a day is probed again. Claude Fable 5.1 in Claude Code. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
eshatalov
added a commit
that referenced
this pull request
Oct 3, 2026
OpenCode 2 keeps credentials and sessions in one SQLite file, `opencode.db`, and has no `auth.json`, so the opencode plugin could neither check the login nor build a shadow home. It also lists its models before its plugins have added theirs, so a spawn on an OpenCode Go model (or a provider from the user's config) was refused with "model not found" every time. The plugin now works with OpenCode 2 only. - **Login check.** Reads the `credential` table of the user's `opencode.db`, read-only. - **Shadow home.** A per-session snapshot of that file: `VACUUM INTO` from a read-only connection, then every table except the login and schema bookkeeping emptied. The user's sessions never reach the shadow and the shadow's sessions never reach the user's lists. - **`OPENCODE_DB`.** When the user's environment sets it, the login check and the snapshot read the file it names, and the child gets it set to the shadow database, so the subagent cannot write into the user's. - **OAuth logins.** Copied with an empty refresh token. The shadow can use the access token but cannot refresh it, so it cannot revoke the user's. When the token expires, turns in that shadow fail with an auth error and a new spawn snapshots the current login. - **Late models.** When the model is refused with `-32602`, the ACP turn sets it again after each `config_option_update`, for up to 5 s, and records each retry in the evidence. A model that never appears fails with the harness's own refusal, 5 s later than before. This needs OpenCode 2.0.21 or newer; upstream tracks the remaining gap in anomalyco/opencode#52472, and the retry can go once that lands. - **`subturn status`.** Models come from a throwaway ACP handshake in a temp shadow; `opencode models` would leave a background service running. It shows the list the server gives at session start, so late models such as `opencode-go/*` are not listed even though a turn can select them. - **Usage.** `cachedWriteTokens` and `thoughtTokens` are read from OpenCode 2's usage records. Node 22.13 is now the minimum, for `node:sqlite` without a flag. Two small riders, since they touch the same files: the docs and the live test name the current codex model ids (`gpt-6-luna`, `gpt-6.1-sol`), and plugin comments state each quirk without the date it was seen. For a reviewer: - Offline: `npm run typecheck`, `npm test` (36 pass, 3 live tests skipped). New tests cover the login check, the snapshot, resume reusing the shadow, and both late-model paths on the fake agent. - Live on OpenCode 2.0.22: smoke + resume on `zai-coding-plan/glm-5.3-flash` with `OPENCODE_DB` pointing at a copy of the user's database, which gained no session. Before the rebase onto #5: the same on `opencode-go/muse-spark-1.3-contributor`. Claude Fable 5.1 in Claude Code. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Merged
eshatalov
added a commit
that referenced
this pull request
Oct 11, 2026
Version bump for 0.2.0. Minor rather than patch because OpenCode support moved to OpenCode 2 (#6). Ships since 0.1.1: - #5 the newest installed copy of a harness is launched - #6 support OpenCode 2 - #7 OpenCode model is set once, without a retry - #8 Grok's requested model is no longer overridden by launch campaigns - #9 README: the caller's instructions are an inline example Done by Claude Opus 5.5 in Claude Code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
When a harness is installed more than once (for example an
npm -gcopy under nvm and a native copy in~/.local/bin), discovery took the first hit on PATH, and the pin cache kept that file until its own mtime changed. A newer copy elsewhere was never launched, and nothing reported it.Discovery now collects every copy on PATH and in the well-known dirs, runs
--versionon each and launches the newest. The pin is keyed on the whole candidate set (paths, mtimes, sizes): an unchanged machine admits without a probe, and any install, upgrade or removal re-probes. Duplicate PATH entries and symlink aliases of one file count once.subturn statuslists the older copies it skipped.For a reviewer:
discovery.jsonwithoutcandidatesis a cache miss and gets rewritten on the first turn.claudecopies: cold resolve 60 ms, warm resolve 0.55 ms per turn.test/discovery.test.tscovers PATH order, cache reuse, install, in-place upgrade, removal, aliases and a tie.npm run typecheckandnpm testpass; live tests were not run.Claude Fable 5.1 in Claude Code.
🤖 Generated with Claude Code