Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ budgets:
language_servers: reported per server, not gated
milestones:
- {id: M0, name: "reset: docs, CI, hygiene", status: done}
- {id: M0e, name: "fix hosted native flakes #533, #622", status: active}
- {id: M0e, name: "fix hosted native flakes", status: active}
- {id: M1, name: "measurement: perf recorder and bench", status: "next, design approval pending"}
- {id: M2, name: "presentation latency and real 120 Hz", status: planned}
- {id: M3, name: "daily-use defects and durability", status: planned}
Expand All @@ -38,8 +38,8 @@ milestones:
- {id: M8, name: "real application and parity sweep, phase 5", status: planned}
autonomy: "Deepak: agents may push branches, open PRs, merge, and delete their own merged PR branches, except ask_first"
next:
- "M0e.1 #622 family: frames and close drains advance without display-link callbacks"
- "M0e.2 #533: crash stack from hosted CI, then fix what it shows"
- "M0e.1 #622: frames and closes finish without display-link callbacks"
- "M0e.2 drain-window flake and #533: pump diagnostics, CI crash capture, 2,000 hosted iterations, then fix what they show"
- "M0e.3 require known-flaky-native after 10 clean hosted runs plus a 300-iteration native_wake run, then stop"
ask_first: [dependency changes, destructive actions, milestone design kickoff, new subsystem or public API or relaxed invariant, unsafe boundary or allowlist change, license or copied-source change, weakening a CI gate or threshold, anything that costs money]
---
Expand Down
6 changes: 3 additions & 3 deletions apps/alpine-editor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8845,9 +8845,9 @@ pub mod native_validation {

mod accessibility_process;
pub use accessibility_process::{
NativeEditorAccessibilityEvidence, hosted_terminal_stall_retry_allowed,
qualify_editor_accessibility_process, validate_native_accessibility_omission_failure,
validate_native_language_startup_prefix, validate_native_language_startup_trace,
NativeEditorAccessibilityEvidence, qualify_editor_accessibility_process,
validate_native_accessibility_omission_failure, validate_native_language_startup_prefix,
validate_native_language_startup_trace,
};

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ const FRAME_TERMINAL_POLL: Duration = Duration::from_millis(100);
const DIAGNOSTIC_READY_TIMEOUT: Duration = Duration::from_secs(10);
const DIAGNOSTIC_READY_POLL: Duration = Duration::from_millis(5);
const MAX_LANGUAGE_TRACE_BYTES: u64 = 4_096;
const MAX_OMISSION_ERROR_BYTES: usize = 512;
// A frame-terminal timeout with both snapshots and the native completion probe
// measured about 2.7 KB on hosted CI; keep it whole with room to spare.
const MAX_OMISSION_ERROR_BYTES: usize = 8_192;
const REQUIRED_LANGUAGE_PHASES: [&str; 8] = [
"qualification-child",
"wrapper-invoked",
Expand Down Expand Up @@ -929,31 +931,6 @@ fn should_arm_hosted_observation(
&& armed_at_submission != Some(submission_count)
}

/// Returns whether one failed hosted child is the exact retryable command stall.
///
/// The retry belongs to the outer process harness. It never changes frame
/// ownership, the correctness deadline, physical evidence, or terminal state.
#[must_use]
pub fn hosted_terminal_stall_retry_allowed(
evidence_mode: &str,
attempt: u8,
status_succeeded: bool,
stdout: &str,
stderr: &str,
language_trace_complete: bool,
) -> bool {
evidence_mode == "hosted-direct"
&& attempt == 0
&& !status_succeeded
&& stdout.is_empty()
&& language_trace_complete
&& stderr.contains("dirty-close native frame failed")
&& stderr.contains("frame-terminal correctness-timeout failed after 1 observed submissions")
&& stderr
.contains("frame ownership did not become terminal before the correctness deadline")
&& stderr.contains("current=(occupied=1 submitted=1 paused=false")
}

const fn action_frame_bound_exceeded(frames: u64) -> bool {
frames > 1
}
Expand Down Expand Up @@ -2120,68 +2097,6 @@ mod process_contract_tests {
));
}

#[test]
fn hosted_terminal_retry_requires_every_exact_stall_fact() {
let stall = "dirty-close native frame failed: frame-terminal correctness-timeout failed after 1 observed submissions: frame ownership did not become terminal before the correctness deadline; current=(occupied=1 submitted=1 paused=false submissions=19)";
assert!(hosted_terminal_stall_retry_allowed(
"hosted-direct",
0,
false,
"",
stall,
true
));
assert!(!hosted_terminal_stall_retry_allowed(
"physical", 0, false, "", stall, true
));
assert!(!hosted_terminal_stall_retry_allowed(
"hosted-direct",
1,
false,
"",
stall,
true
));
assert!(!hosted_terminal_stall_retry_allowed(
"hosted-direct",
0,
true,
"",
stall,
true
));
assert!(!hosted_terminal_stall_retry_allowed(
"hosted-direct",
0,
false,
"unexpected output",
stall,
true
));
assert!(!hosted_terminal_stall_retry_allowed(
"hosted-direct",
0,
false,
"",
stall,
false
));
for non_stall in [
stall.replace("dirty-close", "initial"),
stall.replace("correctness-timeout", "event-loop"),
stall.replace("occupied=1", "occupied=0"),
] {
assert!(!hosted_terminal_stall_retry_allowed(
"hosted-direct",
0,
false,
"",
&non_stall,
true
));
}
}

