A child is a status
Amended by an-agent-is-a-thread: no
Workingvariant or shared child cell; reports are messages, posted only while the helper mailbox owes its parent. Published status lives in that mailbox; the historical mechanism below is superseded.
What a parent can know about a child is its latest state, so a child is a status, not a sum of owed answers. This reverses the debt mechanism of the one-scope-tree inbox and keeps its scope tree and fence.
Diagnosis
- One reply answered every request a child had taken up with one notice,
and
exarch-agents `readreturned one value: the parent observed one state per child. - Counting it took a token per request, a pool per work, a drop that paid
Cancelledand a withdrawal for refused posts.
The decision
ChildStatusisWorking | Replied(FOValue) | Failed(String), held by aChildthat parent and child share;Work.childrenretains those cells.Child::has_repliedobserves the variant without cloning its value.- A child is born Working, enrolled by adoption under its parent’s lock.
Only its parent makes it Working again, or its own resume:
Mailbox::follow_upposts, records and sets the status under the child’s record lock. A resumed returning (headless) root records Working throughInbox::resume, called fromAgent::reopen; a conversing root records nothing. Peer messages, steering and wakeups do not. The follow-up is the privatePost::FollowUp, built only inMailbox::follow_up; there is noScoped::FollowUp, andPost::vouchernames a scoped post’s scope for fencing. - A reply settles only if no parent follow-up is queued. A crossing reply leaves the child Working and posts no notice; its next reply after taking up the follow-up answers both. Other input prevents a lease, not settlement.
- Finish publishes status and notice under the same parent lock.
Mailbox::finishsets the status and queuesItem::Agent { name, settled, elapsed }together. Busy clears at finish, anddrawpops the notice before honouringQuiesce. - Busy is some child of the current work Working, with no liveness filter. Life cancellation alone does not clear it; retirement finishes a Working child, so the parent cannot quiesce between cancellation and its notice. Abandonment replaces the work and forgets its children.
- Ending finishes only a Working child, as
Failed(reason). The reasons live together inbus/post.rs:ENDED_BEFORE_REPORTING(owner drop),ENDED_BEFORE_ANSWERING(settlewith outcome Replied while still Working: a follow-up crossed or followed its reply; unreachable in production, since attend keeps Replied only while the lease holds) andCANCELLED;settleotherwise usesAgentOutcome::reason. Retirement preserves a replied child’s value and posts nothing for it. readasks the reader’s current work for its newest own child of that name, live or ended. It refuses Working and Failed, returns Replied without consuming it, and reaches neither grandchildren nor abandoned work.- A headless root reports to its harness through the same cell, without a
parent mailbox. Accepted: a headless root running several jobs in one
conversation would keep
Replied(v1)during a later job; unreachable today. - Construction states the pairing.
Kin { Trunk(Trunk), Child { parent, work } }determines both theRole(Kin::role) and theLodging { Root, Reporting(Child), Under(Mailbox, Child) }(Kin::lodging), so a parent’s work without a child, or a child without work, cannot be stated;Mailbox::adopttakes anArc<Child>.
The status is a fold of the child’s log
ChildStatus::fold, test-only, reads Working before the firstForensic::Status, then the last status recorded: the oracle the live status must agree with.Report::transitionrecords before showing the status, outside every inbox lock.- The parent’s delivery and the child’s finish both transition a child, so
each holds
Child.recordacross decision, record and publication: the log orders transitions as memory does. Retirement takes the record seam; it is idempotent, and a retired child takes no further transition. - A follow-up is posted before its record, so a refused post records and
changes nothing. Before retirement, between transitions, a queued follow-up
implies Working. A failed append still shows the transition: the failure
has ended life, and the parent must hear it. Retirement’s own failed
Failedappend showsFailed(<the recording failure>);settleretires, then checks availability and announces any failure once (spawn::announce). - A Working owner unwinding through a panic shows Failed without recording
it and skips
SessionEnded; its log still reads Working. A crash writes no terminal status. On normal owner drop, the Failed record precedesSessionEnded, the tail bookend. ChildStatus::settlementproduces the value-freeSettlement::Replied | Failed { reason }carried by the notice.Agent::arriverecords the parent’s uptake asDisplay::SubagentDone; that display fact carries no reply value. Model and presentation folds ignoreForensic::Status.
Lock order
- No path holds two inbox locks.
- A child’s record lock (
Child.record) precedes any inbox lock and the child’s log. It is never taken while any inbox lock or status lock is held. Child.statusis a leaf, taken under the parent’s inbox lock (busy, finish,child_status), under the child’s own inbox lock (status()), or under none.- Inbox, then the schedule registry’s leaf, as today. Scope cancellation and polling take no lock.
Accepted consequences
- A stale reply notice cannot settle a newer follow-up: the status is
Working, and
readrefuses until its next settling reply. A reply remains readable after lease lapse or teardown, until the parent’s work is abandoned or a newer child of that name is enrolled. - A child’s
/clearthat discards a queued follow-up leaves it Working until it next replies or ends. - Current work retains every child’s status and reply value; retirement releases the record seam, not the status.
Amendment — 2026-10-30: status belongs to the mail
agents makes the latest report
Mail::status(), folded from Control::Status. Txn::report commits status,
schedule retirements and queued-wakeup withdrawals (every pending post after
life ends), syncs the helper, then posts the parent notice iff Mail::owes()
was true, still under the helper lock. The parent’s post unlocks before syncing. No reader sees paid debt before delivery. A poisoned
helper reports Failed directly to its parent. A failed report append or sync
notifies iff the captured pre-commit mail owed. Append failure changes no fold;
a successful Status already cleared debt before a failed sync, so the fallback
uses captured debt and never sends the unconfirmed successful status.
These fallback paths share Shared.failure_noticed, so reporting and
teardown post at most one Failed; the flag stores neither debt nor status.
The original shared-cell mechanism above remains historical, not a second
status authority.
Amendment — 2026-10-30: the task is the parent’s post
Every Mail starts with answering: false and owes nothing. The helper’s
opening task is Input::Task(AgentMessage), recorded as a Posted with
voice: Peer and from: parent; uptake admits its text bare. Debt begins
at that post, before the first exchange, by the same parent-post rule as
later messages. The task is not human input and recall does not return it
to the human. returns is held only by the mail fold, not the handle.
Where
exarch/src/record.rs,record/mail.rs:ChildStatus,Settlement,Control::Status,Mail::status.exarch/src/bus/mailbox.rs:Status::working,Txn::report, recorded status and derived parent debt;agent/handle.rs:AgentHandle::report.exarch/src/agent/nursery.rs:Nursery::owing, retained helper handles and joins;agent/desk/agents.rs: newest own helper’sread.exarch/src/agent/{attend,arrival,spawn}.rs: recording reports, parent uptake and terminal reporting/departure.
an-agent-is-a-thread states the current publication and obligation laws; the reasoning above records the superseded shared-cell mechanism.