Skip to main content

Module consult

Module consult 

Source
Expand description

Handing an open question to the chat conversation its task came from.

A task filed by the standing chat (Source::Agent with crate::queue::CHAT_NODE, whose run is the conversation’s id) can raise a question the owner would rather talk through where the task started. The owner passes it on; the chat agent either answers it with magi answer or puts the decision points to the owner in the conversation.

Three rules, each with a reason:

  • One place decides. origin_talk is the only judge of “does this question have a chat to ask”; the web view and both entry points use it.
  • Not a choice. The hand-over never goes into Question::choices and never touches Question::answer: the question stays Open, its validation and the choice actions stay as they were.
  • No new seat, no new waiter. The text is queued as a draft of the existing talk, so the chat’s own turn machinery (its session, its turn gate) runs it exactly as if the owner had typed it.

Enums§

QuestionKind
Authorization policy is selected by the question’s node, never its reply.
Started
What start_turn did.

Functions§

begin
Record the hand-over and queue the question as the chat’s next message.
chat_talk_of
The talk start descends from: the id recorded on a task (Task::chat_talk) wins, so deleted ancestors do not matter; tasks written before it existed are resolved by walking the ancestry.
drain_turns
Run the talk’s turns under lease until no draft is owed.
origin_talk
The conversation q may be handed to, if any.
pending_consults
Is any question handed to talk talk_id still open?
refuse_operator_held
Refuse a chat’s answer to a merge approval whose task the operator held, as ask_settle_cmd does for a deputy: such a hold is lifted by the operator’s button. The task is the one q.run names, directly or as one of its runs; none found (an unreadable task is not listed) does not refuse. The caller reads the queue before taking the question lock, so a hold placed in between is missed for that one call.
start_turn
begin, then run the chat’s turn here, under the talk’s own lease.
validate_answer
Validate guarded decisions answered by a running chat. Terminal answers retain their existing behavior. Merge and posting policies both require evidence from the correct conversation; posting also checks the selected text.