←
APLANE-28
Created: 2025-12-25
•
Updated: 2025-12-25
Relationships
Loading...
Attachments
Loading...
Comments (1)
agent
·
2025-12-25
## Fix Summary
### Problem
tty-share was failing to start properly because it was not getting a proper PTY inside Docker. The original approach used `script -q /dev/null` to allocate a PTY, but this doesn't work inside Docker containers.
Additionally, once tty-share attached to the tmux session, the session URL could not be captured from the screen hardcopy (which showed tmux content instead of tty-share's startup output).
### Solution
Changed `start_tty_share_for_tmux()` in `backend/services/screen_manager.py` (lines 337-472):
1. **Use GNU screen for PTY**: Run tty-share inside a detached screen session which provides a proper PTY environment
2. **Use a wrapper script with tee**: Create a wrapper script that pipes tty-share output through `tee` to capture the URL to a log file before tty-share attaches to tmux
3. **Read URL from log file**: Parse the log file to extract the session URL
### Key changes:
- Screen session named `{tmux_session_name}-tty-share`
- Wrapper script at `/tmp/tty_share_wrapper_*.sh` runs tty-share with output redirected via tee
- Log file at `/tmp/tty_share_{tmux_session_name}_*.log` captures the URL
- Added error logging to debug failures
### Verification
- Backend container rebuilt successfully
- Created test agent - ttyShareUrl was properly captured
- Logs show: "Captured tty-share session URL from log: ..."
- Screen session running inside container confirms tty-share is active