Skip to content

feat(cua-driver): capture embedded startup diagnostics - #3281

Open
injaneity wants to merge 5 commits into
mainfrom
feat/embedded-host-diagnostics
Open

feat(cua-driver): capture embedded startup diagnostics#3281
injaneity wants to merge 5 commits into
mainfrom
feat/embedded-host-diagnostics

Conversation

@injaneity

@injaneity injaneity commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add opt-in stderr capture to EmbeddedCuaDriverHost and expose bounded startup diagnostics through generated Python and TypeScript bindings.
  • Retain the final 65,536 stderr bytes, report truncation only when bytes were discarded, and preserve the child exit code when known.
  • Give each startup its own diagnostics capture so stale stderr tasks cannot modify a later generation.
  • Make one managed child own the process, liveness pipe, stderr pump, and shutdown timeout.
  • Preserve existing stderr inheritance and constructor defaults, export EmbeddedDriverDiagnostics from Python, and document the sensitivity of raw stderr.

Refs #3278.

Design

Each startup creates one shared diagnostics capture. The host retains it as the latest result, while the stderr pump writes directly to that same capture. A successful startup clears it by reference identity. An old pump only retains its detached capture and therefore cannot reach diagnostics from a newer startup.

The managed child provides one cleanup path for graceful shutdown, forced termination, stderr draining, and exit-status recording. This removes generation fields and comparisons from diagnostics, the fixed 250 ms startup shutdown path, and the former standalone append, clear, finish, and terminate helpers.

Diff scope

The committed generated bindings account for 203 added lines. Focused tests account for 139 added lines. The handwritten Rust runtime change is 293 additions and 57 removals, or 236 net lines. The ownership refactor removed 43 net handwritten lines from the earlier candidate. No unrelated product files are included.

Validation

Local validation:

  • cargo check -p cua-driver-sdk --lib --locked — passed
  • cargo test -p cua-driver-sdk --lib --locked — 53 passed
  • cargo test -p cua-driver --test embedded_host_sdk_mcp_test --locked — 6 passed
  • node libs/cua-driver/scripts/generate-uniffi-bindings.mjs --check — passed
  • Python generated-options and public diagnostics import tests — 2 passed
  • cargo fmt --all -- --check — passed
  • git diff --check — passed

All required pull request checks pass across macOS, Linux, and Windows. The first Nix YAML policy run failed while downloading from cache.nixos.org; its rerun passed without a code change.

No desktop E2E certification is claimed because this change affects SDK-owned startup lifecycle rather than desktop interaction behavior.

@injaneity
injaneity force-pushed the feat/embedded-host-diagnostics branch from 473f1c3 to f162845 Compare August 20, 2026 07:06
@injaneity
injaneity marked this pull request as ready for review August 20, 2026 08:22
@injaneity
injaneity requested a review from f-trycua as a code owner August 20, 2026 08:22
@f-trycua
f-trycua force-pushed the feat/embedded-host-no-overlay branch from a8114bb to a759cab Compare August 20, 2026 16:06
@f-trycua
f-trycua force-pushed the feat/embedded-host-diagnostics branch from ca05630 to 6ad0f92 Compare August 20, 2026 16:06
@f-trycua
f-trycua force-pushed the feat/embedded-host-no-overlay branch 3 times, most recently from 7b1dee7 to f7ed2fd Compare August 20, 2026 18:29
@f-trycua
f-trycua force-pushed the feat/embedded-host-diagnostics branch 2 times, most recently from 848d15b to d7e8cab Compare August 20, 2026 23:23
@f-trycua
f-trycua changed the base branch from feat/embedded-host-no-overlay to main August 20, 2026 23:23
@injaneity
injaneity force-pushed the feat/embedded-host-diagnostics branch 2 times, most recently from b768440 to fd341bb Compare September 1, 2026 15:01
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