#[test]
fn omission_failure_requires_the_exact_named_step_and_bounds_diagnostics() {
for step in [
Expand Down
32 changes: 1 addition & 31 deletions apps/alpine-editor/tests/native_process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,37 +160,7 @@ fn qualify_accessibility_child() -> Result<(), Box<dyn std::error::Error>> {
Ok::<_, Box<dyn std::error::Error>>((status, stdout, stderr, trace))
};

let evidence_mode = std::env::var("ALPINE_PRESENTATION_EVIDENCE_MODE")
.unwrap_or_else(|_| String::from("physical"));
let (first_status, first_stdout, first_stderr, first_trace) =
run_child(None, &root.join("home-normal"))?;
let first_trace_complete =
alpine_editor::native_validation::validate_native_language_startup_trace(&first_trace)
.is_ok();
let (status, stdout, stderr, trace) =
if alpine_editor::native_validation::hosted_terminal_stall_retry_allowed(
&evidence_mode,
0,
first_status.success(),
&first_stdout,
&first_stderr,
first_trace_complete,
) {
eprintln!(
"alpine-hosted-native-command-stall-retry attempt=1 status={first_status} stderr={first_stderr:?} language_trace={first_trace:?}"
);
let retry = run_child(None, &root.join("home-normal-retry"))?;
if !retry.0.success() {
return Err(format!(
"native Studio accessibility hosted retry failed; first=(status={first_status} stdout={first_stdout:?} stderr={first_stderr:?} language_trace={first_trace:?}) retry=(status={} stdout={:?} stderr={:?} language_trace={:?})",
retry.0, retry.1, retry.2, retry.3
)
.into());
}
retry
} else {
(first_status, first_stdout, first_stderr, first_trace)
};
let (status, stdout, stderr, trace) = run_child(None, &root.join("home-normal"))?;
if !status.success() {
return Err(format!(
"native Studio accessibility child failed with {status}; stdout={stdout:?}; stderr={stderr:?}; language_trace={trace:?}"
Expand Down
7 changes: 3 additions & 4 deletions crates/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ scope: framework crates under crates/
parent: ../AGENTS.md
updated: 2026-10-02
known_defects:
- "native_wake can SIGSEGV in teardown after close.armed on hosted runners (was #533); 0 of 25 locally"
- "an accessibility omission control in native_process can miss its 10 s frame deadline under hosted Metal validation (was #622)"
- "native_lifecycle missing-close drain can fail to run on hosted runners (drain.executed); listed under the #622 family, a re-run is allowed"
- "suspected: windowWillClose with work in flight pauses the display link without invalidate() (alpine-platform-macos/src/native.rs near 3070)"
- "native_wake can SIGSEGV in teardown after close.armed on hosted runners (was #533); none in 800 hosted iterations on 2026-10-02"
- "an accessibility omission control in native_process can miss its 10 s frame deadline under hosted Metal validation (was #622); M0e.1 fixes it, remove after 10 clean hosted runs"
- "run-loop drain markers can miss their 250 ms pump window on hosted runners (native_lifecycle missing-close, native_wake under NSZombie); not #622, cause unproven, a re-run is allowed"
known_flaky_ci: "#533 and #622 run in the known-flaky-native job, which ci-pass does not require; fix next, then require it"
---

Expand Down
85 changes: 85 additions & 0 deletions crates/alpine-platform-macos/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1551,6 +1551,91 @@ pub mod native_validation {
surface.implementation.completion_diagnostic()
}

/// Drops display-link updates while a frame is in flight, modeling a link
/// that stops delivering updates. Pass `false` to restore delivery.
pub fn inject_display_link_silence(surface: &NativeSurface, silenced: bool) {
surface.implementation.inject_display_link_silence(silenced);
}

/// Validation-only counters for the frame-progress timer.
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub struct FrameProgressEvidence {
silenced_updates: u64,
timer_schedules: u64,
timer_ticks: u64,
timer_terminals: u64,
timer_close_drains: u64,
timer_armed: bool,
}

impl FrameProgressEvidence {
pub(crate) const fn new(
silenced_updates: u64,
timer_schedules: u64,
timer_ticks: u64,
timer_terminals: u64,
timer_close_drains: u64,
timer_armed: bool,
) -> Self {
Self {
silenced_updates,
timer_schedules,
timer_ticks,
timer_terminals,
timer_close_drains,
timer_armed,
}
}

/// Returns display-link updates dropped by injected silence.
#[must_use]
pub const fn silenced_updates(self) -> u64 {
self.silenced_updates
}

/// Returns frame-progress timers scheduled for in-flight frames.
#[must_use]
pub const fn timer_schedules(self) -> u64 {
self.timer_schedules
}

/// Returns frame-progress timer callbacks.
#[must_use]
pub const fn timer_ticks(self) -> u64 {
self.timer_ticks
}

/// Returns frames whose terminal state the timer recorded.
#[must_use]
pub const fn timer_terminals(self) -> u64 {
self.timer_terminals
}

/// Returns closes that the timer drained and finished.
#[must_use]
pub const fn timer_close_drains(self) -> u64 {
self.timer_close_drains
}

/// Returns whether a frame-progress timer is scheduled now.
#[must_use]
pub const fn timer_armed(self) -> bool {
self.timer_armed
}
}

/// Returns frame-progress timer and injected-silence evidence.
#[must_use]
pub fn frame_progress_evidence(surface: &NativeSurface) -> FrameProgressEvidence {
surface.implementation.frame_progress_evidence()
}

/// Returns ownership and cleanup counts without closing the surface.
#[must_use]
pub fn owner_evidence(surface: &NativeSurface) -> Option<NativeOwnerEvidence> {
surface.implementation.owner_evidence()
}

/// Last display-link directive observed by native pause qualification.
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub enum PauseDirectiveEvidence {
Expand Down
Loading
Loading