Repository navigation
feat: child threads report later turns, obey access limits, and stop with their parent - #1073
Merged
Merged
Conversation
…d Stop Stage 1, step 1 of docs/design/agent-autonomy-no-limits.md (rev 6, which this commit adds). Nothing behaves differently yet. - A message, a queued message and what starts a turn from one can carry the sender's access (`requestCeiling`) and a lead pass's block (`passBlocked`). - A report can be a follow-up no request asked for (`fromThread.followUp`). - A child keeps the reports it owes its parent (`childRequests.owedReports`). - A thread started without report back can stay under its starter's Stop (`stopsWithParent`). - `thread.session.stop` takes a server-only `cause` (family, cleanup). - `thread.delete` can name the threads the dialog listed (`alsoDelete`). - A check-back can be marked dormant; a dormant one no longer counts as live. - A thread started over a link keeps the access it was started with, and a linked send carries the sender's access, with a flag for computers that enforce it. - Shared: `attachedDescendantsOf` and `stopReachOf` walk a family in tree order with levels and a visited set; `isStillGoing` is the one test for what a stop targets, what its count shows and what holds a revert.
…d reports at turn start Fixes from the step 1 review: an outgoing child request and thread.remote-request.queue carry the sender's access; thread.turn-start-requested and thread.session-set carry the report a starting turn owes, and an owed report is keyed by message or by turn; the still-going test reads plain facts and counts a running side answer and a turn about to start; a client can't give a session stop its cause or claim stopsWithParent.
…ets a Stop button Stage 1, step 5 of docs/design/agent-autonomy-no-limits.md. - "Stop N working threads" counts by the shared still-going test over Stop's reach (countStillGoingInReach), so a child that only checks back and a thread started without report back that the user hasn't written in are counted. The summary's facts are read in its own words: `connecting` for a starting session, the queue count, and a message no turn has picked up yet. - The chat's family tab row ends with a plain "Stop N threads" button while the open thread's reach has anything still going. It sends the menu's command (thread.children.stop, no ids). The tabs sit in their own strip, so they take the room it leaves and scroll under it on a phone. - The web store carries stopsWithParent and clears it on a person-written message and on put back, as the server does. - The "Checking back" pill, the wrapped row's countdown and the chat's check-back line ignore dormant check-backs; the store notices a dormant mark changing. - Delete with its threads sends alsoDelete with the ids the dialog counted, keeping withChildren for older servers.
… steered message frees a loose thread Fixes from the step 5 review. - A thread started without report back leaves its starter's Stop on every event that records a person's message (composer or sentFrom): sent, queued, steered in and accepted, not only sent. - The Stop count (now countThreadsToStop) adds what an id-less thread.children.stop also settles: a child on a linked computer with a request open, and a child still being set up with no thread yet. - The count's "waits on the user" reads every approval the Pending Approval pill reads; a summary rebuilt from the thread's detail keeps a settings change, a key request and a schedule approval apart. - Delete with its threads no longer leaves a listed child's open chat: the server may keep it, and the thread route goes home when a removal really arrives. Only the named thread's chat steers away. - The Scheduled page's "and N more" counts only check-backs that can fire. - Browser test: the family row's Stop stays in view on a phone while the tabs scroll.
Stage 1, step 2 of docs/design/agent-autonomy-no-limits.md ("Delivery rules").
- A turn an attached child takes on its own (a check-back, a scheduled run,
an automatic fix, a goal, a report from its own thread) owes its parent a
report. The decision that starts it records an entry on the child's owed
list; a person's message, an outside agent's, a hand-off and the parent's
own request owe nothing, and a continue follows the turn it continues.
- The new server-only thread.child-report.settle delivers the report as a
follow-up (fromThread.followUp) to the agent that started the child, or
drops it (stale epochs, separated, parent archived, wrapped by hand, or
held). A drop writes thread.child-report-dropped, which is never sent on
the thread stream, so older clients can still replay a thread.
- Turn ends, the exit that takes a running turn with it, a failed or
taken-back start, the next turn's start (sweep) and startup all settle an
owed entry through one pure function, so a turn is reported once.
- Stopped on purpose is the turn a Stop named; any other interrupted turn
tells the parent it stopped before it finished.
- A request waiting on background work settles with its answer so far when
the child's next turn starts, whatever starts it. A linked computer's
ledger keeps today's rule.
- Late replies are gone. A thread with a parent no longer has reports from
its own threads steered into a running turn; an idle thread sends the
oldest message an agent queued first; a leaving agent's queued follow-up
reports go to the thread's own agent; report turns continue at a reset in
a thread with a parent too; a child's report doesn't push-alert.
…p the parent held Fixes from the step 2 review. - A writer that marks a turn running says what started it (TurnStartedBy): the reactor names the message the provider took, ingestion names the pending message or the provider, and a check-back is always the provider's. The turn record binds the pending message only when that writer names it, so a check-back during preparation never takes a message's start or answers its request. - What earlier turns still owe is swept by ingestion alone, which has taken every earlier turn end; it keeps the starting turn's entry, the pending message's and the one bound to the turn. The decider no longer sweeps. - A child's report that a restart cut off after it left the parent's queue is sent again at startup. - The user's Stop always holds a thread with a family, so a child's later report is dropped until the user writes. - A continue is judged by its turn's first message, never one steered in. - A report's settle command id comes from its owed entry, so a resend's entry settles on its own. - A turn the provider took is never settled as unstarted. - A child keeps the agent that started it (childRequests.reportsTo) for its later reports, and a requeued message keeps its place in the queue. - The stopped-session backstop reads the session as it is now and counts a Stop only when it named that request's turn. - orchestration.replayEvents leaves out server-only events.
… put cut-off reports back Second round of fixes on step 2's review. - A session update binds the pending message to its turn only when the writer that marked the turn running named that message. An update that names nothing (a task count, a repeat) changes nothing, and a turn Claude opens by itself (claude/synthetic-turn-start, a background agent finishing) or a check-back is the provider's. - Restart no longer resends a cut-off report. Startup puts a report whose turn the provider never took back on the parent's queue, found by the exact pending message (thread.follow-up.restore). The decider leaves it off when its delivery was cancelled since, and it never touches the hold. - In an idle thread, and at startup, agents' queued messages go in the order they arrived (createdAt), so a report put back keeps its turn. - A message run again has a turn per run: restart and the stopped-session backstop take the newest turn, and a report for a turn that never started gets a request id of its own. - A child from before reportsTo reports to the thread's own agent.
…w each run by its turn Fable's rules for findings 3 to 6 of step 2's second review (docs/design/agent-autonomy-no-limits.md, "Restart and turn binding", copied here from bf82b9e). - Rule A: thread.turn-start.take-back replaces thread.follow-up.restore. A child's report whose start died before the provider took it (restart, or a failed start) goes back ahead of every other agent message (putBack), or is marked not run when it can no longer be delivered (stale, held, archived, moving). Never a turn start, never the chain epoch or the hold. A thread whose report was put back gets no restart note or continue, and the turns projection drops the pending start when its message goes back or is marked not run. A put-back report waits for the next thing that moves the queue, so a start that keeps failing can't loop. - Rule B: a message has one start no turn has claimed. A new start replaces its unclaimed owed entry; the session update that names the message binds the entry to the turn and records the turn on the parent's running request (answeringTurnId). Turn ends, startup and the stopped-session backstop match by turn id; a request from before goes by its message's newest turn. At startup an entry no turn claimed is dropped. - Rule C: nothing automatic restarts a report's turn. The createdAt ordering from the last round is gone: the queue's order (with putBack) decides.
The put-back report waits for the next thing that moves the queue, so a start that keeps failing can't loop; the bind rides on thread.session-set as owedReportBinds.
- A writer that names a turn's message corrects an earlier provider-start classification of the same turn: a person's message drops the turn's owed entry, an owing message takes it over, and a parent's request records the turn either way. - Retry after a report's failed start sends the report that was put back, never an earlier message of the user's. - The user's own session stop holds a thread with a family; the server's own session stops carry a cause (family for thread.children.stop, cleanup for archive, the sweeper and a link) and leave no new hold. - Startup drops an owed turn a Stop named instead of reporting it cut off. - A report's start is taken back before the session is marked interrupted at startup, and before a failed start's failure is recorded. - The startup send of a queued report gets its own command id each startup. - A continue after a restart is judged by the cut turn's own message, so a check-back is never continued. - Archiving a child moves its attachment epoch, ending what it owed. - The plan doc lists what was fixed and the known limits left.
Fourth review of step 2. - Ingestion records every turn start as the provider's, provisionally, and never names a pending message. The reactor names the message it sent, with the turn's id (turnStartedBy.turnId), and that corrects the record whether or not the turn is new. An unmarked provider turn during a request's preparation (a Codex goal) can no longer answer that request. - The naming correction judges a continue by the turn it continues, so a continue of a person's turn drops its provisional report. - Retry sends a put-back report only when no message was tried since it was put back; otherwise it retries that message. - A restart continue judges an unnamed cut turn by the start still pending. - The plan doc says exactly what a stop cause changes, lists this round's fixes and the known limits left.
…s access ceiling Stage 1 step 3 of docs/design/agent-autonomy-no-limits.md. - Carries requestCeiling (and passBlocked when under a lead pass) on local and linked child requests, continues (usage-limit reset, restart, account switch), and retries/resends. - Checks the ceiling at send time, at every stored-message turn start, and again in ProviderCommandReactor after rereading the thread. - Advertises enforcesRequestCeiling on PeerDescriptor, refuses narrower sends to older peers, records launchedAccess on remoteOrigin, and holds older-sender and pre-upgrade queued requests to it. - Adds nullable-column migration 124 for projection_thread_messages (request_ceiling, pass_blocked) and projection_threads (stops_with_parent).
…acks Stop now stops attached and flagged loose threads in one decision without putting new holds on children, marks saved check-backs dormant when their runtime ends, waits on in-flight reports before moving, lets delete name exact child ids, and carries chainEpoch on fallback resends.
…-freeze edge cases Carry requestCeiling and passBlocked across accountSwitch continues, mark saved check-backs dormant for non-slot room agents and archived/switched threads on exit or reap, bump chainEpoch on family/cleanup stops of starting or loose threads without adding holds, drop child follow-up reports targeting frozen/quiescing parents, skip carried-session fallback resend when the user already stopped the turn, narrow ask-mode requestCeiling on approval, save launchedAccess on moved-alone remoteOrigin, and report remote queued ceiling refusals as failed.
…gnal Effect's ChildProcessSpawner fails child.exitCode when a process ends from a signal (like SIGKILL or OOM), instead of resolving with a numeric code. CodexSessionRuntime had no error handler on that fiber, so a signal-killed Codex app-server never emitted session/exited, stayed stuck in running, and never notified a parent thread. Handle failed child.exitCode results and report the signal name.
…age-1 # Conflicts: # apps/web/src/hooks/useThreadMenu.ts
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Child threads previously only reported back on the turn a parent directly asked for, could outrun the parent's access ceiling on continues or linked sends, and did not always stop cleanly with their parent or report unexpected crashes.
This PR implements Stage 1 of
docs/design/agent-autonomy-no-limits.md:124_ChildAccessAndStopColumns.ts).reportBack: false), and check-backs without placing new holds on children, and marks saved check-backs dormant when their runtime exits or is reaped.Stop N threadsbutton, Stop counts every thread still going, and deleting a parent deletes only the exact child ids counted in the dialog (alsoDelete).CodexSessionRuntimenow handles failedchild.exitCoderesults (such asSIGKILLor OOM) and emitssession/exitedwith the signal name so the thread leavesrunningand notifies its parent.