Repository navigation
feat: a goal pauses while its thread waits on you or on threads it started - #1004
Merged
Merged
Conversation
…arted A Codex goal whose agent asked for something through a card (threads to start, a scheduled task, a settings change, an invite, a command to run) kept running turns that could only say "still pending", and again while the threads it started worked. Threadlines now pauses the goal while the thread waits and resumes it when the wait ends. - goalWaitOf/goalWaitStep (shared) say what the thread waits on and what the goal should do; the decider applies them on the server-only thread.goal.wait.sync, sent by the new GoalWaitReactor. - The pause is marked on the goal (pausedForWait, optional) and sent to Codex with origin automatic. The user's own pause, resume, edit or clear drops the mark; a goal that completes or hits a limit loses it. - A resume waits while a turn is about to start, so a report never gets a second goal turn beside it. - The goal bar says "Paused until you answer" or "Paused while its threads work". Claude's goals have no pause and are left alone.
…under way A report from a thread the agent started settles its request and waits in the queue in one decision, then goes out a moment later. Resuming the goal in that gap let Codex start a goal turn first, with the report steered into it. A message waiting in the queue now counts as a turn about to start, so the resume lands after the report's own turn starts and the goal carries on inside it (seen live: one turn, resume 44 ms after it started).
…-waiting # Conflicts: # apps/server/src/orchestration/decider.ts
- The mark has three states: paused (ours), resuming (sent, until the provider reports the goal active, so a restart in between resends it), and user (the user acted during the wait). A resume the user made while a card still waited was paused again as soon as Codex confirmed it; the user mark keeps their choice until that wait is over, including a pause that landed before ours. - Stop marks the goal the user's, so the waits Stop ends never resume it. - A command's output on its way still counts as a wait: the run's finish is recorded a moment before the output goes back. - The reactor also watches reverts and agents leaving.
- The reactor reports each user goal action and Stop (userActed), so a pause the user made where the only wait is a scheduled-task card, which the decider can't see, is theirs for that wait. - A resume not yet confirmed is sent again only on the reactor's startup pass (retryResume), never on every look. - A new wait before a resume was confirmed sends the pause, so the resume still on its way doesn't win. - The provider reactor sends an automatic pause or resume only while the goal still carries that intent: a goal the user took over, or that the provider ended or blocked since, is left alone.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This branch was previously 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.
A Codex goal kept spending turns while its thread waited. When the agent asked for something through a card (threads to start, a scheduled task, a settings change, an invite, a command to run) it got control back at once, and the goal ran turns that could only say "still pending": three before Codex marked it blocked, and more after Start while the started threads worked.
Now the goal pauses while the thread waits on a card or on threads it started, and carries on when the wait ends:
packages/shared/src/goalWaitPause.ts, from the same facts the sidebar reads. The decider applies it on a new server-only command,thread.goal.wait.sync, which the newGoalWaitReactorsends when a wait or the goal changes. It also looks at every goal once at startup.waitPause:paused,resuming(kept until Codex confirms, so a restart resends it), oruser. It is not a new status value, so older clients aren't affected. When the user pauses, resumes, edits, clears or stops during a wait, nothing automatic happens until that wait is over.thread/goal/setwithorigin: "automatic", the same message the pause before Stop already sends. The provider reactor sends it only while the goal still carries our intent.This goes one step past "pause while its card waits": live, after Start, the goal kept running turns while the started threads worked, so that wait is covered too.
Checked live on a throwaway setup with Codex. The goal paused 40 ms after the card appeared, and no turns ran while the card waited or the thread worked. The report came back as one turn, the goal resumed 40 ms into it, and it completed inside that turn.
Design:
docs/design/goal-wait-pause.md.