Skip to content

fix(agents): resume channel and collector children after restart - #180227

Merged
steipete merged 1 commit into
mainfrom
steipete/fix-detached-subagent-recovery-followup-20261022
Oct 22, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/fix-detached-subagent-recovery-followup-20261022

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes detached channel-origin subagents and collector tasks remaining interrupted after a Gateway restart. Follow-up to #180090.

User Impact

Eligible children resume in their original session and retain their normal parent-completion or collector-result delivery. Session-scoped operators can resume their own child work. Explicit cancellation, replaced sessions, and revoked authority remain terminal.

This does not reconstruct deleted sessions or expired registry records. Previously settled work may need a fresh request in its retained parent or child session after checking for an existing follow-up. Collector retention is unchanged; no configuration or schema changes are required.

Why This Change Was Made

Recovery required an operator snapshot even for channel-origin children, and collector registration skipped capturing that snapshot entirely. The registry now restores channel requester identity from the child's existing exact-session private claim and captures the existing operator source for collectors. Recovery uses fresh admission with the host-owned exact-session binding, preserving the original result owner.

Startup timing counters sum overlapping requester groups; they can exceed activation wall time. This correctness fix makes no benchmark or startup-speed claim.

Evidence

The detached restart integration regression fails on the previous code: valid channel children and collectors never dispatch, and recovered operator requests lack the host session binding. It exercises persisted interruption, Gateway replacement, resumed registry custody, and late completion or collector settlement. Channel network delivery and a production deployment are outside this proof.

Validation: all 10 detached restart regression cases pass; changed-file formatting/lint and pnpm tsgo:core pass. The isolated independent review found no actionable P0–P2 issues. Five focused neighboring files pass all 206 cases: subagent-registry.completion-authority.test.ts, subagent-registry-restart-recovery.test.ts, server.sessions.recover-in-place.test.ts, chat-send-subagent-custody.test.ts, and agent-tools.prefix-stability.test.ts. Broad validation is delegated to PR CI; no benchmark was needed.

Production delta: +162 lines; test delta: +151 lines. The added code restores the existing channel requester contract with current parent/Gateway lifetime checks. It does not add a new recovery owner, persisted format, cache, or configuration option; collector launch now shares the existing source capture.

@clawsweeper

clawsweeper Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review October 22, 2026 02:59
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T03:03:43.887885Z e40d844 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant