Repository navigation
test(core): reproduce hot reload regressions - #37427
Closed
kitlangton wants to merge 2 commits into
Closed
kitlangton wants to merge 2 commits into
kitlangton wants to merge 2 commits into
Conversation
This was referenced Jul 17, 2026
5 tasks
Contributor
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds deterministic red tests for two V2 hot-reload blockers:
@opencode-ai/core/skillfirst in a fresh process crashes through an ESM initialization cycle (Importing the public skill module first crashes through an ESM cycle #37424)This is intentionally a draft, red-test PR. It establishes the contracts and keeps the failures visible while fixes are developed separately.
Before / After
Before
A domain rebuild calls its
State.finalizecallback, the callback publishes*.updated, and only afterward does State assign the rebuilt snapshot. A client reacting to the event can immediately refetch the previous agent, command, skill-source, or provider/model catalog.A fresh process importing the public skill module can enter
skill -> permission -> session -> skill;Session.SkillNotFoundErroreagerly readsSkillV2.IDwhile that binding is still uninitialized.A watcher update for
.opencode/commands/review.mdrediscovers the same Config entry list, soConfig.reloadreturns before publishingconfig.updated; config-backed plugins never rescan the changed file.After this test PR
The required behavior is executable and currently red:
How
packages/core/test/agent.test.tsreads the registered agent immediately afteragent.updated.packages/core/test/command.test.tsreads the registered command immediately aftercommand.updated.packages/core/test/skill.test.tsreads registered skill sources immediately afterskill.updated.packages/core/test/catalog.test.tsreads the provider immediately aftercatalog.updated.packages/core/test/config/config.test.tspublishes a watcher update for a file inside a Config directory and waits forconfig.updated.packages/core/test/public-import.test.tsimports@opencode-ai/core/skillin a fresh Bun process so module caching cannot hide the cycle.sequenceDiagram participant State participant Events participant Client participant API State->>State: build next snapshot State->>Events: publish *.updated Events->>Client: invalidate catalog Client->>API: list immediately API-->>Client: previous snapshot State->>State: assign next snapshotScope
This PR does not fix either failure and is not merge-ready while the tests are red.
Missing but non-regressed hot-reload surfaces are tracked separately:
Testing
Expected red tests:
The first four observe the previous snapshot. The Config test times out waiting for
config.updated. The public-import test observesReferenceError: Cannot access 'ID' before initialization.Passing validation: