Skip to content

[FEATURE]: Native reload for long-running instances #19120

Closed as not planned
Closed as not planned

Description

@Yeamika

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

For a long-running opencode server, refreshing runtime state should not require restarting the whole server process.

In multi-client setups, a full restart is too disruptive because it can interrupt unrelated sessions. What is needed instead is an instance-scoped soft reload of the current workspace context.

I think reload should be a native core capability with two entry points:

  • a native reload tool for agents
  • a TUI reload command for users

Both should use the same core reload path.

The reason I think this belongs in core is that reload is a runtime/instance action, not a plugin-specific feature. Agents may need to refresh their system context after instance-level state changes or runtime reinitialization, and doing that by restarting the whole server is not realistic.

I already have a working implementation in a fork. The current approach is not a server restart: a reload request marks the instance as pending, active sessions keep running until they reach the next safe wait point in the loop, and once the last active session reaches that point the current instance is disposed and forgotten so the next access recreates it. Reload status is also published as an event so clients can react consistently.

This is only about soft reloading the current instance/workspace context, not binary self-update, package update, or full server restart.

This seems related to #6719, #8751, #18119, and #6815, but I think this is a slightly different proposal. Those issues are mostly about reloading config, hot-reloading content, or adding a TUI entry point. What I’m proposing is a native instance-scoped soft reload capability in core, exposed to both agents and the TUI.

If this direction matches the core design, I can prepare a small PR.

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 25, 2026
  2. Yeamika commented on Mar 25, 2026

    @Yeamika
    Author

    I should add that this is not only a design idea — I already have a working implementation in a fork, so I can keep the PR small if this direction is acceptable.

    The implementation is based on an instance-scoped soft reload, not a server restart.

    The flow is:

    • request reload
    • mark the instance as pending
    • let active sessions keep running until they hit the next safe wait point in the loop
    • when the last active session reaches that point, dispose/forget the current instance
    • rebuild the current instance immediately
    • release the wait point so execution continues with refreshed instance state

    Reload status is also published as an event so clients can react consistently, and both TUI and agent-side entry points can call the same core reload path.

    The main reason I approached it this way is that for a long-running multi-client server, a full restart is too broad in scope. One client or one agent may need refreshed system/runtime context without interrupting unrelated sessions attached to the same server.

    If useful, I can open a PR that starts from the smallest core piece first and leaves extra UX on top for follow-up changes.

  3. assigned and unassigned on Apr 26, 2026
  4. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  5. github-actions commented on Jul 5, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions