-
Notifications
You must be signed in to change notification settings - Fork 3
PATCH /config hot-reload w/ selective cache invalidation #15
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
Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…nit (#13) * Initial plan * Fix race condition in ConfigInvalidation.setup() using Promise-based pattern Co-authored-by: kcrommett <523952+kcrommett@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: kcrommett <523952+kcrommett@users.noreply.github.com>
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let releaseFn: () => void | ||
| const lockPromise = new Promise<void>((resolve) => { | ||
| releaseFn = resolve | ||
| }) | ||
|
|
||
| fileLocks.set(normalized, lockPromise) | ||
|
|
||
| const releaseFilesystem = await acquireFilesystemLock({ | ||
| filepath: normalized, |
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.
Remove in-memory lock when filesystem acquisition fails
If acquireFilesystemLock throws (e.g., permission issues or a stale .lock file that can’t be removed), the code has already inserted normalized into fileLocks with an unresolved promise. The exception bubbles out before the entry is cleaned up or the promise resolved, so every later caller of acquireLock will block forever awaiting the stale promise and the lock can never be recovered without restarting the process. Wrap the filesystem acquisition in a try/finally (or catch) to delete the map entry and resolve the promise on error.
Useful? React with 👍 / 👎.
* PATCH /config hot-reload w/ selective cache invalidation (#15) PATCH /config hot-reload w/ selective cache invalidation * typecheck fix * chore: format code * fix for failing test * fix for failing test * chore: format code --------- Co-authored-by: GitHub Action <action@github.com>
* PATCH /config hot-reload w/ selective cache invalidation (#15) PATCH /config hot-reload w/ selective cache invalidation * typecheck fix * chore: format code * fix for failing test * fix for failing test * chore: format code * chore: format code * Fix cache corruption from partial updates in file refresh (#18) * Fix cache corruption bug in refresh function --------- Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Implements runtime configuration updates through a PATCH /config endpoint with optional hot-reload capability controlled by OPENCODE_CONFIG_HOT_RELOAD environment variable.
Changes
Features
Infrastructure
Testing
Documentation
Breaking Changes
None. Hot-reload is opt-in via environment variable. Default behavior maintains existing cache semantics.
Configuration
Set OPENCODE_CONFIG_HOT_RELOAD=true before starting server to enable runtime config updates without restart. Without this flag, disk writes persist but in-memory cache remains until process restart.