Fence Windows sync until the helper confirms the signed decision
Rust development slice / linux (push) Failing after 7s

This commit is contained in:
2026-11-15 22:28:49 +01:00
parent 17c53c1602
commit 148969f0c6
5 changed files with 155 additions and 11 deletions
+22 -1
View File
@@ -498,6 +498,8 @@ struct Agent {
#[cfg(feature = "system-helper")]
prepared_request: Option<Vec<u8>>,
#[cfg(feature = "system-helper")]
helper_apply_unconfirmed: bool,
#[cfg(feature = "system-helper")]
helper_lane: Arc<tokio::sync::Semaphore>,
#[cfg(feature = "system-helper")]
helper: Option<rmm_agent_windows::helper_runtime::Client>,
@@ -693,6 +695,7 @@ impl Agent {
#[cfg(feature = "system-helper")]
{
self.helper_control.is_some()
|| self.helper_apply_unconfirmed
|| self.helper_probe.is_some()
|| !self.helper_checked
|| self.helper_refused
@@ -789,6 +792,7 @@ impl Agent {
} else {
sync.confirm_helper(&mapped)?;
}
self.helper_apply_unconfirmed = false;
self.open_fence(generation)?;
}
}
@@ -825,6 +829,7 @@ impl Agent {
}
if self.helper_probe.is_none()
&& self.helper_control.is_none()
&& !self.helper_apply_unconfirmed
&& !self.prepared
&& self.running.is_none()
&& !self.journal.connection().query_row("SELECT EXISTS(SELECT 1 FROM job_attempts WHERE state IN ('requesting','running','verifying'))",[],|r|r.get::<_,bool>(0))?
@@ -1124,6 +1129,10 @@ impl Agent {
self.prepared = false;
let sync = self.sync.as_mut().context("SYNC_NOT_CONFIGURED")?;
let applied = sync.apply(self.journal.connection_mut(), &response, &self.clock)?;
#[cfg(feature = "system-helper")]
if applied.helper_instruction.is_some() {
self.helper_apply_unconfirmed = true;
}
sync.apply_consumption(
self.ledger.as_mut().context("LEDGER_REQUIRED")?,
&self.clock,
@@ -1140,11 +1149,15 @@ impl Agent {
.prepared_request
.take()
.context("ORIGINAL_SYNC_REQUEST_REQUIRED")?;
let until = sync.validity_deadline().context("SIGNED_LEASE_REQUIRED")?;
let clock = self.clock.clone();
let boot = self.channel(generation)?.boot_id;
self.helper_control = Some(HelperControl::Apply(
generation,
tokio::spawn(async move {
helper.apply(&instruction.response, request, boot).await
helper
.apply(&instruction.response, request, boot, until, &clock)
.await
}),
));
return Ok(());
@@ -1594,6 +1607,12 @@ impl Agent {
}
async fn session(&mut self, stop: &AtomicBool) -> Result<()> {
self.close_gate();
#[cfg(feature = "system-helper")]
{
// Reconnect discards the old channel. ClientSync::prepare checks
// the authenticated helper head against the durable agent journal.
self.helper_apply_unconfirmed = false;
}
let result = self.session_inner(stop).await;
self.close_gate();
#[cfg(feature = "system-helper")]
@@ -1922,6 +1941,8 @@ fn service_run(stop: &'static AtomicBool) -> Result<()> {
#[cfg(feature="system-helper")]
prepared_request:None,
#[cfg(feature="system-helper")]
helper_apply_unconfirmed:false,
#[cfg(feature="system-helper")]
helper_lane:Arc::new(tokio::sync::Semaphore::new(1)),
#[cfg(feature="system-helper")]
helper:None,