Terminus-2 / AKernel (runsc): Ctrl-C fails with unread canonical input, even with recording disabled
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- linux, python
- Domain
- backend, operating-systems
Research direction
Start with the standalone Python PTY reproducer in the issue and compare its results with the referenced gVisor line_discipline.go path, especially inputQueueTransformer.transform() and its VINTR/ISIG handling. The issue does not identify the deployed runsc revision, so first establish which runtime build is affected. Done means a backend regression test reproduces the queued complete-line failure and verifies Ctrl-C interrupts the foreground process.
Written by the indexing model from the issue text.
Description
Summary
While investigating Terminus-2 terminal hangs, we reproduced a Ctrl-C failure with a small, standard-library-only Python PTY program. The minimal reproducer does not use Harbor, tmux, asciinema, an LLM, or a large paste.
In the tested AKernel sandbox configured with runtime="runsc", a child that does not read stdin remains alive after its PTY master receives b"\x03" if b"echo queued\n" was written first. The same child exits when sent SIGINT directly. An empty input queue and an incomplete line (b"echo queued", without the newline) do not trigger the failure.
The Linux control does not exhibit this behavior.
I am reporting this here as an AKernel/runsc backend compatibility problem affecting Terminus-2, with evidence that the underlying failure is below the terminal harness. I am not claiming that Harbor itself causes the PTY defect. In agent runs, failed interrupts can lead to repeated recovery actions and long rollouts without stopping the original command.
Expected behavior
With ICANON and ISIG enabled and VINTR == 0x03, Ctrl-C should interrupt the foreground process even when an earlier complete input line remains unread.
Minimal reproducer
Run the following with Python 3 on Linux, first in a normal Linux environment and then in the affected runsc-backed sandbox. No third-party Python packages are required. The script creates its own PTYs and child processes, checks readiness, and cleans up those children.
"""Linux-only, standard-library PTY repro: no Harbor, tmux, or asciinema."""
import array
import fcntl
import json
import os
import pty
import select
import signal
import termios
import time
def run(payload):
pid, master = pty.fork()
if pid == 0:
signal.signal(signal.SIGINT, signal.default_int_handler)
os.write(1, (json.dumps(dict(ready=True,tty_foreground=os.tcgetpgrp(0),pgrp=os.getpgrp()))+'\n').encode())
try:
while True:
pass
except KeyboardInterrupt:
os._exit(130)
reaped = False
def exited():
nonlocal reaped
if not reaped:
reaped = os.waitpid(pid, os.WNOHANG)[0] == pid
return reaped
try:
if not select.select([master], [], [], 5)[0]:
raise RuntimeError('child readiness timeout')
ready=json.loads(os.read(master, 1024))
assert ready['ready']
slave = os.open(f'/proc/{pid}/fd/0', os.O_RDONLY | os.O_NONBLOCK | os.O_NOCTTY)
try:
attr = termios.tcgetattr(slave)
row = dict(payload=payload.decode(), canonical=bool(attr[3] & termios.ICANON),
isig=bool(attr[3] & termios.ISIG), vintr=list(attr[6][termios.VINTR]),
foreground_matches=ready['tty_foreground']==ready['pgrp'])
if payload:
row['payload_written'] = os.write(master, payload)
time.sleep(0.2)
row['unread_before'] = array.array('i', fcntl.ioctl(slave, termios.FIONREAD, bytes(4)))[0]
row['ctrl_c_written'] = os.write(master, b'\x03')
time.sleep(1)
row['alive_after_1s'] = not exited()
if not reaped:
time.sleep(2)
row['alive_after_3s_or_exit'] = not exited()
if not reaped:
os.kill(pid, signal.SIGINT)
time.sleep(0.2)
row['alive_after_direct_sigint'] = not exited()
return row
finally:
os.close(slave)
finally:
if not reaped:
os.kill(pid, signal.SIGKILL)
os.waitpid(pid, 0)
os.close(master)
if __name__ == '__main__':
print(json.dumps([dict(repeat=i, **run(p)) for i in [1, 2]
for p in [b'', b'echo queued', b'echo queued\n']]))
Results
The raw PTY program above was run twice per input condition in each environment. All 12 cases confirmed ICANON, ISIG, VINTR == 3, and that the child was the terminal foreground process group, using tcgetpgrp(0) in the child itself.
| Input before the interrupt byte | Normal Linux: failed / trials | AKernel/runsc: failed / trials |
|---|---|---|
| None | 0 / 2 | 0 / 2 |
echo queued (11 bytes, no newline) |
0 / 2 | 0 / 2 |
echo queued\n (12 bytes, complete line) |
0 / 2 | 2 / 2 |
For the failing raw PTY cases, writing the interrupt byte returned 1, the child was still alive after 3 seconds, and a direct os.kill(pid, SIGINT) terminated it. The complete line had 12 unread bytes; an incomplete line had zero bytes reported as readable in canonical mode.
We also compared the unmodified upstream TmuxSession module at Harbor commit e26966a026f872925979d8479b7ace236b68303f with our locally modified module, using the same command-execution adapter. These are real terminal executions, not mocked tmux calls. We exercised session startup and send_keys("C-c", block=False, min_timeout_sec=0.1). We did not run a complete unmodified Harbor installation or an LLM agent loop.
| Terminal implementation | Recording | Linux with unread line | AKernel/runsc with unread line | AKernel/runsc without unread line |
|---|---|---|---|---|
| Upstream | Off | 0 / 2 failed | 2 / 2 failed | 0 / 2 failed |
| Upstream | On | 0 / 2 failed | 2 / 2 failed | 0 / 2 failed |
| Local | Off | 0 / 2 failed | 2 / 2 failed | 0 / 2 failed |
| Local | On | 0 / 2 failed | 2 / 2 failed | 0 / 2 failed |
All Linux empty-input controls also passed. The comparison contains 32 terminal cases, with no test-setup errors in those counted cases. For the 8 failing runsc terminal cases, send_keys returned promptly, the child remained alive at the 15-second observation, and direct SIGINT terminated it. Recording-off sessions were created with both recording paths set to None; the runsc recording-on cases additionally checked that a nonempty cast file had been created.
Environment versions:
- Linux terminal control: tmux 3.4, asciinema 2.2.0, Python 3.12.3, reported kernel
5.10.134-19.100.al8.x86_64. - AKernel/runsc: tmux 3.3a, asciinema 2.2.0, Python 3.11.16, reported kernel
4.19.0-gvisor. - The exact deployed runsc build/commit was not captured. The Linux and runsc userland versions differ; the standard-library-only PTY reproducer removes both tmux and asciinema from the failure path.
/proc/<pid>/statreports a zero foreground-group field in this runsc environment. We therefore validate foreground membership usingtcgetpgrp(0)inside the child, rather than treating that proc field as authoritative.
Relationship to existing reports
- Harbor #2677 discusses a recorder-related PTY deadlock during large pastes. Our minimal reproducer uses neither a recorder nor a large paste: the trigger is a 12-byte complete input line.
- Harbor #3472 concerns an incorrect parser warning that encourages adding a newline to
C-c. Our reproducer writes exactly the interrupt byte; the Terminus-2 comparison sends exactlyC-c. - gVisor #9898 is a related historical PTY signal report. We have not established whether this is related to that issue or a different runtime defect.
Suspected location, not a confirmed deployed-source root cause
The early return for an already-readable canonical input queue in gVisor's inputQueueTransformer.transform() occurs before the VINTR / ISIG handling. That is consistent with the newline-sensitive behavior, but we have not identified the deployed runsc binary revision and cannot claim this source path has been traced in that deployment.
Reference source: line_discipline.go at 5be33d2bea487d01b7506d2aff0bb15d44bc2170.
Does Harbor have a recommended backend-capability check or interrupt-recovery mechanism for this case? Would a backend-specific regression test or documentation be useful? The standalone reproducer should also help the runtime maintainers investigate once the deployed runsc revision is identified.
This report establishes a failure in the tested runtime-backed environment; it does not establish a regression across all Harbor installations or all current gVisor builds.
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 1.9k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 156
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from harbor-framework/harbor
-
Trial runs the agent's `populate_context_post_run` on the event loop, so trials that end together stall the orchestrator for secondsPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
harbor-framework/harbor#4652 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
harbor-framework/harbor#4494 · 1 comment ·
Maintainers usually reply within 1 day
-
step workdir upload resets the work folder's owner and permissions in ModalPossibly taken @Sauvi72 claimed this 8 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
harbor-framework/harbor#4487 · 3 comments ·
Maintainers usually reply within 1 day
-
Docker: verifier log mounts are chmod 777 (no sticky), so rewardkit sandboxed graders die before writing a rewardPossibly taken @yuyz-cyber claimed this 6 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
harbor-framework/harbor#4469 · 1 comment ·
Maintainers usually reply within 1 day
-
Compare and Pareto hide total token usage when the cached token count is missingPossibly taken @Aafimalek claimed this 10 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
harbor-framework/harbor#4448 ·
Maintainers usually reply within 1 day
All issues in harbor-framework/harbor
Similar issues
-
soup prune-prompt exits 1 after writing its output on a file over 100,000 rows, and reports a capped row count otherwisePossibly taken @abdulwaarith0 claimed this today. Openneeds-triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
MakazhanAlpamys/Soup#3690 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug data-types native-format
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
ClickHouse/clickhouse-connect#1320 ·
Maintainers usually reply within 1 day
-
accepted
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
future-agi/future-agi#6392 ·
Maintainers usually reply within 1 day