fix(daemon): use real terminal size for PTY instead of hardcoded 24x80#624
Merged
fix(daemon): use real terminal size for PTY instead of hardcoded 24x80#624
Conversation
Daemon PTYs were created with hardcoded 24x80 dimensions regardless of the actual terminal size. This caused agents like Claude Code to render incorrectly until the attach window connected and sent a resize. Add a resolution chain for initial PTY dimensions: 1. --rows/--cols CLI flags (explicit override) 2. [daemon] default_rows/default_cols config (set-and-forget) 3. ioctl(TIOCGWINSZ) on stdout (real terminal detection) 4. 80x24 fallback (no TTY available) This fixes the common case where `kild create --daemon` runs from a real terminal, and enables non-TTY callers (Claude Code, scripts) to specify dimensions via flags or config.
Owner
Author
PR Review SummaryCritical Issues (1 found)
Fix: Resolve each dimension independently: fn resolve_pty_size(params: &AgentSpawnParams<'_>) -> (u16, u16) {
let cfg = ¶ms.kild_config.daemon;
let (terminal_cols, terminal_rows) = query_terminal_size();
let cols = params.cols.or(cfg.default_cols).unwrap_or(terminal_cols);
let rows = params.rows.or(cfg.default_rows).unwrap_or(terminal_rows);
(cols, rows)
}Important Issues (1 found)
Suggestions (3 found)
Strengths
Verdict: NEEDS FIXES
|
…sionRequest - Fix resolve_pty_size to resolve each dimension independently via .or() chaining instead of requiring both --rows AND --cols. Previously passing only --cols 220 silently discarded the flag. Same fix for config default_rows/default_cols. - Add debug logging to PTY size resolution and ioctl fallback paths. - Introduce OpenSessionRequest struct matching CreateSessionRequest pattern, removing #[allow(clippy::too_many_arguments)] from open_session. - Merge with_rows/with_cols into with_pty_size on both request types.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
--rows/--colsCLI flags >[daemon] default_rows/default_colsconfig >ioctl(TIOCGWINSZ)on stdout > 80×24 fallbackTest plan
kild create test --daemon --rows 50 --cols 200→ daemon log showsrows:50, cols:200[daemon] default_rows = 50/default_cols = 200→ used when no CLI flags and no TTYkild create test --daemon→ uses actual terminal dimensionscargo test --allpassescargo clippy --all -- -D warningsclean