Skip to content

fix(config-reload): retire watcher after provider scope closes - #1254

Open
choi138 wants to merge 1 commit into
code-yeongyu:mainfrom
choi138:fix/config-reload-provider-scope
Open

fix(config-reload): retire watcher after provider scope closes#1254
choi138 wants to merge 1 commit into
code-yeongyu:mainfrom
choi138:fix/config-reload-provider-scope

Conversation

@choi138

@choi138 choi138 commented Sep 1, 2026

Copy link
Copy Markdown

Summary

  • treat only Provider scope is closed from scope-bound config-reload callbacks as a terminal lifecycle signal
  • retire the orphaned watcher while preserving existing error propagation and non-blocking teardown behavior
  • add a regression test for a debounced settings event delivered after the owning provider scope closes

Reproduction

On main, the new regression test fails from ConfigReloadWatchEngine.#evaluatePending with an uncaught Error: Provider scope is closed. With this patch, the callback closes the watcher and its subscriptions drain on the existing deferred teardown tick.

Verification

  • bun run --cwd packages/coding-agent test test/suite/config-reload-lazy-teardown.test.ts (4 passed)
  • config-reload test suite (7 files, 107 tests passed)
  • bun run check
  • isolated senpi QA: common.mjs --self-check (10/10), rpc-drive.mjs --self-test (4/4), mock-loop.mjs --with-tool --api openai-responses (4/4)

Changelog

This fixes a user-visible RPC host crash and prompt timeout. Per CONTRIBUTING.md, external contributors must not edit CHANGELOG.md; a maintainer changelog entry is still needed for the changelog gate.


Summary by cubic

Fixes a crash in the config-reload extension when a debounced filesystem event fires after the owning provider scope closes.

  • Treats only Provider scope is closed as a terminal signal and retires the orphaned watcher.
  • Preserves error propagation for all other callback errors and retains non-blocking teardown.
  • Adds a regression test covering a debounced event delivered after scope closure.

Written for commit 4061523. Summary will update on new commits.

Review in cubic

Debounced filesystem callbacks can outlive their session provider scope and crash RPC hosts. Treat only scope closure as terminal and preserve other callback errors.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant