Skip to content

fix(client-state): let one slow identity helper use the whole lookup budget - #1400

Merged
pascalandr merged 1 commit into
devfrom
fix/cross-host-identity-budget
Nov 8, 2026
Merged

pascalandr merged 1 commit into
devfrom
fix/cross-host-identity-budget

Conversation

@pascalandr

Copy link
Copy Markdown
Contributor

Why

Intermittent Windows CI failure in client_state::cross_host::tests (cross_host.rs:1135 / :1068, ~10.4–11 s each, seen on #1362, #1363, #1369, #1397). The Node host reads its birth identity through PowerShell with two 5 s attempts; under heavy contention a cold PowerShell start exceeds 5 s, both attempts time out, election correctly fails closed and Node never becomes primary. Reproduced locally under controlled contention with real ETIMEDOUT.

Change

Same nominal 10 s total, same two attempts, but one shared deadline (Node client-state-process-identity.ts, Rust cross_host.rs command_value): a slow first helper can use the whole budget; a retry only gets the remainder. Identity semantics, helpers and fail-closed behaviour unchanged.

This is a mitigation, not a removal of PowerShell: extreme contention can still exceed 10 s. (A native-API alternative was prototyped but not pursued.)

Validation

  • New tests: 6 s cold helper succeeds; retry gets only the remaining budget; exhausted budget stays unavailable without another helper. They fail on the previous code.
  • cross_host Rust module: 0/10 failures normal, 0/6 under moderate load; existing test bodies and assertions unchanged.

…budget

The Electron Node host and the Tauri Rust host read a process's birth identity on Windows (and macOS) through a short-lived helper (PowerShell on Windows), with two attempts of five seconds each. Under heavy CPU contention a cold PowerShell start exceeds five seconds; both attempts time out, the host reports no identity, and cross-host election correctly fails closed, so the Node host never becomes primary. This is the intermittent Windows CI failure in client_state::cross_host::tests (cross_host.rs:1135 / :1068, about 10.4-11 s per failure), reproduced locally under controlled contention with real ETIMEDOUT results.

Keep the same nominal ten-second total and the same two attempts, but share one deadline: a slow first helper may use the whole budget, and a retry only gets what remains. Identity semantics, the helpers and fail-closed behaviour on genuine failure are unchanged. This is a mitigation of slow cold starts, not a removal of the helper: extreme contention can still exceed the total budget.

New tests cover a six-second cold helper succeeding, a retry receiving only the remaining budget, and budget exhaustion staying unavailable without starting another helper; they fail on the previous code. The cross_host Rust module passes 0/10 failures normally and 0/6 under moderate load; existing test bodies and assertions are unchanged.
@pascalandr

Copy link
Copy Markdown
Contributor Author

The only failure is tests-runtime-contracts (minimum): test-native-mission-schedule-product.mjs timed out in natural-cold-first-admission (120 s cold-admission observation window, after the service registered normally). This PR only changes the Electron/Rust identity-helper timing used by client-state election. The same stage failed on unrelated #1399 on the same dev commit, while in the same #1399 run the other variant passed in 1.4 s with the identical bundle; #1398's green run used the same root lockfile. No dev-commit regression is established and the uploaded diagnostic lacks the state needed to explain it; that is being addressed separately. Rerunning only this job; a green rerun is not treated as an explanation.

@pascalandr
pascalandr merged commit 1c99934 into dev Nov 8, 2026
43 of 44 checks passed
@pascalandr
pascalandr deleted the fix/cross-host-identity-budget branch November 8, 2026 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant