Repository navigation
Move runtime allocations and placement into deployment and deploymentpg - #342
Merged
Merged
Conversation
Runtime allocations, hosted admission and node placement leave store. - deployment/placement holds the pure admission and placement rules. The composition root builds them once from the provider declarations and the public URL, which never change while Core runs; deployment.Service and, until Session creation moves, store Session creation read them. store.SetPublicURL is deleted. - persistence/postgres/placementpg loads the placement facts and applies placements on the caller's transaction-bound queries. deploymentpg, sessionpg and store Session creation call it inside their own transactions. - deployment.ExecutionOperations owns the allocation lifecycle: reserve, observe, keep, settle, release, cleanup, compute phases, observations and wake hints. deploymentpg locks the owning Session, runs the decision and prunes the Session journal in one leased transaction; cleanup cancels or terminates the Session's work through sessionpg.SessionTx in that same transaction. - Scheduling and discovery reads move to deployment.Reader and carry no lease; the leased write that follows each one rechecks the allocation's owner. TouchActivity is a pooled deployment.Service use case. - Allocation mutations report deployment.ErrAllocationConflict, deployment.ErrInvalidInput and deployment.ErrNotFound; admission and placement report the placement errors, which the API maps as before.
sam2tom
pushed a commit
to sandbaseai/OpenAgentCore
that referenced
this pull request
Oct 2, 2026
Since MiniMax-AI#342, Store.CreateSession requires placement rules for an openai_hosted Session, and cmd/server supplies them through SetPlacement. The modelconfigurationpg observation fixture builds its own Store without them, so TestObservationExcludesOtherSourcesAndHistoricalSessions has failed on main (backend / check-core) since ffe6734. The fixture now sets the same rules cmd/server builds: the built-in providers and an unset public URL.
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.
Runtime allocations, placement, compute suspension, observation, lifecycle nodes and credential allocations move out of
storeintodeployment,deployment/placement,deploymentpgandplacementpg. This completes PR 3; #332 moved reset and address bindings.What changes
deployment/placementholds the pure placement and admission rules: public origin, creation admission, placement, reservation and restore checks, and the loopback origin.placement.NewRules(declarations, publicURL)is built once incmd/serverfrom the provider registry and the public URL. Neither changes while Core runs.deployment/placementimports neithersessionsnordeployment, and does no I/O.deploymentinterprets provider declarations.deployment:ExecutionOperations: reserve, ObserveRunning, Keep, SettleCreation, Release, RequestCleanup, ReleaseAbsentCreation, SetCompute, RecordObservation and ClearWake;Service: TouchActivity, LifecycleNode and AllocationGeneration;Readerreads for allocations, credential allocations, observation, nodes and lifecycle scheduling.deploymentpg:sessionpg.PruneChanges. A prune failure aborts it.*sessionpg.SessionTx. It callssessions.CancelWorkorsessions.TerminateEnvironmentwith the same event order and rollback as before.placementpgholds only fact loads and reservation applies on transaction-bound queries.deploymentpg,sessionpgand Session creation call it inside their own transactions. The compute-admission fact now has its one home there.Readerreads. Every provider effect is still preceded by a lease ownership check or a lease-fenced write.ClearWakeis a leased write.store:public_url.go, together withSetPublicURL;environment_connections.go;checkExecutionOwnership;store.RuntimeNodeAllocationis renameddeployment.NodeAllocationwith the same wire shape.IMPLEMENTATION.mdnames the new owners and participants.Behavior
deployment.ErrAllocationConflict.deployment.ErrInvalidInput.sessions.ErrNotFoundfor the same 404, until handlers route to their own error mapper.placement.ErrAdmissionClosed, which maps to the same 409environment_unavailable.Checks
go build ./...,go vet ./services/core/...,make sqlc-generateandmake openapi(no further diff), andscripts/check-names.py.deployment/...,deploymentpg,placementpgandsessionpgin full. The deploymentpg PostgreSQL tests cover:-runover:environment-keytests, run with their dependencies installed.cmd/serverin full; execution and storeresolver-runon the runtime lifecycle, compute, observation, wake and allocation tests.The blind review found no blockers or majors, and confirmed that no Worker that lost its lease can issue a provider effect it couldn't issue before. Its four minor findings are fixed in this commit:
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.