RFC: connection-lifecycle events + abort orphaned agent runs on disconnect#29
Open
joshuajbouw wants to merge 2 commits into
Open
RFC: connection-lifecycle events + abort orphaned agent runs on disconnect#29joshuajbouw wants to merge 2 commits into
joshuajbouw wants to merge 2 commits into
Conversation
…nnect Kernel emits a typed principal-presence event on connection-count boundary crossings (first-connected / last-disconnected); capsules (ReAct) abort orphaned agent runs on last-disconnect instead of waiting out a phase timeout. Typed disconnect-reason (nested rejection-cause, other(string) backstop) replaces stringly-typed reasons. Both the presence event and the abort outcome feed metrics + the admin dashboard. Includes a breaking client@2.0.0 retype of disconnect.reason, sequenced. Tracking: astrid#807
Restructure per review: a dedicated astrid-bus:connection contract owns the whole connection lifecycle (connect/disconnect folded in from client.wit + principal-presence + typed disconnect-reason co-located), rather than scattering across client.wit/system.wit/types.wit. system.wit stays daemon/kernel lifecycle; agent-aborted stays in agent.wit. Resolve the migration question: break end-to-end (pre-1.0, unreleased). Add a verified blast-radius section (astrid#808): the change touches only astrid-capsule-cli + core, not all capsules, because capsules bind host ABIs via astrid-sys, not the astrid-bus:* interface specs.
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.
Tracking issue: astrid-runtime/astrid#807
Summary
Defines a kernel-emitted connection-lifecycle contract: a typed
principal-presenceevent (insystem.wit) published when a principal's live connection count crosses a boundary (first-connected / last-disconnected). Long-lived capsules consume it; the ReAct capsule aborts an in-flight agent run when its principal's last client detaches — instead of churning LLM/tool calls until a phase timeout (~2 min) ormax_iterations.Highlights
variant disconnect-reason { graceful, dropped, timed-out, shutdown, administrative, rejected(rejection-cause), other(string) }, shared intypes.wit.other(string)is the forward-safe backstop (extending a WIT variant is breaking).principal-presenceandagent-abortedfeedastrid_active_connections,astrid_agent_aborts_total{outcome},astrid_principal_disconnects_total{reason}, and the admin dashboard.aborted/nothing-to-abort/failed) so disconnect-driven aborts are visible, not silent.client.wit'sdisconnect.reasonto the shared typed reason (client@2.0.0), sequenced — with a non-breaking string-mapping alternative spelled out.Open questions (for review)
client.witmigration: end-to-end typed (breaking, recommended) vs kernel-maps-string (non-breaking)?timed-outreason, or reserved until it lands?count-changedtransition (breaking to add later)?Filename is
0000-per the RFC process; a maintainer assigns the number on merge.