Skip to content

Shellper terminal becomes unresponsive after prolonged use or large output #313

@waleedkadous

Description

@waleedkadous

Description

After extended use or a large amount of terminal output, the shellper terminal in the browser becomes unresponsive — it stops updating the display and stops accepting input.

Suspected Root Cause

There may be a buffer limit, memory ceiling, or timeout in the shellper pipeline (shellper process → WebSocket → xterm.js) that causes it to silently stop processing after hitting a threshold. Possible areas:

  1. Replay buffer sizeshellper-replay-buffer.ts may have a cap that causes issues when exceeded
  2. WebSocket backpressure — large output may overwhelm the WS connection, causing it to stall
  3. xterm.js write buffer — the browser-side terminal may stop processing writes after too much data
  4. PTY buffer limits — the underlying PTY may fill its buffer and block
  5. Shellper process memory — the shellper child process may accumulate memory until it stops responding

Steps to Reproduce

  1. Open a builder terminal in the dashboard
  2. Run commands that produce large output (e.g., npm test, npm run build, long AI sessions)
  3. After some time or volume of output, the terminal freezes — no display updates, no input accepted

Expected

Terminal remains responsive regardless of session duration or output volume.

Key Files

  • packages/codev/src/terminal/shellper-replay-buffer.ts
  • packages/codev/src/terminal/shellper-process.ts
  • packages/codev/src/terminal/shellper-client.ts
  • packages/codev/src/terminal/pty-manager.ts
  • packages/codev/src/terminal/session-manager.ts
  • packages/codev/dashboard/src/components/Terminal.tsx
  • packages/codev/src/agent-farm/servers/tower-server.ts (WebSocket handler)

Investigation Needed

  • Check all buffer sizes, caps, and limits in the shellper pipeline
  • Check for any TTL or timeout on shellper sessions
  • Check WebSocket flow control / backpressure handling
  • Check xterm.js addon configuration (fit, write buffer)
  • Add diagnostic logging if needed to identify exactly where the pipeline stalls

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions