Skip to content

[WSLC] Preserve backend failure classification across the state-aware daemon protocol - #1240

Merged
Soham Das (SohamDas2021) merged 1 commit into
mainfrom
sohamdas2021-wslc-state-aware-error-classification
Sep 22, 2026
Merged

Soham Das (SohamDas2021) merged 1 commit into
mainfrom
sohamdas2021-wslc-state-aware-error-classification

Conversation

@SohamDas2021

@SohamDas2021 Soham Das (SohamDas2021) commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

📖 Description

A host that cannot run WSLc now returns backend_unavailable to state-aware callers, and a policy the backend refuses returns policy_validation. Both previously arrived as backend_error, so the state-aware and one-shot surfaces disagreed about the same host condition and a caller had to string-match the message to tell an unusable host from a rejected policy.

The daemon's step helpers already attributed each failure to a phase, but the daemon threw that away when it reduced the step result to a bare message before replying over its named pipe. Every failure — unusable host, rejected policy, busy container — arrived flattened. The classification now survives the pipe, so all four non-exec phases (provision / start / stop / deprovision) report the same code the one-shot surface reports.

🔗 References

Resolves #1167. Split out of #843 (defect 4); originally raised in review on #1045. Typed backend errors came from #794.

🔍 Validation

  • cargo fmt --all -- --check and cargo clippy --all-targets -- -D warnings, clean — including the feature-gated consumers (wxc, mxc_engine, mxc_ffi with --features wslc).
  • cargo test --workspace, plus new unit tests covering the classification at each seam: phase → error kind in the daemon, kind → wire code on the client, and an unrecognized kind decoding to the catch-all.
  • On a real WSL2 host: the #[ignore]d full_lifecycle_over_pipe test, which drives provision → start → exec → stop → deprovision through the daemon over a live named pipe. This is the regression check that unit tests cannot reach.
  • E2E harness run_wslc_state_aware_tests.ps1: 76/77.

✅ Checklist

📋 Issue Type

  • Bug fix
  • Feature
  • Task
Microsoft Reviewers: Open in CodeFlow

…aemon protocol

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: dce3a7ac-f357-4bee-a2bc-38b1d1d873bd
Copilot AI balanced review requested due to automatic review settings September 22, 2026 23:06
@SohamDas2021
Soham Das (SohamDas2021) requested a review from a team as a code owner September 22, 2026 23:06
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused implementation preserves compatibility and includes appropriate seam-level coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Preserves WSLc failure classifications across the state-aware daemon boundary.

Changes:

  • Adds typed unavailable/rejected daemon errors.
  • Maps them to existing SDK error codes.
  • Provides forward-compatible unknown-kind handling and tests.
File Description
session_manager.rs Preserves step failure phases.
state_aware.rs Maps daemon kinds to SDK errors.
daemon_protocol.rs Extends error kinds compatibly.
wslc-state-aware.md Documents error mapping and compatibility.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@SohamDas2021 Soham Das (SohamDas2021) changed the title Preserve WSLc backend failure classification across the state-aware daemon protocol [WSLC] Preserve backend failure classification across the state-aware daemon protocol Sep 22, 2026

@bbonaby Branden Bonaby (bbonaby) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we'll one day be able to move this daemon to be the mxc-daemon rather than wslc specific. I guess that only really makes sense if we have more than one using it.

I say this assuming there is no way to make wslc state aware completely in proc right?

@SohamDas2021
Soham Das (SohamDas2021) merged commit 24d7d17 into main Sep 22, 2026
31 checks passed
@SohamDas2021
Soham Das (SohamDas2021) deleted the sohamdas2021-wslc-state-aware-error-classification branch September 22, 2026 23:43
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.

[WSLC] State-aware daemon protocol flattens every backend failure to backend_error, discarding its typed classification

3 participants