Skip to content

feat(runtime): share cancellable per-node admission across lifecycle entrypoints - #504

Merged
athNdev merged 4 commits into
mainfrom
codex/lifecycle-admission-coordinator
Nov 17, 2026
Merged

athNdev merged 4 commits into
mainfrom
codex/lifecycle-admission-coordinator

Conversation

@athNdev

@athNdev athNdev commented Nov 17, 2026

Copy link
Copy Markdown
Owner

W15/OSS-334: shared in-process admission gate. One instance-owned coordinator is injected into ServerService and Scheduler; same-node start admission is serialized through mutation and status persistence, while different nodes proceed in parallel. Cancellation never enters the gate; release is idempotent; local aliases fold to one key.\n\nReal-store tests: same-node concurrent start refused with CodeResourceExhausted (one Docker start, one start journal row, no RPC-owned event), different-node parallel, queued waiter times out before Docker, scheduler same-node refusal/cross-node parallelism. ADR0014 documents in-process scope (not distributed lease) and knowledge is updated. Known limits: staged rollback covered by existing staged suites rather than a dedicated admission test; CI race/pinned-Go qualification still required before merge.

Share one cancellable per-node gate between RPC and scheduler starts so
same-node starts cannot both admit against the same persisted active memory.
Hold the gate from before CheckStartCapacity through container mutation and
status persistence in StartServer/RestartServer/RecreateServer and in the
scheduler start/restart tasks. Map refusals and cancellation to existing
Connect codes. Wire the coordinator once at the composition root; constructors
supply an instance-owned default for isolated uses. ADR 0014 records why this
is an in-process gate rather than a persistent lease.
Independent review found three scheduler-owned paths checked persisted capacity
without contending on the shared node gate. StartServerForBoot and staged
publication with StartAfter now acquire around their capacity check through
container mutation. DeepSleepManager.WakeServer holds the gate from before the
wake preparer through StartContainer and running-status persistence; the
preparer itself does not re-acquire. A small local AdmissionGate interface keeps
the docker package from importing serverruntime. ADR 0014 and the lifecycle and
deep-sleep concepts now name every gated path, with regression tests for each.
…sion-coordinator

# Conflicts:
#	cmd/carbon-panel/main.go
#	internal/rpc/server.go
#	internal/scheduler/scheduler.go
@athNdev
athNdev merged commit c15b8d7 into main Nov 17, 2026
22 checks passed
@athNdev
athNdev deleted the codex/lifecycle-admission-coordinator branch November 17, 2026 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant