Repository navigation
fix(pty): own daemon lifetime and hand off restarts - #45551
Merged
Merged
Conversation
jlongster
marked this pull request as ready for review
August 27, 2026 12:59
jlongster
force-pushed
the
pty-daemon-lifetime
branch
from
August 27, 2026 15:05
3dc6d4d to
4be3978
Compare
jinhuang712
pushed a commit
to jinhuang712/opencode
that referenced
this pull request
Sep 26, 2026
jlongster
added a commit
that referenced
this pull request
Nov 10, 2026
… owner loss `opencode service restart` and `stop` asked the server to shut its process daemon down before stopping it. That call predates handoff (#45551): a stop without a handoff now drops the daemon's owner, which stops the daemon and its processes anyway, and the next server resumes the sessions and settles their calls. `uninstall` still shuts the daemon down explicitly. User decisions: - Remove the up-front daemon shutdown from service restart and stop; keep it in uninstall
3 of 6 tasks
jlongster
added a commit
that referenced
this pull request
Nov 10, 2026
… owner loss `opencode service restart` and `stop` asked the server to shut its process daemon down before stopping it. That call predates handoff (#45551): a stop without a handoff now drops the daemon's owner, which stops the daemon and its processes anyway, and the next server resumes the sessions and settles their calls. `uninstall` still shuts the daemon down explicitly. User decisions: - Remove the up-front daemon shutdown from service restart and stop; keep it in uninstall
jlongster
added a commit
that referenced
this pull request
Nov 10, 2026
… owner loss `opencode service restart` and `stop` asked the server to shut its process daemon down before stopping it. That call predates handoff (#45551): a stop without a handoff now drops the daemon's owner, which stops the daemon and its processes anyway, and the next server resumes the sessions and settles their calls. `uninstall` still shuts the daemon down explicitly. User decisions: - Remove the up-front daemon shutdown from service restart and stop; keep it in uninstall
jlongster
added a commit
that referenced
this pull request
Nov 10, 2026
… owner loss `opencode service restart` and `stop` asked the server to shut its process daemon down before stopping it. That call predates handoff (#45551): a stop without a handoff now drops the daemon's owner, which stops the daemon and its processes anyway, and the next server resumes the sessions and settles their calls. `uninstall` still shuts the daemon down explicitly. User decisions: - Remove the up-front daemon shutdown from service restart and stop; keep it in uninstall
jlongster
added a commit
that referenced
this pull request
Nov 10, 2026
… owner loss `opencode service restart` and `stop` asked the server to shut its process daemon down before stopping it. That call predates handoff (#45551): a stop without a handoff now drops the daemon's owner, which stops the daemon and its processes anyway, and the next server resumes the sessions and settles their calls. `uninstall` still shuts the daemon down explicitly. User decisions: - Remove the up-front daemon shutdown from service restart and stop; keep it in uninstall
jlongster
added a commit
that referenced
this pull request
Nov 10, 2026
… owner loss `opencode service restart` and `stop` asked the server to shut its process daemon down before stopping it. That call predates handoff (#45551): a stop without a handoff now drops the daemon's owner, which stops the daemon and its processes anyway, and the next server resumes the sessions and settles their calls. `uninstall` still shuts the daemon down explicitly. User decisions: - Remove the up-front daemon shutdown from service restart and stop; keep it in uninstall
jlongster
added a commit
that referenced
this pull request
Nov 10, 2026
… owner loss `opencode service restart` and `stop` asked the server to shut its process daemon down before stopping it. That call predates handoff (#45551): a stop without a handoff now drops the daemon's owner, which stops the daemon and its processes anyway, and the next server resumes the sessions and settles their calls. `uninstall` still shuts the daemon down explicitly. User decisions: - Remove the up-front daemon shutdown from service restart and stop; keep it in uninstall
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.
Issue for this PR
No linked issue. Companion daemon change: anomalyco/opencode-pty#6 (merged).
Type of change
What does this PR do?
Give each server its own PTY daemon, using a UUID runtime directory rather than a database-path hash. A scoped ownership connection makes the daemon stop when its server exits or dies.
Automatic version replacement prepares an authenticated, bounded handoff before stopping the old server. A private sidecar shares the handoff with concurrent startup contenders, and the replacement claims ownership before becoming ready. Explicit stop/restart remains destructive to terminals.
Also allow local CLI builds to embed a locally built daemon through
OPENCODE_PTY_BIN.Core and CLI now pin the published
@opencode-ai/[email protected], which provides protocol 7. The lockfile includes the updated platform packages, and the lifecycle tests pass against the released binary rather than a local daemon build.The remote-shell/default-directory fix is now on
v2and is preserved by this rebase. This PR remains focused on daemon lifecycle changes.How did you verify your code works?
bun run generateinpackages/client.bun testinpackages/client.bun test test/persistent-pty-daemon.test.tsinpackages/core.bun test test/persistent-pty.test.tsinpackages/server, withOPENCODE_PTY_BINpointing to the installed@opencode-ai/[email protected]binary.bun test --timeout 30000 test/standalone.test.tsinpackages/cli.bun typecheckin Core, Server, Client, and CLI.git diff --check.Screenshots / recordings
Not applicable; no TUI changes are included.
Checklist