Files
marqdo-cli/docs/evidence/2026-11-20-c-worker-binding.md
T
cflmy 757c5ed15e feat(provider): add C ABI provider worker binding v1
- Add the separate marqdo-provider-worker binary: loads one trusted c-abi-1
  shared library and serves the ADR-0035 framed-JSON resource protocol, with
  fail-closed startup and no in-process fallback (ADR-0038).
- Reuse StdHost::register_worker_resource_provider; language still sees only
  resource.* and project-mode/name grants.
- Compile a C test provider and run open/read/write/close through the helper;
  cover missing-library fail-closed. Trusted process boundary, not a sandbox;
  existing plugin-Worker ABI binding remains open.
- Add ADR/spec/status/README/changelog/evidence; workspace member and tests.

Gate: fmt, clippy -D warnings, 440 tests passed.
2026-11-20 23:30:22 +08:00

1.7 KiB

RFC-CM CM-A09 evidence: C ABI provider worker binding v1

Date: 2026-11-20 (Asia/Shanghai) Repository: marqdo-cli Baseline: 313ac03 plus this step's changes. Decision record: ADR-0038 Related: C ABI, worker transport. Scope: trusted helper binding; not a sandbox and not the plugin-Worker ABI.

Artifact

marqdo-provider-worker <library> loads a c-abi-1 shared library and serves the ADR-0035 framed-JSON protocol (ping/open/read/write/close/shutdown). The host registers it through the existing StdHost::register_worker_resource_provider API; no runtime/HostOp/parser change was required.

Tests

crates/marqdo-provider-worker/tests/worker_binding.rs:

c_abi_provider_runs_inside_the_worker_helper
  cc -shared C provider; worker binary loaded;
  resource.open/read "worker"/"-abi" eof/write/close through the host.

worker_helper_without_c_provider_fails_closed
  missing library -> structured host error, no in-process fallback.

The C provider state lives in the child; the host only sees the opaque ResourceHandle and ResourceRead bytes.

Boundary

The worker is a trusted helper with host-user privileges. It isolates crashes and keeps the C library out of the interpreter process, but it is not an OS sandbox. Pure/strict still refuse provider kinds; strict remains fail-closed.

Not done

  • Binding through the existing plugin-Worker manifest/artifact ABI.
  • Provider registry/signatures/install commands.
  • Untrusted-provider isolation, strict providers, Windows worker packaging.
  • ABI version negotiation beyond rejecting non-v1 libraries.