Data-plane posture + liveness — Slice B (amicissimo#392) - #847
Merged
Conversation
…ssimo#392) D6: the degraded entry rule as a steady state — FleetPostureDetector over the data-plane outcome stream with client-enforced timeouts, the named latency-window degraded entry, N-consecutive-no-response hub-down, and hysteresis on every exit; every transition bumps the refetch epoch (D2's refetch-before-first-render) and is recorded. The hub-down posture falls the effective routing mode back to the base standalone engine; the merged projection (always mounted) is the recovery probe. D3: the write-failure contract — every fleet write resolves to delivered | failed | ambiguous-and-surfaced through a write pipeline (non-GET data-plane requests), with the bounded idempotent retry carrying one client-generated request identity, refetch-of-the-affected-thread evidence, the echoed payload (never eaten), and the local store's role recorded. D5: the mid-flight revocation handoff — a 401 on a fleet write is the read-only-with-pointer outcome (notice + Go-Standalone), posture not degraded. D7: the tunnel stamps its own config — stamped-alias inspection (the literal FLEET_SSH_ALIAS placeholder can never ship), the generation marker, and the x-amicode-tunnel-generation stamp on every proxied response (SSE included), read per response so a rejoin is visible mid-session. Fleet/status now carries the live posture snapshot (parity included) and the tunnel stamp; hub_proxy gains the client-enforced headers timeout. Refs: harmoniqs/amicissimo#392, spec-20260905-193000 Slice B
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
aarontrowbridge
marked this pull request as ready for review
September 7, 2026 00:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implements Slice B of the local-shell data plane sub-spec (spec-20260905-193000-local-shell-data-plane, rev 2) on top of Slice A's transport (#846): the honesty layer — degradation, write outcomes, liveness, rejoin — as contractual, testable behavior. Refs harmoniqs/amicissimo#392 (parent #380).
The four decisions, as shipped
fleet_posture.ts: a synchronous outcome-stream detector (it observes outcomes; it cannot wedge). Entry: p95 latency over the measurement window ≥ threshold →degraded(hub-up-but-slow, still routing to the hub); N consecutive no-responses (client-enforced timeouts enforced inhub_proxy.ts/ the write pipeline) →standalone(hub-down: base posture + a surfaced pointer, effective mode falls back to the local engine). Hysteresis on every exit — flapping must not flap the posture. The hub-down posture means reads/writes route LOCALLY, so a session created in a hub-down window is a LOCAL session (D3's own case). Recovery re-enters fleet through the always-mounted merged projection (the recovery probe) and bumps the refetch epoch — D2's refetch-before-first-render, keyed per transition.fleet_writes.ts: every non-GET data-plane request resolves to delivered | failed | ambiguous-and-surfaced — never silently ambiguous. An ambiguous write retries boundedly carrying the SAME client-generatedx-amicode-request-id, then resolves by re-fetching the affected thread (evidence attached). Failed outcomes echo the payload (the compose path never eats input) and record the local store's role explicitly (fleet sessions are never shadowed locally).fleet_tunnel.ts: stamped-alias inspection (the literalFLEET_SSH_ALIASplaceholder is a named unstamped state — the rejoin regression can never ship), the generation marker, andx-amicode-tunnel-generationstamped on every proxied response (SSE included), read per response — a rejoin is visible mid-session. SSE rides the proxy pipe unbuffered; a dead stream ends honestly (the client's frames-are-truth machinery reconnects + refetches).Mid-session parity:
/amicode/fleet/statuscarries the LIVE posture snapshot (state, pointer, transitions, refetch epoch, hub build parity with the previous version named) and the tunnel stamp — posture changes are visible through the same contract, not just at boot.Verification
test/amicode_service_fleet_posture.test.ts(RED first — quote:Failed to load url ../src/amicode_service/fleet_posture), all green:Test Files 2 passed (2) · Tests 64 passed (64)(new file + Slice A's 25).pnpm run typecheckclean.terminal.test×2 env-flaky,editable_diffs_wiring×2,cli_gate×1 env-dependent); this branch = the same set, zero new. (Note: clean main'spnpm -rstops earlier atpackages/amico-runagent_spawn.test.ts×1 — also pre-existing/env-dependent, untouched here.)Out of scope (per the sub-spec's sequencing)
The native merged view (#393 / Slice C), production activation wiring (the fleet option's hub getter), the offline/mirror story.