M05: Native worker, pairing, and execution transport #90

Closed
opened 2026-09-19 13:07:36 +00:00 by kilo · 1 comment
Member

Goal

Provide one simple native worker for Windows/Linux/WSL that bridges local resources (localhost-only inference endpoints, local application entitlements) to the central server.

Module of the execution-gateway program; architecture and contracts come from A0 (#85).

User value

Local machines' Ollama instances and Codex/ZCode entitlements become usable from anywhere in the user's LAN/VPN without opening inbound ports, editing firewall rules or maintaining certificates. Install the worker only on machines where such access is actually needed.

Relationship to current code

  • New native component; the server side is the worker-protocol endpoint of the Execution Coordinator (M03). The protocol is defined by A0: a simple versioned protocol over TLS/WSS, worker-initiated outbound connection, no inbound worker port.
  • Worker-reported telemetry flows into M01's registry as safe normalized state (one normalization path; no duplicate collector implementations for the same provider/account).

Scope

  • Outbound TLS/WSS connection; explicit pairing; per-device identity; credential rotation/revocation; heartbeat; protocol-version negotiation; user-approved discovery; resource state reporting; execute; stream; cancel; bounded reconnect; backpressure; local diagnostics; server-worker compatibility handling.
  • The worker performs no global routing decisions.

Non-goals

  • No inbound listening port for normal operation; no generic /shell, /ssh or arbitrary-command endpoint; no remote host administration; no SSH orchestration protocol (SSH is how a user may reach another machine, not a required router protocol); no manual worker-IP configuration; no routine certificate maintenance for ordinary users.

Contracts / interfaces affected

Worker protocol contract (new, A0); resource-state report contract (M01); execution dispatch/stream/cancel contract (M03).

Dependencies

  • Depends on: A0 (#85), M03.
  • Feeds: M06/M07 (local adapter execution surface), M09 (pairing UI portion), M10 (E2E topologies).

Acceptance criteria

  • The worker requires no inbound listening port for normal operation.
  • Invalid identity is rejected; revoked credentials are rejected.
  • Incompatible protocol versions fail safely.
  • There is no generic /shell, /ssh or arbitrary-command endpoint.
  • A local adapter allowlist remains enforceable even if the server asks for something else.
  • Network loss must not cause automatic duplicate execution of an already-started request.
  • Application credentials stay local whenever possible.
  • Windows and WSL are not treated as one credential/configuration directory.
  • Full validation gate green; protocol tests deterministic.

Security considerations

Verified TLS/WSS (no verify=false); the pairing/trust bootstrap model from A0; per-device identity with revocation; no bearer secrets in URLs; local adapter allowlist enforcement; filesystem/session/tool isolation for any local adapter invocation; no root/Administrator execution by default; no uncontrolled client-supplied subprocess flags or environment variables; no Docker socket mounting; logs created by local runtimes are accounted for in diagnostics hygiene (no secrets, no prompts).

Risks

  • Cross-platform packaging drift (Windows/WSL credential separation is a known pitfall).
  • Reconnect/heartbeat edge cases duplicating work — mitigated by the idempotency rules in A0's execution contract.

Evidence still required

  • Minimum viable transport decision evidence (kept simple per A0: versioned protocol over TLS/WSS).
  • Windows autostart/service mechanism evidence (shared with M10 packaging).
## Goal Provide one simple native worker for Windows/Linux/WSL that bridges local resources (localhost-only inference endpoints, local application entitlements) to the central server. Module of the execution-gateway program; architecture and contracts come from A0 (#85). ## User value Local machines' Ollama instances and Codex/ZCode entitlements become usable from anywhere in the user's LAN/VPN without opening inbound ports, editing firewall rules or maintaining certificates. Install the worker only on machines where such access is actually needed. ## Relationship to current code - New native component; the server side is the worker-protocol endpoint of the Execution Coordinator (M03). The protocol is defined by A0: a simple versioned protocol over TLS/WSS, worker-initiated outbound connection, no inbound worker port. - Worker-reported telemetry flows into M01's registry as safe normalized state (one normalization path; no duplicate collector implementations for the same provider/account). ## Scope - Outbound TLS/WSS connection; explicit pairing; per-device identity; credential rotation/revocation; heartbeat; protocol-version negotiation; user-approved discovery; resource state reporting; execute; stream; cancel; bounded reconnect; backpressure; local diagnostics; server-worker compatibility handling. - The worker performs no global routing decisions. ## Non-goals - No inbound listening port for normal operation; no generic `/shell`, `/ssh` or arbitrary-command endpoint; no remote host administration; no SSH orchestration protocol (SSH is how a user may reach another machine, not a required router protocol); no manual worker-IP configuration; no routine certificate maintenance for ordinary users. ## Contracts / interfaces affected Worker protocol contract (new, A0); resource-state report contract (M01); execution dispatch/stream/cancel contract (M03). ## Dependencies - Depends on: A0 (#85), M03. - Feeds: M06/M07 (local adapter execution surface), M09 (pairing UI portion), M10 (E2E topologies). ## Acceptance criteria - [ ] The worker requires no inbound listening port for normal operation. - [ ] Invalid identity is rejected; revoked credentials are rejected. - [ ] Incompatible protocol versions fail safely. - [ ] There is no generic `/shell`, `/ssh` or arbitrary-command endpoint. - [ ] A local adapter allowlist remains enforceable even if the server asks for something else. - [ ] Network loss must not cause automatic duplicate execution of an already-started request. - [ ] Application credentials stay local whenever possible. - [ ] Windows and WSL are not treated as one credential/configuration directory. - [ ] Full validation gate green; protocol tests deterministic. ## Security considerations Verified TLS/WSS (no `verify=false`); the pairing/trust bootstrap model from A0; per-device identity with revocation; no bearer secrets in URLs; local adapter allowlist enforcement; filesystem/session/tool isolation for any local adapter invocation; no root/Administrator execution by default; no uncontrolled client-supplied subprocess flags or environment variables; no Docker socket mounting; logs created by local runtimes are accounted for in diagnostics hygiene (no secrets, no prompts). ## Risks - Cross-platform packaging drift (Windows/WSL credential separation is a known pitfall). - Reconnect/heartbeat edge cases duplicating work — mitigated by the idempotency rules in A0's execution contract. ## Evidence still required - Minimum viable transport decision evidence (kept simple per A0: versioned protocol over TLS/WSS). - Windows autostart/service mechanism evidence (shared with M10 packaging).
Author
Member

Closeout (v0.1.0 release-readiness reconciliation, 2026-09-21). M05 is implemented and its acceptance criteria are satisfied on develop @ 9d6192e.

  • Implemented by worker_protocol.py (length-prefixed JSON over verified TLS, closed vocabulary), worker_endpoint.py (server side), worker_client.py (the pair/run runtime behind the scarcity-router-worker console script), worker_identity_store.py (the ONE pairing system), worker_local_store.py, worker_local_adapters.py, worker_local_translation.py; contract: docs/worker-protocol.md (protocol v1).
  • Acceptance criteria, each with named tests: no inbound listening port for normal operation (structural + behavioral asserts in tests/test_worker_client.py); invalid/revoked identity rejected (credential_revoked over a real socket, tests/test_worker_endpoint.py, RevocationTests); incompatible protocol versions fail closed (protocol_version_unsupported, no retry storm); no generic /shell//ssh/command endpoint (ProtocolVocabularyTests); the local adapter allowlist is enforced worker-side even against server requests (adapter_not_allowed); network loss never auto-duplicates an already-started request (attempt identity, exactly-once dispatch, AmbiguousDisconnectTests); Windows and WSL resolve different state directories (tests/test_worker_local_store.py).
  • Pairing codes are single-use/expiring with distinct typed errors; rotation and revocation are immediate; resource ownership is exact (D-049, tests/test_worker_ownership.py); heartbeat liveness with a composition reaper.
  • Validation gate green: make check 1868 tests OK, basedpyright clean, make package-check green (the worker console script is one of the four verified entry points); Forgejo CI green on develop (run #25).

Closing as complete; docs/roadmap.md now records M05 complete.

**Closeout (v0.1.0 release-readiness reconciliation, 2026-09-21).** M05 is implemented and its acceptance criteria are satisfied on `develop` @ `9d6192e`. - Implemented by `worker_protocol.py` (length-prefixed JSON over verified TLS, closed vocabulary), `worker_endpoint.py` (server side), `worker_client.py` (the `pair`/`run` runtime behind the `scarcity-router-worker` console script), `worker_identity_store.py` (the ONE pairing system), `worker_local_store.py`, `worker_local_adapters.py`, `worker_local_translation.py`; contract: `docs/worker-protocol.md` (protocol v1). - Acceptance criteria, each with named tests: no inbound listening port for normal operation (structural + behavioral asserts in `tests/test_worker_client.py`); invalid/revoked identity rejected (`credential_revoked` over a real socket, `tests/test_worker_endpoint.py`, `RevocationTests`); incompatible protocol versions fail closed (`protocol_version_unsupported`, no retry storm); no generic `/shell`/`/ssh`/command endpoint (`ProtocolVocabularyTests`); the local adapter allowlist is enforced worker-side even against server requests (`adapter_not_allowed`); network loss never auto-duplicates an already-started request (attempt identity, exactly-once dispatch, `AmbiguousDisconnectTests`); Windows and WSL resolve different state directories (`tests/test_worker_local_store.py`). - Pairing codes are single-use/expiring with distinct typed errors; rotation and revocation are immediate; resource ownership is exact (D-049, `tests/test_worker_ownership.py`); heartbeat liveness with a composition reaper. - Validation gate green: `make check` 1868 tests OK, basedpyright clean, `make package-check` green (the worker console script is one of the four verified entry points); Forgejo CI green on `develop` (run #25). Closing as complete; `docs/roadmap.md` now records M05 complete.
kilo closed this issue 2026-09-21 17:05:12 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Creatidy/scarcity-router#90
No description provided.