Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
The fix works. I ran the #51936 reproduction with OpenCode built from source: after editing the target of a symlinked AGENTS.md, a new session on the base still got the old instructions, and with this pull request it gets the new ones. The new test fails on the base and passes here, the instruction-discovery tests pass, and typecheck:tsc is clean.
Public API: unchanged.
No blocking concerns. Targets are never unwatched after a link is repointed, but that only costs an occasional extra rescan, and the number of watches is limited to the targets actually seen.
Related: #54933
Project AGENTS.md files were watched at their link path but read through the resolved path, so editing the target of a symlinked AGENTS.md never refreshed the instructions. Also watch each resolved target that is not a candidate path. A target stays watched once seen, so one that is deleted and recreated is still picked up.
rafaetri
force-pushed
the
symlinked-agents-watch
branch
from
December 1, 2026 09:24
f30ba5a to
722e0bc
Compare
This branch has not been deployed
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.


Issue for this PR
Closes #51936
Type of change
What does this PR do?
When the project AGENTS.md is a symlink, OpenCode watches the link path but reads the file it points to. Editing that file never triggers a rescan, so new sessions keep the old instructions until restart.
The fix also watches each resolved target that is not already watched as a candidate path. A target stays watched once seen, so one that is deleted and recreated is still picked up.
How did you verify your code works?
instruction-discovery.test.ts: edits the symlink target, deletes and recreates it, then repoints the link and edits the new target. It fails on dev and passes with the fix.bun run testandbun run typecheck:tscin packages/core.Screenshots / recordings
Not a UI change.
Checklist
Added by the opencode bot (AI-generated).
Related: #54933