Hmbown/CodeWhale · error · anyhow::Error
TTY shell mode is not supported on HarmonyOS/OpenHarmony yet
Error message
TTY shell mode is not supported on HarmonyOS/OpenHarmony yet.
What it means
Background TTY spawning is gated per-platform: under #[cfg(target_env = "ohos")] (HarmonyOS/OpenHarmony builds) a tty: true request returns this error at spawn time. The pty allocation used on desktop Unix platforms is not yet available in the OHOS environment, so interactive TTY shells are explicitly unsupported there.
Source
Thrown at crates/tui/src/tools/shell.rs:2397
let ShellSpawnContext {
owner_agent,
owner_session_id,
work_lifecycle,
} = spawn_context;
let task_id = format!("shell_{}", &Uuid::new_v4().to_string()[..8]);
let mut spawn_guard =
ShellSpawnIntentGuard::new(work_lifecycle.clone(), &task_id, original_command)?;
let started = Instant::now();
let sandbox_type = exec_env.sandbox_type;
let sandboxed = exec_env.is_sandboxed();
// Build the command from ExecEnv
let program = exec_env.program();
let args = exec_env.args();
#[cfg(target_env = "ohos")]
if tty {
return Err(anyhow!(
"TTY shell mode is not supported on HarmonyOS/OpenHarmony yet."
));
}
let stdout_buffer = new_shared_raw_output();
let stderr_buffer = if tty || persist_pending || small_contract_mode {
None
} else {
Some(new_shared_raw_output())
};
// The spill file is best-effort: a full disk or exhausted descriptor
// table must not make `echo ok` unrunnable (that is exactly how the
// owner's session got wedged under swap exhaustion).
let bounded_output = small_contract_mode.then(|| {
Arc::new(Mutex::new(BoundedOutputAccumulator::new_in(
self.output_spill_dir.as_deref(),
)))
});View on GitHub (pinned to 0c42157ee5)
Solutions
- Omit tty (run the command with piped stdio) on OHOS.
- If interactivity is required, use a non-TTY background task with stdin writes.
- Track upstream support for pty on OHOS before re-enabling tty.
Example fix
// before (on HarmonyOS/OpenHarmony)
exec_shell("top", { tty: true, background: true })
// after
exec_shell("top -b -n 1", { background: false }) Defensive patterns
Strategy: validation
Validate before calling
// cfg-based guard at build/logic time
#[cfg(target_env = "ohos")]
if request.tty {
anyhow::bail!("tty is not supported on this platform; run without tty");
}
exec_shell(request)?; Type guard
function supportsTty(): boolean {
return process.platform !== 'ohos'; // guard before setting tty: true
} Prevention
- Feature-detect TTY support per platform before enabling tty in agent configs.
- Default tty to false in shared/session configs and enable it only on supported platforms.
When it happens
Trigger: Running a HarmonyOS/OpenHarmony build of the TUI and issuing a background shell request with tty: true.
Common situations: Cross-compiled or on-device OHOS deployment where an agent or session config requests TTY mode; behavior differs from the same request on Linux/macOS.
Related errors
- TTY mode requires background execution (set background: true
- interactive key entry requires a terminal; use `--api-key-st
- external credential consent was not saved: non-interactive u
- Linux riscv64 release assets are temporarily unavailable bec
- stdin is not a terminal; pass --yes to confirm the disclosed
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/2a2ddec441a53842.
Report an issue: GitHub.