[BUG] Claude Code v2.1.187 TUI periodic PTY writes prevent SageMaker Code Editor idle shutdown
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
| Field | Value |
|-------|-------|
| Claude Code version | v2.1.187 (regression from v2.1.81) |
| Platform | AWS SageMaker AI Code Editor (managed VS Code) |
| OS | Amazon Linux (SageMaker managed instance) |
Description
Claude Code v2.1.187 prevents AWS SageMaker Code Editor idle shutdown from triggering by performing periodic PTY writes (~every 40–65 seconds) even when completely idle with no user interaction. This was not observed in v2.1.81.
SageMaker Code Editor defines an instance as idle when:
- No text file or notebook changes
- No files being viewed
- No interaction with the terminal
SageMaker Idle Shutdown Documentation
I believe the TUI re-rendering (status bar, elapsed/animated indicators) constitutes "interaction with the terminal" from SageMaker's perspective, causing the idle timer to reset indefinitely.
Impact
Idle instances are never shut down, resulting in unnecessary compute costs for managed environments that rely on idle timeout policies.
Root Cause
The periodic PTY writes originate from the main Claude Code process's TUI re-rendering on a timer (status line updates, cursor blink, or idle animation). Writes go to both ptmx (master side) and pts/N (slave side), confirming Claude Code is writing output to its terminal even when idle.
Evidence
Monitoring ptmx and pts/3 (Claude Code PID 2567) over 10 minutes with zero user interaction:
+6x10s ptmx=1782457915 pts/3=1782457915 (write)
+16x10s ptmx=1782458018 pts/3=1782458018 (write, +39s)
+23x10s ptmx=1782458082 pts/3=1782458082 (write, +64s)
+30x10s ptmx=1782458157 pts/3=1782458157 (write, +75s)
+33x10s ptmx=1782458184 pts/3=1782458184 (write, +27s)
Key observations:
- No child processes spawned (
children_2567=empty throughout) - No daemon running (
pgrep -af "supervisor|daemon"returned nothing) - Writes originate from the main Claude Code process itself
- Write interval averages ~55 seconds
/api/idleendpoint confirms timer is constantly reset: (curl -s http://localhost:8888/api/idle ← updated moments before the curl)
{"lastActiveTimestamp":"2026-06-26T07:22:52.900Z"}
### What Should Happen?
An idle Claude Code session (no user input, no active tasks) should not emit periodic terminal writes that defeat host-level idle detection mechanisms.
### Error Messages/Logs
```shell
Steps to Reproduce
- Launch Claude Code v2.1.187 in a SageMaker Code Editor terminal
- Resume or start a conversation
- Leave the session completely idle (no user input)
- Observe that the Code Editor idle shutdown timeout is never reached
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
v2.1.81 was working but this may not be the last working version
Claude Code Version
v2.2.187
Platform
AWS Bedrock
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_