Skip to content

feat: make headless terminal size configurable - #2829

Open
ogulcancelik wants to merge 1 commit into
masterfrom
issue/2828-headless-size
Open

feat: make headless terminal size configurable#2829
ogulcancelik wants to merge 1 commit into
masterfrom
issue/2828-headless-size

Conversation

@ogulcancelik

Copy link
Copy Markdown
Collaborator

Summary

  • use a 120×40 virtual terminal when no client is attached
  • add reloadable server.headless_cols and server.headless_rows settings
  • preserve attached-client sizing and existing detached PTY sizes
  • document the headless fallback and cover configured headless pane creation

Refs #2828.

Validation

  • just check
  • just bench-render-scale
    • 15 background workspaces: 1.07× one-pane median
    • 15 active panes: 1.16× one-pane median

@kangal-bot kangal-bot added the ai-review Trigger automated AI reviews for pull requests admitted by the PR gate label Aug 15, 2026
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fe12c017-fd8c-427d-a77b-48f87c934741

📥 Commits

Reviewing files that changed from the base of the PR and between f533492 and f8125c4.

📒 Files selected for processing (1)
  • tests/detach_reattach.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/detach_reattach.rs

📝 Walkthrough

Walkthrough

The server now supports configurable headless terminal dimensions. Defaults are 120 columns by 40 rows. Configuration validation, live reloads, runtime sizing, documentation, and integration tests cover the behavior.

Changes

Headless terminal sizing

Layer / File(s) Summary
Configuration contract and validation
src/config.rs, src/config/model.rs, src/config/io.rs, src/main.rs, docs/next/website/src/..., docs/next/CHANGELOG.md
Adds [server] settings for headless_cols and headless_rows, defaults of 120×40, validation for zero values, live loading, configuration templates, and documentation.
Application configuration state
src/app/mod.rs, src/app/state.rs
Initializes AppState.headless_size from configuration and updates it during live reloads. Invalid dimensions produce diagnostics and preserve the current size. Pane size estimation uses the configured dimensions when no pane geometry exists.
Headless server sizing and integration coverage
src/server/headless.rs, tests/detach_reattach.rs, tests/api_ping.rs
Uses the configured size when no client is attached, refreshes it after reloads, and verifies default, attached, detached, and custom pane dimensions. The API ping test requests 50 recent lines.

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

Merge Risk: ⚪ Minimal · up to f8125

The change makes detached terminal dimensions configurable while preserving attached-client and existing detached sizing behavior; no actionable merge-blocking risk remains after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant Config
  participant AppState
  participant HeadlessServer
  participant PanePTY
  Config->>AppState: Load headless_cols and headless_rows
  AppState->>HeadlessServer: Provide headless_size
  HeadlessServer->>PanePTY: Apply effective_size without a client
  Config->>AppState: Reload server dimensions
  AppState->>HeadlessServer: Refresh headless_size
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description accurately summarizes configurable headless sizing, reloadable settings, preserved client sizing, documentation, tests, and validation.
Title check ✅ Passed The title clearly and concisely describes the main change: making the headless terminal size configurable.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue/2828-headless-size

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@ogulcancelik

Copy link
Copy Markdown
Collaborator Author

@greptileai

@greptile-apps

greptile-apps Bot commented Aug 15, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds configurable headless terminal dimensions and applies them during startup, reload, and last-client detachment while preserving existing PTY sizes.

  • Adds reloadable server.headless_cols and server.headless_rows settings with validation and documentation.
  • Stores the configured fallback in application and server state for initial pane sizing.
  • Recomputes virtual layout after the final client detaches without resizing existing panes.
  • Adds unit and real-PTY regression coverage for initial and post-detach pane creation.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; both previously reported headless-sizing issues are addressed by initialization-time fallback sizing and fallback view recomputation after the last client detaches.

Important Files Changed

Filename Overview
src/server/headless.rs Tracks configured headless and effective dimensions, synchronizes fallback geometry on reload and detachment, and preserves existing PTY sizes.
src/app/state.rs Stores the configured fallback and uses it when estimating pane dimensions before a computed view exists.
src/app/mod.rs Initializes and reloads application headless dimensions with invalid-section handling.
src/config.rs Defines defaults and rejects zero-valued headless dimensions.
src/config/io.rs Registers and live-loads the new server configuration section.
src/config/model.rs Adds the typed server configuration model, defaults, and parsing tests.
tests/detach_reattach.rs Adds real-PTY coverage for configured initial sizing and fallback sizing after detachment while checking preservation of existing panes.

Sequence Diagram

sequenceDiagram
  participant Config
  participant App
  participant Server as HeadlessServer
  participant View
  participant PTY
  Config->>App: load headless_cols × headless_rows
  App->>Server: initialize headless_size
  alt no client attached
    Server->>View: compute fallback geometry
    View->>PTY: seed new panes at fallback size
  else client attached
    Server->>View: use client geometry
    View->>PTY: resize shared runtime
  end
  Server->>View: last client detaches
  View->>View: recompute fallback layout
  Note over View,PTY: Existing PTYs retain attached size
  View->>PTY: new panes use fallback geometry
Loading

Reviews (4): Last reviewed commit: "feat: make headless terminal size config..." | Re-trigger Greptile

Comment thread src/server/headless.rs
@ogulcancelik
ogulcancelik force-pushed the issue/2828-headless-size branch from f765603 to 20cf796 Compare August 15, 2026 01:08
Comment thread src/app/state.rs
@ogulcancelik
ogulcancelik force-pushed the issue/2828-headless-size branch from 20cf796 to f533492 Compare August 15, 2026 01:17

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fc41ed59-d8ab-484e-b5ff-148adb7bb8a5

📥 Commits

Reviewing files that changed from the base of the PR and between 20cf796 and f533492.

📒 Files selected for processing (2)
  • src/server/headless.rs
  • tests/detach_reattach.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/server/headless.rs

Comment thread tests/detach_reattach.rs Outdated
@ogulcancelik
ogulcancelik force-pushed the issue/2828-headless-size branch from f533492 to f8125c4 Compare August 15, 2026 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Trigger automated AI reviews for pull requests admitted by the PR gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants