Implement M9.7 dev region sessions with durable no-effect intentions
Run a non-blocking TLS 1.3 session server inside evo-server's loop: environment views come from the region's own field/terrain stores with an explicitly empty organism presentation; admitted intentions ride the next synthetic input (content unchanged) and return a durable no-effect outcome from the host's final acknowledgement, or not_committed when dropped. Sessions are bound to their connection, epochs close stale sessions, and connections have bounded output, input rate and deadlines. SessionClient and evo-client --connect consume one single-use grant per Hello (refusals before admission keep it), reset to a fresh baseline on every session, keep stale views visible and report in-flight intentions as unknown after loss. evo-dev-session generates dev credentials, grant bundles and runs a restart probe. The dev deployment gains a drill-time, loopback-only listener with an optional Secret, enforced by the policy check, and tools/ops/session-drill.sh. Protocol v1 gains IntentOutcome and the capacity close reason before any deployment. ADR-0083 records the maintainer-confirmed decisions; M8-dev/stage remains not passed and no cluster change was made. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
# ADR-0083: Dev region sessions, no-effect intentions and the session drill
|
||||
|
||||
## Status
|
||||
Accepted for M9.7 (engineering client to one authoritative **dev** region). Decisions
|
||||
confirmed with the maintainer on 2026-10-01: durable no-effect intentions, an
|
||||
explicitly empty organism presentation, local real-process evidence plus a dev
|
||||
deployment path. No biology, gameplay, format or production identity decision.
|
||||
|
||||
## Context
|
||||
ADR-0082 defined protocol v1, admission, dev grants and TLS. M9.7 needs a real
|
||||
desktop-to-region connection, view display, a minimal admitted intention whose final
|
||||
outcome reflects the server's durable acknowledgement, and recovery after restarts.
|
||||
Findings that constrain the design:
|
||||
|
||||
- The roadmap lists M8-dev/stage as a dependency; it is **not passed** (live gates
|
||||
open). The maintainer chose to proceed: local real-process evidence now, cluster
|
||||
evidence through a drill they run.
|
||||
- The region (`LineageRegion` over `EnvironmentalCommunity`) has pooled producer and
|
||||
consumer inventories driven by host facts. There is no movable organism, so an
|
||||
intention cannot have a biological effect without new rules and formats.
|
||||
- The region has real field/terrain stores (environment views are derivable) but no
|
||||
placed individuals (no honest organism presentation).
|
||||
- Dev runs without synthetic inputs in Git (ADR-0073); NodePort/LoadBalancer are
|
||||
forbidden and network policy is default-deny (ADR-0069). No kubeconfig exists on
|
||||
the implementing workstation.
|
||||
|
||||
## Decision
|
||||
**Session server in the region process.** `SessionServer` (src/network/session) is
|
||||
host-agnostic and non-blocking; `evo-server` calls it from its existing single-thread
|
||||
loop (as it does the ops server). It never mutates host state. Per connection:
|
||||
bounded output (newest view replaces an unsent one; overflow drops the connection),
|
||||
1 s Close flush deadline, 5 s accept-to-Welcome deadline, 64 KiB/s input limit,
|
||||
session bound to its connection (a connection can only speak for its own session).
|
||||
At most 4 connections/sessions. New epochs close existing sessions (`stale_epoch`) and
|
||||
discard intentions not yet carried.
|
||||
|
||||
**Views.** Every new simulated tick (and new epoch), the bridge queries the region's
|
||||
own stores (`query_environment` over the sites in the first site's Z slice, all
|
||||
fields) and publishes an `EnvironmentPresentation` plus an **empty**
|
||||
`OrganismPresentation`. View headers carry session, epoch, simulated tick and the
|
||||
committed tick as the durable watermark. Every session starts from the latest view.
|
||||
|
||||
**Intentions.** Sessions require `--synthetic-inputs development-v1`. An admitted
|
||||
intention is queued and rides the next synthetic input whose tick is at or after its
|
||||
intended tick: the input's request id becomes `INT1 | epoch | session | sequence`
|
||||
(low 32 bits each); its **content stays the host-chosen development input**. The
|
||||
host's FinalAck for that request yields `IntentOutcome{committed_no_effect, tick,
|
||||
commit_sequence}`; a dropped input yields `not_committed`. The driver looks ahead 8
|
||||
ticks (instead of 64) when sessions are on, matching the admission window.
|
||||
|
||||
**Protocol v1 amendment.** Before any v1 peer was deployed, v1 gained message type 8
|
||||
`IntentOutcome` and close reason 9 `capacity` (schemas/view/dev-session-v1.md). Once
|
||||
a dev deployment runs, further changes need a new version.
|
||||
|
||||
**Client.** `SessionClient` connects, verifies the pinned dev CA, consumes one
|
||||
single-use grant per Hello, and on Welcome resets both layers (fresh baseline). On
|
||||
loss it keeps the last presentation marked stale, reports outstanding admitted
|
||||
intentions as `unknown`, and retries with capped exponential backoff until grants run
|
||||
out (explicit `exhausted`). Intended tick = newest view tick + 4. The desktop app
|
||||
sends an intention only when its vector changes, at most once per view tick.
|
||||
`evo-client --connect ... --ca ... --grants ...` replaces the local fixture.
|
||||
|
||||
**Credentials and grants.** `evo-dev-session credentials` writes a dev CA, server
|
||||
certificate/key and a grant HMAC key (secrets owner-only, never overwritten, refused
|
||||
outside dev). `evo-dev-session grants` issues up to 64 single-use grants (lifetime
|
||||
<= 1 h) on the operator machine, so clients never hold the HMAC key.
|
||||
|
||||
**Dev deployment.** The region Deployment gains a drill-time `REGION_SESSION` override
|
||||
(empty in Git, enforced by the policy check), an optional 0440 Secret
|
||||
`evolution-dev-session`, and a listener bound to **127.0.0.1:7400** inside the pod:
|
||||
reachable only by `kubectl port-forward`, never a Service. `tools/ops/session-drill.sh`
|
||||
(evolution-dev only) enables inputs and sessions, runs `evo-dev-session probe
|
||||
--expect-restart` through a port-forward (durable ack, forced pod deletion,
|
||||
reconnect at a newer epoch, second durable ack) and restores Git values on exit.
|
||||
|
||||
Mbed TLS build changes: upstream `-Werror` disabled for upstream sources (owned code
|
||||
keeps warnings-as-errors), and TLS context serialization compiled out.
|
||||
|
||||
## Alternatives considered
|
||||
- Map intentions onto `EnvironmentalInput` (bites/temperature): lets clients author
|
||||
biological inputs; rejected.
|
||||
- Add a movable organism now: new rules, persisted format and converter; deferred.
|
||||
- Synthesize organisms from pools: fabricated presentation; rejected.
|
||||
- Admission result only: does not reflect durable outcomes; rejected.
|
||||
- Expose the dev region via NodePort/Ingress: violates ADR-0069 and widens exposure.
|
||||
- Enable synthetic inputs and sessions permanently in dev: contradicts ADR-0073 and
|
||||
grows dev history continuously; drill-time only instead.
|
||||
- Separate gateway process: needs host IPC for acks and views; unnecessary for one
|
||||
dev region.
|
||||
|
||||
## Benefits
|
||||
Real authority path end to end (TLS, admission, durable ack, recovery) without new
|
||||
game rules; honest presentation; dev identity and listener cannot reach stage/World0.
|
||||
|
||||
## Costs
|
||||
Intentions are delayed until a carrier input (up to ~9 ticks); one intention per
|
||||
carried tick; sessions require synthetic inputs; the session drill needs an operator.
|
||||
|
||||
## Risks
|
||||
Port-forward reachability depends on cluster tooling; the drill's evidence is only as
|
||||
complete as its logs. A session id is bound to its connection but grants are bearer
|
||||
tokens: anyone holding an unused grant (or the dev key) can open a dev session.
|
||||
Restart gaps: an intention admitted just before a crash has an unknown outcome until
|
||||
the client reconnects (reported as such, never assumed).
|
||||
|
||||
## Consequences
|
||||
M9.8 packages the client and qualifies the presentation. M10 replaces the carrier
|
||||
with real intention semantics once organisms move, and reopens transport choice.
|
||||
Reference in New Issue
Block a user