Skip to main content

Module chat_control

Module chat_control 

Source
Expand description

Direct task and run control for the standing chat: magi task control ..., and a chat seat’s magi answer --reply / --reply-other.

A chat agent carries out the owner’s requests by command, with no question or offered choice in between: resume a run, hold or release a task, retry a task with a changed instruction, rerun the failed checks of a pull request, abandon a dead run, and record the owner’s choice for a decision the machinery waits on (a merge included). The owner’s request in the chat is the authority: no quote, fixed phrase or “only tasks this chat filed” scope applies, including to direct PR merges. Every command goes through the transitions the rest of magi already uses ([crate::resume], Task::hold_manual, Task::release_operator, Task::edit, [crate::daemon::rerun_checks_once], [crate::driver::abandon_proven_dead], crate::ask::Question::answer); this module only checks who is asking and that the target is consistent. A chat seat’s answers go through the same bridge (Operation::Answer, Operation::ReplyOther) because a read-only turn’s sandbox may refuse magi’s stores; the launcher records them with exactly the terminal’s functions.

  • Authorization. MAGI_NODE=chat and MAGI_RUN equal to the exact id of an open conversation (crate::chat_watch::authorize).
  • Targets. Any task (full or unambiguous-prefix id) and any recorded run (full run id). Ids are checked against the queue, and a task is re-read under its claim, never trusted from a lookup made before it.
  • Resume starts nothing here. It pins the owning task to the run and queues it; the loop’s ordinary start logic resumes it under the graph’s execution lease, so a second driver cannot appear.
  • Abandon needs a proven-dead driver. Liveness is judged by the shared judge under the owner lock; an unknown or live driver is refused.
  • A merge waits for the owner. It is recorded only when the owner asks for it; the land driver then merges the saved head with --match-head-commit.
  • Direct PR merging is head-bound, not phrase-bound. The chat reads the head from the forge and merges on the owner’s plain request. Pending land approvals retain their existing decision path.

Structs§

Filing
Inputs prepared by magi task add before saving a fresh queue record.

Enums§

Operation
Only these operations cross the standing turn’s inherited capability. No shell commands or calling conversation identities are input.

Functions§

abandon
Abandon a recorded run whose driver is proven gone. No confirmation phrase is needed; an unknown or live driver is refused by [crate::driver::abandon_proven_dead], so a working driver is never broken.
authorize
The conversation this process speaks for, or why it may not act.
decide
Record the owner’s choice for a decision from an open standing chat. The chat agent interprets the owner’s request directly, a merge included; no quote, consent phrase or task ownership is required. See [record_decision].
describe
One line a person or agent can read after a successful command.
dispatch
The CLI sends only a typed operation when it inherited a turn capability. Outside a launched turn the existing, authorized local route remains usable.
done
Mark a task complete under its queue claim, as magi task done does.
has_channel
Whether this process inherited a launcher control channel. Provenance-only CLI calls without a channel retain their ordinary local route.
hold
Hold a task for the owner.
release
Release a task (the same transition as magi task release: the attempt count restarts, the history stays). An operator hold is released too: the owner asked for it.
rerun_checks
チャットのリクエスト単位で受付記録を残し、共通遷移でチェックを再実行する。
resume
Resume a stopped, blocked or parked run (its task’s latest). Only queues the pinned resume; returns the owning task.
retry
Change a queued or held task’s instruction and queue it again, in one save under one claim. Only what Task::edit allows can be retried; the attempt count follows Task::release (restarts), while runs, passes and the resumption history are kept.
set_priority
Change priority under the same claim and state check as the terminal route.