Repository navigation
Merged
Conversation
…unning A task's turn ending used to retire and disconnect its connection at once, killing any background Bash/Monitor the agent had started and leaving the user to ask "so what happened?". A normal end_turn that leaves background work (for agents that resume on their own), a live delegated child, or a pending permission behind now holds the run open instead: it settles once that work and the agent's own follow-up turn have been quiet for 15 s, or after the keepalive cap (CODEG_ACP_BACKGROUND_KEEPALIVE_MAX_SECS, 60 min by default, 0 disables), using the follow-up's reply as the summary. - acp/turn_end_hold: the shared probe and wait loop; AIR async tasks outrank a possibly stranded watcher count - work_task engine: background_wait / background_wait_end events, stop-waiting action, cancel/reconcile aware, boot settles holds a restart cut short into review; a task already closed with task_complete is not held - automation engine: same hold before settling a run - UI: card note with the running count, "Stop waiting" action, and timeline entries, in all 10 locales
…al async-task tables Review follow-ups on the turn-end hold: - The waiter now marks its hold `settling` and drops it only after the generation is settled, so the reconcile tick and merge recovery can no longer settle a held run first (without its summary or verdict) in the gap between the wait ending and the settle. A cancel leaves a settling hold to its waiter; it has already won the row. Merge recovery skips held generations. The automation engine keeps its held marker through the settle the same way. - The async-task table outranks the watcher's count only for Claude Code, whose table carries all its background work. Grok publishes only workflow runs there, so a finished workflow no longer hides a background sub-agent still running. - A connection lost mid-hold keeps the last probe, so a follow-up reply read before it went away is still the summary.
… ends Production review follow-ups on the turn-end hold: - A turn that ends on a held connection after the held one (a turn Grok starts on its own, or a prompt sent to the session meanwhile) is no longer dropped. Its answer and reported error now feed the settle, and one that ends otherwise than `end_turn` (stopped, refused, failed) ends the wait: the run settles canceled/failed as that turn ended, instead of into review or "succeeded" on the held turn's `end_turn`. Same in the automation engine, whose held set becomes a map carrying a stop token. - The settle summary is the newest answer since the hold began, background reply or later turn alike, so a prompted fix made after the agent reported a failure no longer loses to that older report. - At boot, a held merge generation has its open wait closed too; the merge recovery still settles it from git.
The later turn's answer was stamped when the engine consumed its TurnComplete, which can lag the bus, while the background reply is stamped as the session applies it — so a lagging engine could rank an older prompted answer over a newer background report. The session now stamps `last_turn_completed_at` beside `last_assistant_text`, the probe carries both answers with their session-side stamps, and the hold starts from the held turn's own completion time. LaterTurns keeps only how a later turn ended.
…ost connection The session keeps only its last turn's answer, cleared by a turn that said nothing, and it goes with the connection. So when the engine handles a later turn on a held connection, it keeps that turn's answer, with the session's stamp, in LaterTurns again. The settle takes the newest of the background reply, the last look's turn answer, and the kept one, all on the session's clock.
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.
Prepared by codeg work task
538.