anomalyco / anomalyco/opencode
references: Git branches are not refreshed when an existing reference is attached
@kitlangton is already working on this.
Since Aug 27, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
A configured Git reference is fetched and hard-reset when its reference state materializes or reloads.
Attaching the existing reference with @<alias> later uses the cached checkout without fetching the configured branch first.
If the remote branch advances after initial materialization, the reference can remain stale indefinitely while the location stays active.
The only current refresh paths are unrelated lifecycle events such as a config reload, location-service recreation, or a service restart.
Plugins
oh-my-opencode-slim@2.2.17
OpenCode version
opencode2 v0.0.0-dev-18392
Source revision: 46aa25f236 on v2
Steps to reproduce
-
Configure a Git reference to a public repository and branch:
{ "references": { "example": { "repository": "<owner>/<repo>", "branch": "main" } } } -
Start or use OpenCode so
examplematerializes. -
Advance
mainin the remote repository. -
Without changing the effective OpenCode config or restarting the service, attach
@examplein the same active project location and inspect a file changed by the newer commit. -
The attached reference exposes the cached pre-update revision rather than fetching the newer branch head.
Screenshot and/or share link
N/A
Operating System
Fedora 44
Terminal
kitty
Additional context
There is no git pull or periodic Git-reference polling.
The internal cache uses fetch, checkout, and hard reset when reference materialization occurs.
Expected behavior: attaching a reference that tracks a branch should have a defined freshness guarantee, such as refreshing before it is used or providing an explicit user-visible refresh action/policy.
Workaround: restart opencode2 service, then access the project location again so the reference materializes and refreshes.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.