Skip to content

Bind the Session's Environment on the agent host - #536

Merged
SaladDay merged 1 commit into
aos/cutoverfrom
aos/pr5c-switch
Oct 8, 2026
Merged

SaladDay merged 1 commit into
aos/cutoverfrom
aos/pr5c-switch

Conversation

@SaladDay

@SaladDay SaladDay commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Core binds an agent host with the Session's Environment, so production binds carry the Link resource and attach grant. Placement still never chooses the agent host; PR5c-2 does.

  • Binding reads. GetSessionDevice and GetSessionExecutionBinding accept the deployment's agent host (no tenant) as the bound Runtime and return the Session's Environment (session_environment_id) beside the device's own environment_id. sessions.ExecutionDevice gains SessionEnvironmentID; environmentDeviceMatches and none placement keep reading the device's until PR5c-2.
  • Bind callers. Dispatch, prepared dispatch, assignedRuntimePeer and initialization bind with the Session's Environment.
  • bindLink. A bind of an agent host that holds the assignment, to an Environment without a live Link resource, fails with ErrNoLinkResource before anything is sent; callers map it to their existing unavailable outcomes. none still binds without Link fields.
  • Initialization. checkInitializationDevice checks only that the listed Runtime is still the bound one; the query keeps the device-Environment rule.
  • Docs. docs/runtime-protocol.md (+zh): with no live resource, Core sends the agent host no bind and the operation fails.

Tests

  • TestInitializationBindsAgentHost: the agent host registered as PR5a does it and connected, with an assignment row inserted by SQL; initialization sends assignment_bind with the exact resource and an attach_grant, and without a live resource it fails before any bind.
  • link_authority_test.go binds through the Worker's initialization path instead of calling peer.Bind directly.
  • Focused execution, runtimegateway, sessions, sessionpg; 82 integration tests across dispatch, initialization, Environment files and Link authority; -race -count=50 on the new and Link tests; make check-names check-docs check-ci.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

The binding reads return the Session's Environment beside the device's own and accept the deployment's agent host. Every Bind caller passes the Session's Environment, and an agent host's bind to an Environment without a live Link resource fails with ErrNoLinkResource before anything is sent.
@SaladDay
SaladDay merged commit 9136c68 into aos/cutover Oct 8, 2026
@SaladDay
SaladDay deleted the aos/pr5c-switch branch October 8, 2026 01:43
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