{"record":{"id":"2a2ddec441a53842","repo":"Hmbown/CodeWhale","slug":"tty-shell-mode-is-not-supported-on-harmonyos-openh","errorCode":null,"errorMessage":"TTY shell mode is not supported on HarmonyOS/OpenHarmony yet.","messagePattern":"TTY shell mode is not supported on HarmonyOS/OpenHarmony yet\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/shell.rs","lineNumber":2572,"sourceCode":"            owner_session_id,\n            origin_tool_call_id,\n            origin_turn_id,\n            work_lifecycle,\n        } = spawn_context;\n        let task_id = format!(\"shell_{}\", &Uuid::new_v4().to_string()[..8]);\n        let mut spawn_guard =\n            ShellSpawnIntentGuard::new(work_lifecycle.clone(), &task_id, original_command);\n        let started = Instant::now();\n        let sandbox_type = exec_env.sandbox_type;\n        let sandboxed = exec_env.is_sandboxed();\n\n        // Build the command from ExecEnv\n        let program = exec_env.program();\n        let args = exec_env.args();\n\n        #[cfg(target_env = \"ohos\")]\n        if tty {\n            return Err(anyhow!(\n                \"TTY shell mode is not supported on HarmonyOS/OpenHarmony yet.\"\n            ));\n        }\n\n        let stdout_buffer = new_shared_raw_output();\n        let stderr_buffer = if tty || persist_pending || small_contract_mode {\n            None\n        } else {\n            Some(new_shared_raw_output())\n        };\n        // The spill file is best-effort: a full disk or exhausted descriptor\n        // table must not make `echo ok` unrunnable (that is exactly how the\n        // owner's session got wedged under swap exhaustion).\n        let bounded_output = small_contract_mode.then(|| {\n            Arc::new(Mutex::new(BoundedOutputAccumulator::new_in(\n                self.output_spill_dir.as_deref(),\n            )))\n        });","sourceCodeStart":2554,"sourceCodeEnd":2590,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tools/shell.rs#L2554-L2590","documentation":"TTY shell mode is explicitly unimplemented on HarmonyOS/OpenHarmony (target_env = \"ohos\"). The ohos platform lacks the PTY support this tool's TTY path needs, so the compile-time `#[cfg(target_env = \"ohos\")]` guard rejects any foreground request that sets `tty: true` before any process is spawned.","triggerScenarios":"Calling the shell/bash tool with `tty: true` on a build compiled for target_env = \"ohos\" (HarmonyOS/OpenHarmony), regardless of background setting in this code path.","commonSituations":"Running Codewhale on ohos-based devices or emulators and requesting TTY/interactive commands; cross-compiling for ohos and expecting feature parity with desktop Unix builds.","solutions":["Omit `tty: true` and run the command in non-TTY mode, capturing stdout/stderr directly","Implement the ohos PTY backend in the tool to lift the platform guard","Use a desktop build (Linux/macOS/Windows) when interactive TTY commands are required","Redirect input/output through files or pipes instead of a pseudo-terminal"],"exampleFix":"// before\n{ \"command\": \"vim notes.txt\", \"tty\": true }\n// after (on ohos)\n{ \"command\": \"vim notes.txt\" } // tty unsupported on ohos; use non-interactive commands","handlingStrategy":"validation","validationCode":"// ohos builds: never request a TTY\nif cfg!(target_env = \"ohos\") && request.tty {\n    // drop tty or route through a non-pty path before calling\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check target platform before requesting TTY mode; ohos does not support it","Design scripts to be non-interactive so the same call works on ohos and desktop","Keep a fallback path that runs commands without a PTY"],"tags":["shell","tty","harmonyos","platform-support"],"backgroundTag":"unsupported-platform","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}