Skip to content

Emit a durable agent.exited event on node-agent offline transitions #273

Description

@willwashburn

Agent exit on a node is only observable by polling the roster: deregisterAgentViaNode (engine/src/engine/node.ts) and reconcileInventory's missing-agent sweep flip the agent row to offline without emitting any workspace event, completing any invocation, or touching the webhook outbox. Consumers that need exit signals (e.g. the factory orchestrator's remote backend) run a reconciliation poll instead.

Emit agent.exited (with agent_name, and the spawn correlation available in metadata.fleet.{node_id, invocation_id}) through the same fanout as invocation completions — durable workspace event log, webhook outbox, and the spawn caller's mailbox — from:

  • deregisterAgentViaNode
  • the reconcileInventory missing-agent sweep
  • applyReleaseCompletionEffect (release round-trip)

Node death itself is also push-invisible (sweepOfflineNodes only decays liveness): a durable node.status.offline/online pair would let dispatchers stop corroborating node liveness by polling.

Downstream: the factory replaces its roster-reconciliation exit watcher with an event fast-path once this lands and the hosted engine is on a version that carries it.

🤖 Generated with Claude Code

Activity

  1. added 2 commits that reference this issue on Jul 16, 2026
    c968cb2
    1173813
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions