P0 ARDR research: finish managed runtime lifecycle, deadlines, and reconnect supervision #201
Labels
No labels
bug
design
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
research
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/starintel-auto-research#201
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
StarIntel problem solved
Research the remaining P0 lifecycle gap in
lost-rob0t/starintel-server#37against current source rather than the stale original issue description.Owning implementation issue:
lost-rob0t/starintel-server#37.Related P0 runtime work: #34 thread-budget authority, #35 workload dispatchers, #36 admission/overload.
Current
starintel-server/masterinspected at8fb297d146e7332fae7e38170b5b49d49530ac53.ARDR state
READY_FOR_DESIGNImplementation approval remains operator-only.
Candidate/ranking decision
This is P0, concrete, and dependency-unblocking. #34 already has research/design authority; #35 and #36 depend on trustworthy runtime ownership and shutdown semantics. #37 therefore wins this bounded cycle over lower-priority datasource/actor enhancement work.
Current implementation check
The original #37 defect list is partially stale. Current master already contains
source/runtime-lifecycle.lispandt/runtime-lifecycle-test.lisp.Already implemented and to be preserved:
star.runtimeowner with:created/:starting/:running/:stopping/:stoppedstate;clack:stopshutdown;:wait t;stop-runtimeon startup failure;/live,/ready,/healthlifecycle endpoints;This means ARDR must not propose a second runtime owner.
Residual correctness gaps
1. Runtime ownership is still hard-coded, not closed
star-runtimehas dedicated slots andstart-runtime/stop-runtimedirectly know each subsystem. New thread/resource-producing components can therefore be added without registering lifecycle ownership, start dependency, stop order, health, or cleanup behavior.Requirement: one closed component/resource registration contract under the existing Common Lisp
star.runtimeauthority. Do not create another supervisor/control plane.2. One timeout is repeatedly restarted instead of one shutdown deadline
Current stop phases each receive or establish the same timeout independently. Total process shutdown can therefore exceed the operator's intended bound by roughly N phases.
Requirement: compute one monotonic absolute shutdown deadline at stop initiation and pass remaining time to every phase/component. Once exhausted, later phases may perform only bounded emergency cleanup/diagnostics; they may not restart the full timeout.
3. Cleanup failures are weakly observable
Several stop paths use
ignore-errorsor log-and-continue.stop-runtimecan reach:stoppedeven when a component failed to stop. This loses the distinction between clean shutdown and bounded but incomplete cleanup.Requirement: aggregate typed per-component stop results and terminal shutdown outcome. Preserve cleanup failure evidence while continuing best-effort teardown.
4. Reconnect/restart supervision is absent
Current Rabbit consumer loop exits on non-timeout transport error; CouchDB readiness is a probe; producer readiness is checked, but there is no runtime-owned reconnect/backoff state machine for Rabbit, CouchDB, or KV dependencies.
Requirement: reconnect belongs to the existing runtime/component owner. Use bounded exponential backoff with jitter/cap, cancellation on runtime stop, stable component identity, and readiness degradation while disconnected. Do not spawn detached reconnect threads.
5. Readiness is not equivalent to owned-component health
Actor/kernel/HTTP readiness is primarily non-NIL handle/state presence. A dead internal worker or failed component can exist behind a retained handle.
Requirement: component readiness must be an explicit probe/status from the owning adapter. Runtime readiness is the conjunction of required component states, not object existence.
6. No explicit drain contract
Stopping HTTP and consumers prevents new intake, but current lifecycle has no general
quiesce -> drain -> stopcomponent contract, no shared remaining-deadline propagation, and no structured accounting of drained/rejected/handoff work.Requirement: v1 lifecycle phases are
start,quiesce,drain,stop; components that have no drain work may no-op. #36 owns admission/overload policy; #37 owns when intake closes and how drain deadline propagates.7. Thread-budget accounting must attach to lifecycle ownership
#177 requires every runtime-owned thread to map to a component/allocation. Lifecycle registration is the natural owner identity. A component may own zero or more thread allocations/resources, but raw product-side thread creation cannot bypass both registries.
Evidence-backed library boundary
Current upstream Sento exposes actor/context/system shutdown with an optional wait for complete shutdown and dispatcher stop semantics. Keep using that as the actor adapter rather than reimplementing actor teardown.
Current Clack exposes server shutdown through the retained handler returned by
clackup; keep this handle as the HTTP component resource.Bordeaux Threads is the portability layer for thread ownership/joining, not a lifecycle registry. The runtime must therefore retain exact thread/resource ownership rather than enumerate process threads.
Required lifecycle model
Conceptual Common Lisp model, not new StarLang syntax:
Startup performs a deterministic topological order. Rollback stops only components that successfully crossed into owned started state, in reverse dependency order.
Shutdown computes one absolute deadline and executes reverse dependency order through quiesce/drain/stop while accumulating outcomes.
Reconnect semantics
Reconnect applies only to components whose adapter declares it and never runs once runtime state is quiescing/stopping/stopped.
Minimum policy:
StarLang classification
No new StarLang syntax is justified.
This is host process lifecycle and resource ownership in
starintel-server. StarLang actors/domain servers may expose lifecycle/health through their existing runtime boundary, but cannot own process thread/transport authority. Implement in Common Lisp using current libraries. No external process or Python controller is justified.Adversarial findings
Rejected:
bt:all-threads. Can block on or interfere with threads StarIntel does not own.:stoppedafter swallowed cleanup errors with no result. Loses operational truth.Mandatory RED-first targets
Decision
Evidence is sufficient to proceed directly to design. The architecture boundary is clear and current implementation provides the seed rather than requiring a rewrite.
Implementation approval:
PENDING / AWAITING_OPERATOR_APPROVAL.