Skip to content

feat: make headless terminal size configurable - #2829

Merged
ogulcancelik merged 2 commits into
masterfrom
issue/2828-headless-size
Aug 15, 2026
Merged

feat: make headless terminal size configurable#2829
ogulcancelik merged 2 commits 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

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: 66b1c6fd-bd58-4210-93d5-4abb470237c9

📥 Commits

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

📒 Files selected for processing (1)
  • docs/next/CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/next/CHANGELOG.md

📝 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 b4fa6

The PR adds configurable sizing for headless terminals while preserving attached-client and detached PTY 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
Title check ✅ Passed The title clearly and concisely describes the main change: configurable headless terminal sizing.
Description check ✅ Passed The description accurately summarizes the configurable headless sizing, reload behavior, preservation rules, documentation, and validation.
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
  • 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 reloadable headless terminal dimensions while retaining attached-client authority and preserving existing PTY sizes after detach.

  • Adds validated server.headless_cols and server.headless_rows configuration with 120×40 defaults.
  • Uses the configured fallback for initial pane creation and recomputes virtual layout when the final client detaches.
  • Documents the settings and adds unit and real-PTY regression coverage.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/server/headless.rs Propagates configured fallback dimensions into the headless server and safely recomputes detached view geometry without resizing existing PTYs.
src/app/state.rs Stores the configured headless size and uses it when no computed pane geometry exists.
src/app/mod.rs Initializes and reloads headless dimensions while retaining current values when the server section is invalid.
src/config.rs Adds defaults and nonzero validation for headless terminal dimensions.
src/config/io.rs Registers and live-loads the new top-level server configuration section.
src/config/model.rs Defines the server configuration model, defaults, parsing coverage, and validation tests.
tests/detach_reattach.rs Adds real-PTY coverage for initial headless creation and creation after detaching a differently sized client.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Config[server.headless_cols / headless_rows] --> State[AppState headless_size]
  State --> Server[HeadlessServer headless_size]
  Client{Client attached?}
  Client -->|Yes| Attached[Use attached-client geometry]
  Client -->|No| Headless[Recompute virtual headless layout]
  Headless --> NewPane[Seed newly created pane PTY]
  Attached --> ExistingPTY[Resize shared attached runtime]
  Headless -. no resize .-> ExistingPTY
Loading

Reviews (5): Last reviewed commit: "Merge branch 'master' into issue/2828-he..." | 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
@ogulcancelik
ogulcancelik merged commit 15539d3 into master Aug 15, 2026
8 checks passed
@kangal-bot kangal-bot removed the ai-review Trigger automated AI reviews for pull requests admitted by the PR gate label Aug 15, 2026
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