Skip to content

ci: preserve output activity heartbeats in GhosttyKit - #5

Merged
thdxg merged 1 commit into
thdxg:mainfrom
onliner10:fix/preserve-output-activity
Jul 24, 2026
Merged

ci: preserve output activity heartbeats in GhosttyKit#5
thdxg merged 1 commit into
thdxg:mainfrom
onliner10:fix/preserve-output-activity

Conversation

@onliner10

@onliner10 onliner10 commented Jul 23, 2026

Copy link
Copy Markdown

What

Hey @thdxg - following up on #3. We discussed carrying the accepted output_activity change as .github/downstream/0002-output-activity.patch, but while finishing the Macterm integration I noticed that 0002 never actually made it into main or the latest GhosttyKit release. No worries - it looks like the follow-up simply slipped through, so I’m submitting the downstream-patch integration here.

This PR:

  • preserves the GHOSTTY_ACTION_OUTPUT_ACTIVITY API as ordered patch 0002, retaining the original authorship and date;
  • adds it to the sync and drift-check preservation lists;
  • makes both workflows fail loudly if a declared downstream file is missing;
  • updates the build workflow to Zig 0.16, matching Ghostty’s current minimum version.

The patch includes the original IO-path heartbeat from #3 plus the hardening found during Macterm integration: post-parse scrollbar geometry, no heartbeat for empty manual-API buffers, immediate retry after a full surface mailbox, stable appended enum values, and explicit native macOS/GTK no-ops for the embedder-only action.

Why

Macterm now uses this heartbeat to track in-place terminal activity, including same-PID Pi commands and fully occluded tabs. The renderer-driven scrollbar signal stops under occlusion, while this PTY IO-path signal continues to report real output.

Keeping it as a downstream patch ensures the daily pristine-upstream sync cannot discard it.

Verified

  • Replayed 0001 then 0002 cleanly from the current upstream base.
  • Verified the replayed tree exactly matches the tested source tree.
  • Ran Zig formatting, focused output-activity/API tests, and a full non-app Zig build.
  • Ran the native macOS Xcode build and tests directly.
  • Built the final universal GhosttyKit XCFramework with Zig 0.16.
  • Swapped that framework into Macterm and verified occluded Pi activity, physical and programmatic input, blank-Return/TUI false-positive guards, canonical foreground commands, and no resurrection after completion.

AI disclosure

The original implementation in #3 used Claude Code, as disclosed there. This downstream adaptation and review used OpenAI ChatGPT through Pi for code analysis, test design, and patch/workflow edits. I directed the work, reviewed the final diff, and ran the verification above.

Summary by CodeRabbit

  • New Features

    • Added an output activity signal for embedders when terminal output is produced.
    • Signals include current scrollbar information and continue being delivered when the terminal surface is not visible.
    • Activity updates are throttled to avoid excessive notifications, while empty output is ignored.
  • Chores

    • Updated build automation to use Zig 0.16.0.
    • Improved validation for downstream patch files during automated workflows.

Carry the accepted output_activity embedder API as an ordered downstream
patch so the daily pristine-upstream rebuild cannot discard it. Require every
declared downstream file to exist, and use Ghostty's current Zig 0.16 toolchain
for framework releases.
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1360ccf8-6b9a-49b3-85c5-ca0ce4055ca6

📥 Commits

Reviewing files that changed from the base of the PR and between 2da9377 and a5f8293.

📒 Files selected for processing (4)
  • .github/downstream/0002-output-activity.patch
  • .github/workflows/assert-no-drift.yml
  • .github/workflows/build-ghosttykit.yml
  • .github/workflows/sync-upstream.yml

📝 Walkthrough

Walkthrough

Adds a throttled PTY output activity heartbeat carrying scrollbar geometry through the surface mailbox and app action path, exposes it in public action APIs, adds platform no-op handling, and strengthens downstream workflow file validation while updating Zig.

Changes

Output activity heartbeat

Layer / File(s) Summary
Activity action and message contracts
.github/downstream/0002-output-activity.patch
Adds the output_activity action and scrollbar payload to the C ABI, Zig action union, and surface message union.
PTY output emission and throttling
.github/downstream/0002-output-activity.patch
Emits non-empty PTY output activity at most every 500ms, preserves retry eligibility when mailbox delivery is coalesced, and tests empty-buffer and throttle behavior.
Surface delivery and platform dispatch
.github/downstream/0002-output-activity.patch
Forwards scrollbar geometry through rt_app.performAction; macOS and GTK treat the action as an embedder-only no-op.

Downstream workflow maintenance

Layer / File(s) Summary
Downstream patch tracking and validation
.github/workflows/assert-no-drift.yml, .github/workflows/sync-upstream.yml
Tracks 0002-output-activity.patch and fails when declared downstream files are missing.
GhosttyKit Zig version
.github/workflows/build-ghosttykit.yml
Updates the workflow’s Zig version from 0.15.2 to 0.16.0.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Termio
  participant SurfaceMailbox
  participant Surface
  participant App
  Termio->>SurfaceMailbox: Queue throttled output_activity with scrollbar geometry
  SurfaceMailbox->>Surface: Deliver output_activity message
  Surface->>App: Call rt_app.performAction
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: preserving GhosttyKit output-activity heartbeats.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@thdxg

thdxg commented Jul 24, 2026

Copy link
Copy Markdown
Owner

@onliner10 Thanks for your work! It looks good to me.

@thdxg
thdxg merged commit f27fbea into thdxg:main Jul 24, 2026
1 check passed
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.

2 participants