Ergoly Docs · Technical details

Technical details

View as Markdown

How a channel reaches a worker

Every Slack message is routed to one copy of one worker by a fixed rule, before any model runs.

A channel in the docs is any place a worker operates. For Slack, the thing underneath is a channel mapping (the API's channels resource): a record that says which client a Slack channel belongs to, or that it is one of your own. Routing is the code that reads those records.

A message in a channel becomes an event, is routed to one copy of a worker, which takes a turn and answers back where the event came from.Channel#acme, a DM, a hookEventa mention, a delivery, a schedule firingRoutingwhich copy: Acme's, Globex's, your team'sTurnthat copy works, one event at a timethe answer goes back where the event came fromONE MESSAGE, START TO FINISH
A message in a channel becomes an event, the event is routed to one copy of a worker, and that copy takes a turn.

The rule, in order

QuestionAnswer
Is this Slack channel mapped to a client?That client's copy of the worker.
Is it a direct message from someone bound to a client?Their client's copy.
Is the sender one of your company's own people?Your team's copy.
Anyone elseOne sentence saying it cannot help here, and no worker runs.

The questions are asked in that order, and the first yes decides. No model is consulted. Which client a turn is about is therefore fixed by which copy runs it, never by anything in the message.

A mapping is a decision

A channel is mapped to a client, or marked internal. Both are explicit records. A channel with no mapping at all routes nowhere, and is not treated as internal. Moving a channel that is already mapped to one client onto another has to be confirmed, so a re-point is always something you asked for twice.

Direct messages are never mapped. A DM routes by who is in it, through that person's binding to a client. That is one route to the answer rather than two, so there is nothing to disagree.

Dispatch

Once the copy is chosen, the message is signed and sent to that copy's sandbox, which has its own key. The reply comes back as a stream of pieces (text, a progress step, a request to send a message) and is posted to Slack by the platform, never by the copy. A copy never holds a Slack token.

A message that arrives while that copy is busy is queued and handled next. A run of messages from one sender is folded into one turn; messages from two senders are two turns.