t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: Parent agent is not notified when a delegated child waits for an approval

Open pedrozimmermannsoares opened this issue 1 month ago • 9 comments

Before submitting

  • [x] I searched existing issues and did not find a duplicate.
  • [x] I included enough detail to reproduce or investigate the problem.

Area

apps/server

Context

#15082 was closed on 2026-10-21 with this note: "One part is still open: parent-agent notification for approvals and sign-in requests. If that part still matters to you, please open a new issue for that part only." This is that part. PR #20928 ("notify parents when delegated children need approval") is open and appears to address it.

Steps to reproduce

  1. On 0.1.2-nightly.20261021.3473 (macOS, desktop app), a Claude parent thread (claude-opus-5-5, full access) launches an async child with delegate_task on a second Claude provider instance (claude-opus-5-5, runtimeMode: full-access).
  2. The child runs a Bash command that edits a file through a heredoc (python3 - <<'PY' ... PY). The CLI raises a command approval for it. The child's system/init event reports permissionMode: "bypassPermissions".
  3. The parent's turn has ended. Nothing wakes it.

Expected behavior

The parent agent receives a notice that the child is blocked on an approval, with a link to the child thread, so it can tell the user or stop and relaunch the child.

Actual behavior

  • The parent agent gets no notice. The user saw the "Subagent needs approval" banner and had to tell the parent agent about it in chat.
  • task_status reports status: running, workState: working, pendingApproval: null, while t3_thread_read on the child reports pendingRequestCount: 1.
  • The parent agent cannot approve or decline. Its only option is t3_thread_interrupt followed by t3_thread_send with new instructions.
  • After the interrupt, the old approval stays pending and the banner stays on screen while the new run works normally (see #21935). The user then reported the same banner two more times, and the parent had to inspect the child to tell a stale request from a new one.

Impact

Major degradation or frequent failure

Workaround

The parent tells every Claude child to edit files only with Edit/Write, to write scripts to a file before running them, and to avoid heredocs and rm -rf with variables. Codex children in the same session did not raise approvals.

pedrozimmermannsoares avatar Oct 21 '26 14:10 pedrozimmermannsoares

Reproduced the missing parent notice on current main 8acbefe, using the real web dev server on Linux and Claude Opus 5.5 on two provider instances. The full-access heredoc completed without prompting here. With an approval-required child, the command approval remained pending and the banner appeared, while the parent stayed completed with no new message or run.

Existing #20928 covers the notification path; preserving that implementation rather than opening a competing PR.

Runtime transcript

Parent remains idle while the delegated child needs approval

juliusmarminge avatar Oct 22 '26 02:10 juliusmarminge

Updated the existing fix #20928 at 152bad3669, preserving its history. The missing-notice regression fails on the baseline; 83 focused tests and the server typecheck pass on the fix. Ten final-head server runtime scenarios pass using synthetic provider events and real orchestration/SQLite. Real-provider after-fix and device acceptance remain unverified. The PR is labeled bugfix and remains unmerged.

juliusmarminge avatar Oct 22 '26 08:10 juliusmarminge

Data from a second provider, in case it helps prioritize #20928.

T3 Code nightlies on Windows 11 (now 0.1.9-nightly.20261110.4491). Codex and Claude parent threads hand work to Grok children. Read-only from the local statev2.sqlite (the runtime-request projection plus each thread's lineage), 2026-11-07T02:13Z to 2026-11-08T15:47Z:

  • 45 command approvals in 25 Grok threads whose lineage.relationshipToParent is subagent (13 with a Codex parent, 12 with a Claude parent). 41 were answered and 4 cancelled.
  • Wait until answered or cancelled: median 1.4 minutes, p90 171 minutes, longest 597 minutes (about 10 hours). 8 waited more than an hour.
  • For contrast, 145 approvals in 23 agent-created Grok threads with no parent link waited at most 17 minutes.

Every wait over an hour was a subagent approval. That fits what #26294 traced: the delegated-request reactor wakes a parent only for user_input requests, so the parent agent never learns that its child is blocked. Nothing in that path is specific to Claude children, so a fix there should cover command requests from every provider.

Either of these would have ended the long waits:

  • wake the parent when a child blocks on an approval, with the child link, the request kind and its age (what #20928 proposes);
  • or let the parent list its children's pending approvals read-only, so it can tell the user before it ends its turn. Today t3_pending_request does not list approvals, and task_status.pendingApproval reaches only a parent that happens to poll.

craigcossairt avatar Nov 11 '26 01:11 craigcossairt

Still present on main 4fd40e1a16. DelegatedTaskQuestionReactor skips every runtime request that is not user_input, in both its live path and its catch-up path, so a child's command approval never wakes the parent agent. The existing Orchestrator.control-reads test feeds it both a question and an approval and expects only the question to wake the parent.

To reproduce: start an async child in approval-required mode, end the parent's turn, and let the child reach a command approval. Since #28516 the approval card shows in the parent's UI, but the parent agent gets no notification and stays idle until someone looks.

#20928 was closed unmerged on November 12 with a request for a fresh PR from current main, so nothing for this is in flight now. A replacement could keep the notice advisory, without giving the parent the right to answer the approval, and drop a queued notice once the approval is resolved. #26294 was correctly closed as a duplicate of this issue.

Produced with Claude Code (Claude Opus 5.5), with Codex (gpt-6.1-sol) for research.

Dropje97 avatar Nov 12 '26 17:11 Dropje97

The fresh replacement for the approval-notification fix in closed PR #20928 is #35433, opened by Julius against main. It addresses this issue by notifying the parent agent when an asynchronous delegated child waits for a live approval. The notice remains advisory; the user still approves or declines in the app.

Lenoridev avatar Nov 12 '26 20:11 Lenoridev

Adding a cross-link to #37298 and a third provider data point (Codex) plus a nested-delegation case relevant to #35433.

The original description notes that "Codex children in the same session did not raise approvals", which is no longer true since #37104 (v0.1.10): under granular Full access with Codex CLI 0.169.0/0.170.0, delegated Codex children now frequently block on command approvals for forced rm (e.g., trap 'rm -rf "$tmp"' EXIT cleanup scripts).

From a read-only audit of local statev2.sqlite (macOS arm64, T3 Code 0.1.10, 2026-11-17–19):

  • 11 user-blocking command approvals across 9 delegated Codex subagents (gpt-6.1-sol and gpt-6.2-sol) under 7 Claude Opus 5.5 parent hierarchies, all in full-access mode, with stalls up to 22m 35s and 0 notifications delivered to any parent.
  • 2-level nesting (Root Claude → Child Claude → Grandchild Codex): 5 of those stalls happened in grandchild threads. The client UI surfaced the grandchild's approval card directly on the root thread (via the BFS descendant walk in packages/client-runtime/src/state/threadShell.ts), while both the intermediate parent and root stayed idle. Worth verifying in #35433 whether waking the direct parent (the intermediate child) behaves cleanly when the user approves directly from the root thread and cancels the queued wake.

eshatalov avatar Nov 20 '26 00:11 eshatalov

[!NOTE] 🤖 Claude Opus 5.5 responding on behalf of Elliot

A data point from 2026-11-20, Windows 11: a Codex gpt-6.1-sol child launched with runtimeMode: "full-access" (likely the #37298 path) sat on a command approval for about 35 minutes before the parent noticed. The parent got no notification; it found the approval only by calling task_status, which did show pendingApproval: { requestId, kind: "command" }.

The parent then could not see what the command was. t3_pending_request read with that exact requestId returned invalid_request: "The pending user-input request was not found.", and its description says approvals are not listed. So the parent can tell a child is blocked but not what it is blocked on, and its only option is t3_thread_send mode:"restart". A read-only view of the pending command would let the parent route it to the user, or steer the child around it.

ElliotDrel avatar Nov 21 '26 01:11 ElliotDrel

A related case on 0.1.12-nightly.20261122.5111 (Linux): a delegated Codex child calls request_secret (a sign-in card with a URL). The card shows only in the child's thread. The user is reading the parent thread and never sees it. The parent agent can't find it with t3_pending_request (list on the child thread returns no ids), so it can't point the user to it either. The card expired unanswered. The user only learned about it from the child's later report.

aleksey852 avatar Nov 25 '26 10:11 aleksey852

A related case on 0.1.12-nightly.20261122.5111 (Linux): a delegated Codex child calls request_secret (a sign-in card with a URL).

I reproduced @aleksey852’s report on Linux with T3 Code 0.1.13-nightly.20261125.5245, Codex CLI 0.169.0, and gpt-6.1-sol.

  1. Have the parent call delegate_task with mode: "async" for a local Codex child, then finish its turn.
  2. Have the child call request_secret with a sign-in label and a synthetic URL such as https://example.invalid/sign-in. Leave the card pending.
  3. Resume the parent manually and have it call t3_pending_request with action: "list" and the child's thread ID.

The server recorded a pending sign-in card on the child. The child stayed blocked, the parent received no wake, and the list call succeeded with {"requestIds":[]} while the card was still pending. This matches the list handler, which lists pending user-input requests. The sign-in card is stored separately as a timeline item.

This test verified the server state and the live tool response. It used a synthetic URL and did not exercise browser rendering or a real sign-in. The notification gap for this card is separate from the provider approvals covered by #35433.

Lenoridev avatar Nov 25 '26 18:11 Lenoridev