Repository navigation
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: |
There was a problem hiding this comment.
I reproduced #53920 on the base: with ~/.config/opencode/opencode.json symlinked to a dotfiles file and serve running, edits to the target after the first one were ignored (1111/1111/1111). With this PR each edit is picked up (1111/2222/3333). The new test times out on the base and passes here. The core and watch tests pass and packages/core type-checks.
The approach looks right. The watch plan resolves each config symlink's target and adds a watch on the target's parent directory, alongside the existing directory watches. If the target is missing it is still watched, because resolve falls back to the plain path when the file isn't found. Retargeting the link triggers a reload, which rebuilds the plan with the new target.
My one request is about the new integration test (see inline comment): it is large and timing-sensitive for what it checks.
Issue for this PR
Closes #53920
Type of change
What does this PR do?
Config watches cover the directory containing a symlink, but miss edits to its target outside that directory. Resolve file symlink targets when building the watch plan and include them in the existing parent-entry watches. Keep the original paths watched so retargeting the link reconciles the target watch, and retain the original document paths for relative config references.
Reading the link before resolving its target also keeps a watch when the target file is temporarily absent, allowing deletion/recreation and atomic saves to reload.
How did you verify your code works?
.opencode, and explicit config symlinks, including dangling targets and retargeting, without starting filesystem watchers.bun test test/config/config.test.ts test/config/watch.test.ts test/filesystem/watcher.test.tsfrompackages/core: 63 passed.bun run checkfrom the repository root: passed, including all 36 typecheck tasks.Screenshots / recordings
Not applicable (filesystem/config change).
Checklist