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.
|
Merged the latest dev into this branch and resolved the config-watch conflicts in 409d654. The watch plan preserves system configuration discovery and shared ignore rules, with symlink target coverage extended to system configs. Validated with Bun 1.4.4: the 57 config/watch tests pass across 10 repetitions (570 passes), and |
There was a problem hiding this comment.
The earlier test feedback is addressed. The live-watcher coverage is now one short test of two edits to a symlinked global config's target, and the other sources, dangling targets and retargeting are covered by watch-plan unit tests that start no watchers.
I re-ran the #53920 steps against serve from source. On the base, edits to the symlink target after the first were ignored (1111/1111/1111). With this PR each edit is picked up (1111/2222/3333). The new live test fails on the base and passes here. The config and watcher tests pass (72) and packages/core type-checks.
The public API is unchanged.
One small test-isolation point is inline: the new live test doesn't turn off system config discovery, which the neighbouring tests now do.
packages/core/test/config/config.test.ts:633: The neighbouring tests now addConfig.node.replace(Config.configured({ system: false }))so they don't read a real/etc/opencode(or/Library/Application Support/opencode) on the machine running them. System config has the highest priority, so ashellvalue there would break this test's assertions. Could you add the same replacement here?
|
Addressed the test-isolation feedback in fd56dd0. The symlink reload integration test now provides Validated with Bun 1.4.4: all 57 config/watch tests pass across 10 repetitions (570 passes), and |
|
Verified on Linux. Platform: Arch Linux, kernel 7.2.14, Bun 1.4.4. cd packages/core
bun test test/config/config.test.ts test/config/watch.test.ts test/filesystem/watcher.test.ts
# 73 pass, 0 fail, 242 expect() callsThe real-watcher test bun test test/config/config.test.ts -t "symlinked global config target"
# 1 fail after the 3s timeoutThe test fails without the target watch on Linux, not only on macOS. The dangling-target cases also pass: bun test test/config/watch.test.ts -t "watches the target"
# 5 pass, 0 failThis matches a live failure on v2.2.5. A global |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
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
Added by the opencode bot (AI-generated).
Related: #54933, #55119