Files
Strata/serve/launch_identity.py
Niko1221 c968d37a48 serve: owned-server contract for the terminal (ready file, owner guard, launch identity, queue deadline, stage telemetry)
New serve/ready.py, serve/owner_guard.py and serve/launch_identity.py; server.py
gains the queue wait deadline (QueueWaitExpired/QueueCancelled), the opt-in
STRATA_BATCH_TELEMETRY plumbing (BSTAT/PSTAT parsed off the engine's token stream,
dropped from request output), the engine stage-plan reader, a main(argv, ...)
entry the terminal can call, and per-replica selection hooks; telemetry.py reports
GPU names; the tests for all of it.

server.py merged by hand onto 0.1.45: one conflict, in StrataEngine._take_control, where
0.1.45's STRATA_ADMIT_SHORT_FIRST ordering and the rebuild's queue deadline both edit the
acquire step; both are kept (ordering check first, then the deadline-bounded acquire).
Every line 0.1.45 added to server.py (the #2518 pick_slot fix, the havok multi-user
switches, the Qwen3.6 parallel/vision work) is still present.

From the owner's rebuild branch strata/rebuild-2026-10.
2026-10-15 10:23:23 +02:00

23 lines
963 B
Python

"""Private proof of the configuration and arguments read by an owned server.
The owner passes a fresh secret through the child environment, then compares
this MAC with the value on the authenticated telemetry endpoint. The digest
does not expose a reusable hash of the run config's credentials.
"""
from __future__ import annotations
import hashlib
import hmac
import json
def attestation(key: bytes, config_bytes: bytes, argv: list[str]) -> str:
if len(key) != 32 or not isinstance(config_bytes, bytes) or \
not isinstance(argv, list) or not all(isinstance(arg, str) for arg in argv):
raise ValueError("invalid launch attestation inputs")
args = json.dumps(argv, ensure_ascii=False, separators=(",", ":")).encode("utf-8")
message = b"strata-owned-launch-v1\0" + len(config_bytes).to_bytes(8, "big") + config_bytes + \
len(args).to_bytes(8, "big") + args
return hmac.new(key, message, hashlib.sha256).hexdigest()