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 — feat(process-daemon): write pipe output to a file by jlongster · Pull Request #60701 · anomalyco/opencode

Conversation

@jlongster

@jlongster jlongster commented Oct 30, 2026 •
edited by opencodejr Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Lets a pipe process write its output straight to a file, so OpenCode can keep a command's complete output even when it exceeds the 2 MiB replay window, finishes before the server subscribes, or runs while no server is attached during a restart handoff. Stacked on #60697.

  • create takes output_path (pipe only; feature output_path, so clients only send it to a daemon that lists it). It must be absolute; PTYs reject it.
  • The daemon opens the file before spawning: created with mode 0600 if missing, otherwise appended to. A path that can't be opened fails create without starting the process.
  • The daemon opens it with O_NOFOLLOW, so a symlink as the final path component is refused.
  • The reader thread writes each chunk to the file before handing it to the actor, so the file always holds at least what subscribers have seen and is never held back by a slow subscriber. The file is closed before the exit is published.
  • A later write error (disk full, quota) stops the file and sets output_error on TerminalInfo and on the exited event (omitted otherwise), ordered before the output the file lacks, so OpenCode can tell the saved file is incomplete. The process keeps running.
  • output_path is left out of the JSON when unset, so PTY create requests serialize exactly as before.

OpenCode will point this at the shell tool's existing sh_*.out files, so Shell.output and the "full output saved to …" notice keep working unchanged.

How did you verify your code works?

cargo fmt --check, cargo clippy --all-targets --all-features -- -D warnings and the macOS test suite in packages/process-daemon; clippy for x86_64-pc-windows-msvc and x86_64-unknown-linux-gnu. New tests:

  • with a 1 KiB replay window and no subscriber, seq 1 20000 plus stderr lands in the file in full (the replay is truncated), with mode 0600
  • an existing file is appended to
  • a relative path, a PTY with output_path, an unopenable path and a symlink are rejected, and nothing is spawned
  • Linux: writing to /dev/full sets output_error while output and exit still reach subscribers
  • the real-daemon handoff test now also checks the file holds the full output after the restart handoff
  • protocol test for output_path on the wire

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Public API: process-daemon protocol: adds the output_path feature, an optional create.output_path, and optional output_error on TerminalInfo and the exited event (backwards compatible)

Sorry, something went wrong.

Uh oh!

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

All reactions
jlongster added 7 commits October 30, 2026 15:50
@jlongster
fix(process-daemon): stop cleanly on SIGTERM and SIGINT
601367b
@jlongster
fix(process-daemon): block stop signals before startup threads and av…
c540d8f
…oid nix sigwait
@jlongster
chore(process-daemon): drop a redundant Send impl
573c83f
@jlongster
feat(process-daemon): run commands without a PTY on Unix
6a3472d
@jlongster
fix(process-daemon): reset pipe children's signals and harden pipe st…
10dd51a
…artup and draining
@jlongster
fix(process-daemon): reset signal actions before unmasking in pipe ch…
d477d4c
…ildren
@jlongster
feat(process-daemon): write pipe output to a file
ff51b3e
@github-actions github-actions Bot added the contributor label Oct 30, 2026
jlongster added 2 commits October 30, 2026 16:32
@jlongster
fix(process-daemon): report output file write errors and refuse symlinks
77d16d5
@jlongster
fix(process-daemon): report output file errors on the exit event
3513f81
@jlongster
jlongster force-pushed the daemon-pipe-mode branch from d477d4c to bf14d89 Compare November 2, 2026 17:30
@jlongster
jlongster requested a review from a team November 2, 2026 17:30
@jlongster
jlongster force-pushed the daemon-pipe-mode branch from bf14d89 to 8dfdc15 Compare November 2, 2026 18:11
Base automatically changed from daemon-pipe-mode to dev November 2, 2026 18:27
opencodejr[bot]
opencodejr Bot reviewed Nov 2, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks sound and works as described. I built the daemon on Linux and ran the lib, ownership and pipe tests. All the new output-file tests pass, and the handoff test confirms the file holds the full output across a restart handoff. Two older pipe tests fail here, and they fail the same way on the base: the sandbox doesn't reap orphaned processes. I didn't run clippy, fmt, or the macOS or Windows targets.

Public API: this changes only the process-daemon wire protocol, not the SDK, HTTP API, plugins or config. Every change is an addition:

  • features gains output_path on Unix.
  • create accepts an optional output_path.
  • TerminalInfo and the exited event gain an optional output_error.

All of it is backwards compatible. The new fields are left out of the JSON when unset, so PTY create requests and normal exited frames are byte-identical to before. Clients only send output_path to a daemon that lists the feature.

No blocking concerns.

Sorry, something went wrong.

Uh oh!

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

All reactions
@jlongster jlongster mentioned this pull request Nov 5, 2026
feat(process-daemon): protocol v8 for shell commands #61875
Merged
4 of 6 tasks
@jlongster

jlongster commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #61875, which includes these commits (rebased) plus protocol v8.

All reactions

Sorry, something went wrong.

Uh oh!

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

@jlongster jlongster closed this Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencodejr opencodejr[bot] opencodejr[bot] left review comments

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.