{"record":{"id":"d080bed474a8e98e","repo":"Hmbown/CodeWhale","slug":"pty-resize-is-unavailable-on-this-platform","errorCode":null,"errorMessage":"PTY resize is unavailable on this platform","messagePattern":"PTY resize is unavailable on this platform","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/tui/src/tools/shell.rs","lineNumber":2939,"sourceCode":"        );\n        #[cfg(not(target_env = \"ohos\"))]\n        {\n            let master = shell.pty_master.as_ref().context(\"Job is not a PTY\")?;\n            master\n                .resize(PtySize {\n                    rows: size.rows,\n                    cols: size.cols,\n                    pixel_width: 0,\n                    pixel_height: 0,\n                })\n                .context(\"Failed to resize PTY\")?;\n            shell.terminal_size = Some(size);\n            Ok(())\n        }\n        #[cfg(target_env = \"ohos\")]\n        {\n            let _ = size;\n            Err(anyhow!(\"PTY resize is unavailable on this platform\"))\n        }\n    }\n\n    pub fn write_stdin_for_session(\n        &mut self,\n        active_session_id: &str,\n        task_id: &str,\n        input: &str,\n        close: bool,\n    ) -> Result<()> {\n        self.require_session_owner(task_id, active_session_id)?;\n        self.write_stdin(task_id, input, close)\n    }\n\n    /// Get incremental output from a background process, consuming any new output.\n    fn get_output_delta(\n        &mut self,\n        task_id: &str,","sourceCodeStart":2921,"sourceCodeEnd":2957,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tools/shell.rs#L2921-L2957","documentation":"On the ohos target environment the PTY master implementation has no resize capability, so resize_pty is hard-wired to return 'PTY resize is unavailable on this platform'. The size argument is deliberately ignored (let _ = size). This is a static platform limitation, not a job-state problem — it fires for every resize call under cfg(target_env = \"ohos\").","triggerScenarios":"Any call to resize_pty on a build targeting OHOS (target_env = \"ohos\"), regardless of job state or requested dimensions.","commonSituations":"Running the TUI on an OpenHarmony device where the user resizes the terminal; tests compiled for the ohos target exercising PTY resize; porting code that assumes portable-pty resize support.","solutions":["Skip PTY resize calls on ohos; guard the call site with a platform check and treat resize as a no-op there.","Persist the requested size (shell.terminal_size) and apply it at next spawn on supported platforms if the size must not be lost.","If resize support is required, use a platform that exposes PTY resize (not(target_env = \"ohos\")) or contribute an ohos resize implementation to the PTY backend.","Update any feature-detection/UI affordances to hide the resize control on ohos."],"exampleFix":"// before\nmanager.resize_pty(task_id, size)?;\n// after\n#[cfg(not(target_env = \"ohos\"))]\nmanager.resize_pty(task_id, size)?;\n#[cfg(target_env = \"ohos\")]\nlet _ = size; // PTY resize unsupported on ohos","handlingStrategy":"fallback","validationCode":"// Rust: compile-time/platform gate before calling resize\n#[cfg(target_env = \"ohos\")]\nfn pty_resize_supported() -> bool { false }\n#[cfg(not(target_env = \"ohos\"))]\nfn pty_resize_supported() -> bool { true }\n\nif pty_resize_supported() {\n    manager.resize_pty(task_id, size)?;\n} else {\n    eprintln!(\"PTY resize unsupported on this platform; ignoring\");\n}","typeGuard":null,"tryCatchPattern":"match manager.resize_pty(task_id, size) {\n    Ok(()) => (),\n    Err(e) if e.to_string().contains(\"unavailable on this platform\") => {\n        // remember the size for a future spawn instead; do not retry\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Feature-detect platform support once at startup and disable resize UI on ohos","Never retry this error — it is static per build target, not transient","On ohos, carry the desired terminal size into the next spawn rather than resizing live","Cover the ohos branch in cfg-gated tests so the fallback path stays exercised"],"tags":["pty","platform","ohos","unsupported"],"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"}