Skip to content

fix: Windows daemon detection and ANSI colors - #27

Merged
bigph00t merged 4 commits into
mainfrom
fix/windows-daemon-detection
Feb 26, 2026
Merged

bigph00t merged 4 commits into
mainfrom
fix/windows-daemon-detection

Conversation

@bigph00t

Copy link
Copy Markdown
Contributor

Summary

Fixes Windows-specific issues with daemon process detection and terminal colors.

Changes

Windows Process Detection

  • Fix

is_process_alive()
to work across Windows sessions using
SYNCHRONIZE
access +
WaitForSingleObject

  • Add port-checking fallback for daemon detection when PID check fails (handles cross-session issues)

Terminal Colors

  • Enable ANSI colors on Windows using
    colored::control::set_virtual_terminal(true)
  • Fixes raw escape codes showing in Windows PowerShell/CMD

Tmux Session Setup

  • Simplify tmux session setup (removed problematic bootstrap session that caused spawn loop)
  • Add xterm geometry settings (
    -geometry 160x50 -fa Monospace -fg white -bg black
    ) for headless environments

Documentation

  • Update SCROLLING_FIX_ANALYSIS.md with tmux fixes and incident report
  • Add WINDOWS_DEMO_SETUP.md guide

Testing

  • Tested on Windows Server PC 1 (10.0.0.2)
  • Daemon now correctly detects running instance across sessions
  • Colors render properly in Windows Terminal

Related Issues

  • Fixes daemon spawn loop on Windows
  • Fixes raw ANSI codes showing on Windows
  • Improves cross-session process detection

MobileCLI Fix added 2 commits February 25, 2026 21:40
- Fix is_process_alive() on Windows to work across sessions using SYNCHRONIZE access
- Add port-checking fallback for daemon detection when PID check fails
- Enable ANSI colors on Windows terminals
- Simplify tmux session setup (remove problematic bootstrap session)
- Add xterm geometry settings for headless environments
- Update SCROLLING_FIX_ANALYSIS.md with fixes and incident report
Add debug logging to trace mobile input flow:
- Log when input is received from mobile
- Log bytes being written to PTY
- Log success/failure of write and flush operations

Helps diagnose Windows input issues.
@greptile-apps

greptile-apps Bot commented Feb 26, 2026

Copy link
Copy Markdown

Greptile Summary

Fixes Windows-specific daemon issues and terminal rendering problems.

Key Changes:

  • Process detection: Uses SYNCHRONIZE + WaitForSingleObject instead of PROCESS_QUERY_LIMITED_INFORMATION for cross-session compatibility, with port-checking fallback when PID checks fail
  • ANSI colors: Enables virtual terminal mode on Windows to render colors correctly in PowerShell/CMD
  • Terminal spawning: Adds xterm geometry settings for headless environments and fixes konsole argument passing
  • Tmux configuration: Removes bootstrap session approach (which caused spawn loop incident) and moves history-limit setting after session creation

Issues Found:

  • Stale comment in pty_wrapper.rs contradicts actual implementation

Confidence Score: 4/5

  • Safe to merge with one minor documentation fix needed
  • All changes are well-documented with clear rationale. The Windows process detection improvements use appropriate Windows APIs. The tmux simplification removes problematic code that caused production issues. Only issue is a stale comment that contradicts the code.
  • Pay attention to cli/src/pty_wrapper.rs for the stale comment at line 301

Important Files Changed

Filename Overview
cli/src/daemon.rs Adds port-checking fallback for Windows daemon detection; updates konsole and xterm terminal spawning with improved argument handling and geometry settings
cli/src/main.rs Enables ANSI color support on Windows via set_virtual_terminal(true) - safe and straightforward
cli/src/platform.rs Improves Windows process detection by switching from PROCESS_QUERY_LIMITED_INFORMATION to SYNCHRONIZE access for cross-session compatibility
cli/src/pty_wrapper.rs Simplifies tmux session setup by removing bootstrap session approach (which caused spawn loop); moves history-limit setting after session creation. Contains stale comment.

Fix All in Claude Code Fix All in Codex

Last reviewed commit: 727df88

@greptile-apps greptile-apps 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.

6 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps

greptile-apps Bot commented Feb 26, 2026

Copy link
Copy Markdown
Additional Comments (1)

cli/src/pty_wrapper.rs
Stale comment - history-limit is now set AFTER new-session (lines 272-278), not before. Update to reflect current implementation where first window uses default 2000 lines but global setting affects future windows.

Fix in Claude Code Fix in Codex

MobileCLI Fix added 2 commits February 25, 2026 21:54
- Fix /dev/null to use NUL on Windows for tmux commands
- Add proper error handling for stdout writes with logging
- Add Windows virtual terminal processing enablement in PTY wrapper
- Add winapi dependency for Windows console APIs
- Disable raw mode setup on Windows (not supported)
- Add stderr output on Windows for debugging black screen issue
When mobile app requests 'bash' or 'sh' (Shell), map to PowerShell
on Windows since Windows doesn't have bash by default.

- Add command mapping in spawn_session_windows()
- bash/sh/zsh -> powershell
- Other commands pass through unchanged
@bigph00t
bigph00t merged commit b8b7b84 into main Feb 26, 2026
2 of 3 checks passed
@bigph00t
bigph00t deleted the fix/windows-daemon-detection branch May 13, 2026 16:16
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.

1 participant