-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Hot Reloading for Config, Skills, Tools, and Agents #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @IgorWarzocha, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a robust hot-reloading system for critical application resources, dramatically improving the developer experience by providing immediate feedback on changes to configuration, skills, tools, and agents. By enhancing the underlying file watcher and integrating a new event-driven invalidation mechanism, the system can now dynamically adapt to file modifications without requiring manual restarts, streamlining the development workflow and ensuring a more responsive environment. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a significant and valuable feature: hot reloading for configurations, skills, tools, and agents. This will greatly improve the developer experience. The implementation is robust, featuring an enhanced FileWatcher, a new state invalidation mechanism, and a clever use of Instance.runInContext to manage asynchronous contexts. The changes are well-structured, with dedicated initWatcher functions for each component. The inclusion of new tests covering various hot-reloading scenarios, including file deletion, is a commendable addition that strengthens the feature's reliability. I have one suggestion to improve the clarity of a test case, but overall, this is an excellent and well-executed pull request.
…nd ensuring fresh file scans - Fixes bug where deleted commands persisted due to global config singleton pollution - Replaces cached Bun.Glob with fresh fs.readdir scan for config loading - Updates GlobalSync to listen for config.updated and skill.updated events - Ensures Bus emits events only after subscribers have processed changes - Adds file access check to markdown parser to handle race conditions - Includes WIP skill hot-reload improvements and tests
- Apply same fix as commands: replace cached Bun.Glob with fresh fs.readdir scan - Fixes issue where deleted skills persisted in the UI/backend - Updates test fixture to configure git user for robust testing - Verified with passing hot-reload test suite
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a significant improvement to the developer experience by implementing hot reloading for configurations, skills, tools, and agents. The changes are extensive, touching the file watcher, state management, and event bus to react to file changes without a server restart. The implementation is robust, especially the file watcher enhancements and the move away from Bun.Glob to a custom walk function. I've identified a few areas for improvement regarding code duplication and a correctness issue with tool hot reloading. Additionally, new tests have been added, which is excellent for ensuring the stability of this new feature.
- implement tool cache busting in registry.ts to support true hot reloading - refactor duplicate sdk client creation in global-sync.tsx
|
/gemini review |
|
Acknowledged. I will now perform a comprehensive code review of the pull request. Please allow some time for me to analyze the changes and provide detailed feedback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a robust hot-reloading mechanism for configurations, skills, tools, and agents, which is a fantastic improvement for the developer experience. The implementation is well-architected, leveraging a central event bus, state invalidation, and careful context management for asynchronous operations. The addition of comprehensive integration tests covering various file change scenarios (add, update, delete) provides strong confidence in the feature's correctness. My review includes a few suggestions to enhance maintainability by refactoring duplicated code blocks and to improve robustness by adding error handling for asynchronous operations in the UI.
- Replace targets loops with brace expansion glob patterns
- Use {command,commands}, {agent,agents}, {mode,modes}, {plugin,plugins}
- Add GLOB constants to match dev branch pattern
- Clean up Claude and OpenCode skill scanning
- Add toast error handling for config reload failures (app + tui)
- Functionality preserved, code now matches upstream standards
Reviewed Gemini's suggestions and applied dev branch patterns instead.
|
/opencode let me know if this is now sound. real life tests pass. code should be as per style guidelines, with no excessive logs etc, but some might have randomly sneaked through. Verify DRY, logging, excessive comments and code readability. |
|
Based on my review of the hot-reloading PR code, here's my assessment: ✅ Code is Sound - ApprovedStyle Guidelines - PASS
Logging - PASS (No excessive logs)
DRY Principle - ACCEPTABLEThe duplication in
Code Readability - PASS
Comments - MINIMAL & APPROPRIATE
Error Handling - ROBUST
Tests - COMPREHENSIVE
Verdict: The code follows the style guide, has minimal and appropriate logging, and the intentional duplication aligns with codebase patterns. The implementation is clean, readable, and well-tested. |

Summary
Implements hot reloading for core resources, allowing the system to react to file changes without restarting. This improves the developer experience by providing immediate feedback when modifying
opencode.json, skills, tools, or agents.Key Changes
FileWatcherto reliably detect file events (add, change, unlink) across the project, including.gitand config directories.opencode.jsonand updates the system state.SKILL.mdfiles and reloads them.Event.file.watcher.updated(and others) to propagate changes.prompt-input,session-header) to support the hot-reloading workflow.openapi.jsonandtypes.gen.tsto reflect the current event structure (removing deprecatedlsp.client.diagnosticsin favor of generic watcher events).Known Issues
Implementation Details
packages/opencode/src/file/watcher.ts: Centralized file watching logic with proper debounce and context handling.packages/opencode/src/config/config.ts: AddedConfig.initWatcherto handle configuration updates.