agent deploy --silent fails with 'bufio.Scanner: token too long' during Docker build
Description
lk agent deploy --silent fails with bufio.Scanner: token too long when the Docker build output contains long lines (e.g., pip install logs).
Without --silent, lk agent deploy hangs on an interactive confirmation prompt in non-interactive shells (CI/CD, automation). So there's no working path for automated deploys in v2.14.0–2.16.0.
Reproduction
# Minimal Python agent project (1.4MB, clean directory)
lk --version # 2.16.0
lk --project <project> agent deploy --silent --secrets-file .env.cloud-agent
Output:
Detected agent language [python.pip]
#1 [internal] load remote build context
#1 DONE 1.2s
#2 copy /context /
#2 DONE 0.1s
#3 [internal] load metadata for docker.io/library/python:3.13-slim
#3 DONE 0.8s
unable to deploy agent: bufio.Scanner: token too long
The build starts correctly (steps 1-3 succeed) but crashes when pip install output exceeds the Go bufio.Scanner default buffer size (64KB).
Two Issues
-
v2.14.0+:
lk agent deployhangs on an interactive prompt when stdin is not a terminal.--silentflag (added in v2.16.0) is the intended fix, but it has bug #2. -
v2.16.0
--silent: Docker build log streaming usesbufio.Scannerwhich has a default max token size of 64KB. Pip install output can exceed this, causing the scanner to fail.
Expected Behavior
lk agent deploy --silent should complete the Docker build regardless of output line length.
Workaround
Using v2.13.1 (installed via Homebrew, no standalone macOS binary available) works. v2.13.1 didn't have the interactive prompt and handled long build output correctly.
Environment
- macOS Darwin 25.4.0 (Apple Silicon)
- lk version 2.16.0 (also tested 2.14.0, 2.15.0)
- Agent language: python.pip
- Project has custom Dockerfile with
download-filesstep removed