GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(pty): own daemon lifetime and hand off restarts by jlongster · Pull Request #45551 · anomalyco/opencode

Conversation

@jlongster

@jlongster jlongster commented Aug 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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.

All reactions
@github-actions github-actions Bot added the contributor label Aug 27, 2026
@jlongster
jlongster marked this pull request as ready for review August 27, 2026 12:59
jlongster added 6 commits August 27, 2026 15:01
@jlongster
fix(pty): own daemon lifetime and hand off restarts
a9825b8
@jlongster
chore(pty): upgrade daemon to 0.1.13
c8366b1
@jlongster
test(pty): trim lifecycle coverage
f5cfa8f
@jlongster
refactor(pty): rename restart preparation to handoff
7178097
@jlongster
refactor(client): rename PTY handoff module
b4dfd77
@jlongster
refactor(client): use SDK for PTY handoff requests
4be3978
@jlongster
jlongster force-pushed the pty-daemon-lifetime branch from 3dc6d4d to 4be3978 Compare August 27, 2026 15:05
@jlongster
jlongster merged commit 2b8a3e7 into v2 Aug 27, 2026
9 of 10 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@jlongster
jlongster deleted the pty-daemon-lifetime branch August 27, 2026 15:52
jinhuang712 pushed a commit to jinhuang712/opencode that referenced this pull request Sep 26, 2026
@jlongster
fix(pty): own daemon lifetime and hand off restarts (anomalyco#45551)
7a91eaf
jlongster added a commit that referenced this pull request Nov 10, 2026
@jlongster
fix(cli): let service restart and stop end the process daemon through…
6bc9373
… 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 jlongster mentioned this pull request Nov 10, 2026
feat(core): run shell commands in the process daemon across handoffs #62978
Merged
3 of 6 tasks
jlongster added a commit that referenced this pull request Nov 10, 2026
@jlongster
fix(cli): let service restart and stop end the process daemon through…
9dd04eb
… 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
@jlongster
fix(cli): let service restart and stop end the process daemon through…
b0ff30b
… 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
@jlongster
fix(cli): let service restart and stop end the process daemon through…
21619be
… 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
@jlongster
fix(cli): let service restart and stop end the process daemon through…
204b8cd
… 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
@jlongster
fix(cli): let service restart and stop end the process daemon through…
a4a02c4
… 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
@jlongster
fix(cli): let service restart and stop end the process daemon through…
05df583
… 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

contributor

Projects

None yet

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.

1 participant

@jlongster
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.