GeezerVison is showing github.com — fix(pty): own daemon lifetime and hand off restarts by jlongster · Pull Request #45551 · anomalyco/opencode
Conversation
jlongster
commented
Aug 27, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Issue for this PR
No linked issue. Companion daemon change: anomalyco/opencode-pty#6 (merged).
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
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 v2 and is preserved by this rebase. This PR remains focused on daemon lifecycle changes.
How did you verify your code works?
- Regenerated clients with
bun run generate in packages/client.
bun test in packages/client.
bun test test/persistent-pty-daemon.test.ts in packages/core.
bun test test/persistent-pty.test.ts in packages/server, with OPENCODE_PTY_BIN pointing to the installed @opencode-ai/[email protected] binary.
bun test --timeout 30000 test/standalone.test.ts in packages/cli.
bun typecheck in Core, Server, Client, and CLI.
- Prettier and
git diff --check.
Screenshots / recordings
Not applicable; no TUI changes are included.
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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
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
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|