{"record":{"id":"63e80a18a5fdba6e","repo":"Hmbown/CodeWhale","slug":"terminal-window-change-was-not-observed-before-the-deadline","errorCode":null,"errorMessage":"terminal window change was not observed before the deadline","messagePattern":"terminal window change was not observed before the deadline","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tui/window_control.rs","lineNumber":476,"sourceCode":"                }\n            }\n            let applied = wait_for(host, Duration::from_millis(400), |observed| {\n                observed.matches(target)\n            })?;\n            tracing::info!(\n                applied,\n                restoring,\n                attempt,\n                \"window_control: observed window result\"\n            );\n            if applied {\n                if restoring {\n                    *state = State::new();\n                }\n                return Ok(target.topmost);\n            }\n        }\n        bail!(\"terminal window change was not observed before the deadline\")\n    }\n\n    pub(super) fn pinned() -> bool {\n        PINNED.load(Ordering::Acquire)\n    }\n\n    #[cfg(test)]\n    mod tests {\n        use super::*;\n\n        #[test]\n        fn pin_receipt_requires_observed_geometry_and_topmost_state() {\n            let target = Observation {\n                rect: RECT {\n                    left: 20,\n                    top: 30,\n                    right: 660,\n                    bottom: 430,","sourceCodeStart":458,"sourceCodeEnd":494,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tui/window_control.rs#L458-L494","documentation":"toggle_pin's final wait_for polls (up to 400ms) for the window to reach the requested target state (position/size/topmost/maximized). If the loop exhausts without observing a match — and the restore path did not reset state — the function bails with this error, indicating the window change was requested but never confirmed.","triggerScenarios":"wait_for(host, 400ms, |observed| observed.matches(target)) returned false: SetWindowPos/ShowWindow were issued but observation never saw the window match the target state before the deadline (excluding the early-return path when the change was already observed).","commonSituations":"Heavy system load slowing window updates; another program (window manager, hotkey tool) fighting over the window's position/topmost flag; DPI/monitor changes invalidating the computed rect; the 400ms deadline being too tight.","solutions":["Retry toggle_pin — transient contention commonly causes deadline misses.","Close competing window-management utilities (or hotkeys) that reposition or unpin the terminal.","Re-capture the host and toggle again if the window's state was changed externally mid-operation.","If reproducible under load, increase the 400ms apply deadline in window_control.rs (toggle_pin)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match toggle_pin() {\n    Err(e) if e.to_string().contains(\"not observed before the deadline\") => retry_once_after_delay(),\n    other => other?,\n}","preventionTips":["Retry; 400ms is short on loaded systems.","Disable competing window managers/hotkey tools that move the same window.","Avoid toggling during monitor/DPI changes.","Fall back gracefully: if the state can't be confirmed, leave pinning off."],"tags":["windows","win32","timeout","terminal-window"],"backgroundTag":"request-timeout","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"}