Skip to content

chore(process-daemon): update Ghostty to 1.4.0 - #63103

Open
samm-git wants to merge 1 commit into
anomalyco:devfrom
samm-git:process-daemon-ghostty-1.4
Open

samm-git wants to merge 1 commit into
anomalyco:devfrom
samm-git:process-daemon-ghostty-1.4

Conversation

@samm-git

@samm-git samm-git commented Nov 10, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #63105

Type of change

  • Refactor / code improvement

What does this PR do?

Bumps the Ghostty revision pinned by packages/process-daemon from ab0b9da9 to v1.4.0 (83fb956).

Ghostty 1.4.0 requires Zig 0.17.0, which is the version the TUI already needs for OpenTUI 0.8.1. The daemon currently requires Zig 0.16, so a full build needs both toolchains. This aligns them on 0.17.0.

The only API used by the daemon that changed is ghostty_terminal_new(): it now takes cols and rows directly instead of a GhosttyTerminalOptions struct. The scrollback limit is set after construction with ghostty_terminal_set(GHOSTTY_TERMINAL_OPT_SCROLLBACK_MAX_BYTES, ...), preserving the previous byte-budget behaviour (replay_capacity is measured in bytes). Doing it after construction also means Drop frees the terminal if the call fails. ffi.rs was regenerated with script/ghostty-bindings (bindgen 0.72.1).

The process-daemon docs and CI workflows are moved to Zig 0.17.0. The Windows ARM64 function-pointer alignment workaround is removed because the affected std code no longer exists in 0.17.

How did you verify your code works?

Built and tested on FreeBSD 15.1 aarch64 with Zig 0.17.0 and Ghostty v1.4.0:

  • cargo build --release --locked
  • cargo clippy --locked --all-targets --all-features -- -D warnings
  • cargo test --release --locked: 81/82 pass. The remaining failure is daemon::server::tests::missed_wake_is_detected, a timing-sensitive control-loop test. It fails identically on the unmodified daemon with the old Ghostty pin on this heavily loaded host, so it is not related to this change.

I could not verify the Linux/macOS/Windows CI locally.

Checklist

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

@samm-git
samm-git requested a review from a team November 10, 2026 12:30
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:title labels Nov 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hey! Your PR title process-daemon: update Ghostty to 1.4.0 doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Requesting changes; I could not build or test it here because this environment has no Rust or Zig toolchain. I checked the regenerated bindings and mod.rs against Ghostty's terminal.h at both revisions.

Public API: unchanged (internal FFI and CI only).

Main concern: the scrollback limit switches from bytes to lines. At the old pin, max_scrollback ended up in Screen.max_scrollback, which counts bytes, even though the old header calls it a line count. The daemon passes replay_capacity, a byte budget. Setting SCROLLBACK_MAX_LINES to that value lets each terminal keep about 2 million lines instead of about 2 MiB. GHOSTTY_TERMINAL_OPT_SCROLLBACK_MAX_BYTES keeps the current behaviour (see inline).

Also, if that ghostty_terminal_set call fails, the native terminal is never freed (inline). And packages/process-daemon/README.md still says to install Zig 0.16.0 and describes the Zig 0.16 ARM64 alignment fix this PR removes; the src/musl.rs comment also refers to Zig 0.16. Please update them with the bump.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The new push is only a merge of dev; it doesn't change any of this pull request's files. My earlier inline point is still open: the byte budget is now set as a line limit (SCROLLBACK_MAX_LINES instead of SCROLLBACK_MAX_BYTES), and the native terminal leaks if that ghostty_terminal_set call fails. The stale Zig 0.16 notes in packages/process-daemon/README.md and the src/musl.rs comment are also unchanged. Public API: unchanged. I still couldn't build or test it here (no Rust or Zig toolchain).

Ghostty 1.4.0 requires Zig 0.17.0, which is the version the TUI already
uses for OpenTUI 0.8.1. This removes the need to keep both Zig 0.16 and
0.17 installed to build OpenCode.

Regenerate the C API bindings with script/ghostty-bindings and adapt to
the new terminal creation API: ghostty_terminal_new() now takes `cols`
and `rows` directly. The scrollback limit is set after construction with
ghostty_terminal_set(GHOSTTY_TERMINAL_OPT_SCROLLBACK_MAX_BYTES, ...),
preserving the previous byte-budget semantics, and the terminal is freed
through Drop if setting it fails.

Update the process-daemon docs and CI workflows to Zig 0.17.0. The
Windows ARM64 alignment workaround is no longer needed because the
affected std code no longer exists in Zig 0.17.
@samm-git
samm-git force-pushed the process-daemon-ghostty-1.4 branch from 0989ff6 to 4583e00 Compare November 10, 2026 12:47
@samm-git samm-git changed the title process-daemon: update Ghostty to 1.4.0 chore(process-daemon): update Ghostty to 1.4.0 Nov 10, 2026
@samm-git

samm-git commented Nov 10, 2026 •

Copy link
Copy Markdown
Author

Thanks — pushed a fix:

  • Scrollback now uses GHOSTTY_TERMINAL_OPT_SCROLLBACK_MAX_BYTES, so replay_capacity keeps its byte-budget meaning. A zero value still disables scrollback.
  • The scrollback ghostty_terminal_set call now happens after Terminal is constructed, so Drop frees the native terminal if it fails.
  • README.md and the src/musl.rs comment now refer to Zig 0.17.0; the removed Windows alignment workaround is no longer described.

The branch is rebased onto current dev. cargo clippy -D warnings is clean.

@github-actions github-actions Bot removed needs:compliance This means the issue will auto-close after 2 hours. needs:title labels Nov 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Both earlier points are fixed: the scrollback limit is set in bytes again (GHOSTTY_TERMINAL_OPT_SCROLLBACK_MAX_BYTES), and it's set after Terminal is built, so Drop frees the terminal if the call fails. The README and the musl.rs comment now say Zig 0.17. I couldn't build or run it here (no Rust or Zig toolchain), so the Linux, macOS and Windows CI results still matter. Public API: unchanged. Nothing new that blocks a merge.

@samm-git

Copy link
Copy Markdown
Author

Heads-up: the persistent terminal is currently broken independently of this PR. 2.2.7 (and 2.2.6) ship a process-daemon that speaks protocol 8 while the client still speaks protocol 7:

opencode-pty protocol mismatch: daemon=8, client=7 → HTTP 503 on terminal creation.

It reproduces on macOS as well. The client-side protocol 8 update is #62976. This PR only changes the pinned Ghostty revision and its terminal API; the daemon still speaks protocol 8.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

process-daemon requires Zig 0.16 while the TUI requires Zig 0.17

1 participant