Skip to content

fix: tell an idle parent when a child result couldn't reach its chat - #208772

Merged
obviyus merged 6 commits into
mainfrom
fix/subagent-completion-visible-giveup
Nov 30, 2026
Merged

obviyus merged 6 commits into
mainfrom
fix/subagent-completion-visible-giveup

Conversation

@obviyus

@obviyus obviyus commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

A child's completion that no parent turn consumes settles at once as a hidden, model-visible status entry in the parent's history (#204178). The parent model reads that entry on its next turn and decides what to tell the person.

When no parent turn is running, nothing else wakes the parent, so the person never learns that the child finished. One example is a parent whose completion turn was refused before it started by its access-program check.

  • Production, one Gateway, 14.7 h: 85 of 91 refused completions settled this way within 2 s.
  • 14 parent sessions never ran again, and their people saw nothing.

Reproduced on main with a real Gateway (local fake provider, the real OpenAI route through a managed proxy):

  • A parent bound to a managed worktree spawns a child. The child finishes, and the parent's completion turn is refused before start.
  • The parent chat shows nothing after the parent's own tool turn. The hidden entry holds the child's result.
  • 3/3 runs.

Solution

This adds one notice on top of #204178 and changes nothing else in it.

appendChildStatusToRequester is the single owner that every undelivered child completion passes through: the requester-settle batch, the announce give-up, media-queue recovery and the legacy suspended-row sweep.

  1. It writes the hidden status entry exactly as before. The result stays hidden.

  2. Then, only if no turn is running on the parent's own session, it writes ONE separate displayed line:

    Child "" finished, but its result couldn't reach this chat: . Send a message to continue.

How "no parent turn consumed the hidden row" is decided at the owner:

  • The owner runs only on give-up. Children whose input a parent turn already consumed, and delivered children, never reach it.
  • At the moment of give-up, isSessionRunActive(<parent session id>) is checked.
    • Running: that turn reads the entry on its next model call, so no line is written.
    • Not running: nothing will read the entry until the person sends a message, so the line is written.
  • The check uses the physical session id, so another agent's session that shares a raw key such as global does not hide the line.

What the line is:

  • It is display: true, excludeFromContext: true. The model context is unchanged, and the line carries no result.
  • It is deduped by the same status id.
  • No retry, timer or new state is added.
  • formatAnnounceDeliveryError no longer repeats the delivery error as a direct-primary: phase, so the reason in the line reads once.

User Impact

  • Idle Control UI and task parents: when a child's result cannot reach the parent, the chat shows one short line with the reason. Sending a message lets the parent read the result.
  • Running parents, delivered completions and channel parents: unchanged. The fix: tell the user when a finished subagent's report can't start in their chat #207194 channel notice stays as it is, and the line is a history row that is not sent to the channel.
  • Accepted edge: while the cause persists, the person's next message can be refused too. An access-program refusal is fixed separately.
  • Accepted edge, not coded: a give-up that lands after a running parent turn's last model call gets no line, and the next turn reads the entry. This is rare: a completion for a running parent normally joins that turn.

Evidence

  • subagent-child-status-history.test.ts:
    • Red on the merge base, green here:
      • an idle parent gets exactly one line after a settle-path give-up, and after an announce-path give-up, with the label and the reason;
      • no displayed row contains the child's result, and the result is still in the hidden entry;
      • another agent's running session with the same raw key does not hide the line.
    • Green on both:
      • a running parent gets no line; making the check key-scoped or removing it turns this or the shared-key case red;
      • a delivered completion writes neither row;
      • the existing entry, budget, compaction and mid-turn tests pass, which shows the line stays out of the model context.
  • Real Gateway, F3 (a refused completion into an idle managed-worktree parent): merge base 3/3 with no line; this branch 3/3 with the line shown and the result kept only in the hidden entry. Before/after screenshots are below.
  • Tests that import the changed modules, and the delivery and settlement suites: 26 files green. One case, subagent-completion-replay.test.ts "does not replay an announcement settled in requester history", failed once inside the 25-file batch under host load, with a residual root at teardown (28.6 s instead of about 4 s). It passes alone on this branch and on the merge base.

The system-cancelled completions on one production Gateway (deploy window, exact scorecard rows)

None would get the line; all end delivered:

  • 6 pause wakes (requester-settle … :pause): yield acknowledgements, not child results. Paused children never reach the give-up owner, and the results arrived later through normal completions.
  • 3 expired announces (announce:v1, one parent): all three expired while the parent's own run was auto-compacting (17:56:29 start, 17:57:43 "succeeded; retrying prompt"; the third during the retried prompt). That run was active, so no line; its retried model call read the hidden entries written at +0 s.

Before: nothing in the idle parent's chat after a refused child completion
After: one line with the reason; the child's result stays hidden

When a child's completion turn cannot run in its parent (for example, the
parent's access program check refuses it), the result settles into the
parent's history. That entry was hidden from the chat, so a parent that
never ran again left the person with nothing. Show it as a chat row with
the delivery reason and the child's result; the model still reads it once.
@clawsweeper

clawsweeper Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Pull request received.

ClawSweeper review complete

ClawSweeper finished reviewing this revision.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: S labels Nov 30, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 30, 2026
…arent

Ayaan approved one notice on top of #204178: the status entry stays hidden and
model-visible, and an idle requester's chat gets one chat-only line naming the
child and the reason. A running requester turn reads the entry, so it gets none.
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 30, 2026
@clawsweeper

clawsweeper Bot commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: passed.

What this changes

This PR displays otherwise undelivered child results in the parent chat, together with the recorded delivery reason.

Example: The child “Fix the parser” returns “PARSER FIXED,” but the parent's completion turn is refused before starting.

  • Before: The result remains in hidden parent history and may never reach the person.
  • After: The parent chat displays the refusal reason and “PARSER FIXED.”

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused repair with directly relevant before/after UI proof, production-owner regression coverage, and no identified defects.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected Control UI captures show the changed history writer's result through a real Gateway with a local fake provider: the refused completion becomes a visible reason-and-result row. Compatibility is a verified no-migration case using the existing custom-message display field and append format.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A finished child's answer can remain invisible indefinitely when the parent's completion turn cannot start.
Reason: The maintainer-authored direction addresses an evidenced silent failure and explicitly explains the earlier visibility decision it reverses.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current silent-result failure through the existing completion-history owner; no blocking defects were found.

Reviewed head: ad8c3dd8a5f25d2080ee92c3560b379c16d2cfa4

Before merge

None.

Findings

None.

Agent review details

How this fits together

Subagent completion settlement receives undelivered child outcomes and appends a bounded entry to the requester transcript, which supplies chat history and subsequent model context.

flowchart TD
  A[Child finishes] --> B[Completion delivery]
  B --> C[Parent consumes result]
  B --> D[Undelivered result]
  D --> E[Existing history settlement owner]
  E --> F[Displayed parent chat row]
  E --> G[Parent model history]
Loading

Technical review

Best possible solution:

Keep the existing settlement owner and display its bounded fallback entry when no parent turn consumed the child result.

Do we have a high-confidence way to reproduce the issue?

Current-main source preserves the hidden-row failure, and the supplied Gateway reproduction and before screenshot establish its user-visible effect; this read-only review ran no target code.

Is this the best way to solve the issue?

The patch repairs visibility at the shared producer while retaining consumed-result exclusion, deduplication, cleanup ordering, and the existing text budget.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7c283371809c.

Provenance checked

  • Fallback completion-history visibility changes intended behavior with a stated reason (cded11f: The earlier repair hid raw child-result rows so the parent could present the outcome; this PR documents the case where that parent turn never happens.)
  • Delivery-error phase diagnostics keeps the original intent (unknown: The lifecycle consolidation preserved delivery diagnostics; the exact earlier origin remains unknown because local git show encountered a missing historical object.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit cded11f adds src/agents/subagents/completion/subagent-completion-admission.store.ts:126 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: cded11f81d55; files: src/agents/subagents/completion/subagent-completion-admission.store.ts)
  • Peter Steinberger: Raw commit 5724f95 adds src/agents/subagents/completion/subagent-completion-admission.store.ts:110 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5724f9518219; files: src/agents/subagents/completion/subagent-completion-admission.store.ts)
  • Vincent Koc: Raw commit d95d852 adds src/agents/subagents/completion/subagent-completion-admission.store.ts:124 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: d95d852e054f; files: src/agents/subagents/completion/subagent-completion-admission.store.ts)

PR surface

Source +10, Tests +83, Docs +2. Total +95 across 10 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 21 11 +10
Tests 7 91 8 +83
Docs 1 10 8 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 122 27 +95

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall readiness starts with the lower of the proof and patch scores. It is capped at 3/6 if the fix is partial, the change offers little benefit, a product decision is still open, or the PR reverses an earlier decision without saying why. ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 29, 2026, 11:00 PM ET / November 30, 2026, 04:00 UTC.

@obviyus obviyus changed the title fix: show an undelivered child result in the parent chat fix: tell an idle parent when a child result couldn't reach its chat Nov 30, 2026
@obviyus

obviyus commented Nov 30, 2026

Copy link
Copy Markdown
Collaborator Author

Maintainer override: checks-fast-baseline-ratchets / mock-exports is red because of main, not this PR.

  • The failure: ui/src/pages/channels/channel-settings-presentation.transport.node.test.tsx:25 mocks ../../plugins/control-ui-settings-distribution.ts without importOriginal or a mock-isolation note.
  • That mock came from fix: keep channel edits when closing settings #208738 (1d0f6c25, merged to main 2026-11-30). It is not in this branch; PR CI checks the merge with current main.
  • This PR changes no UI file. Its own ratchet (session-identity) is green on head 484b86a.

@obviyus
obviyus merged commit affa804 into main Nov 30, 2026
135 of 139 checks passed
@obviyus
obviyus deleted the fix/subagent-completion-visible-giveup branch November 30, 2026 05:23
@obviyus

obviyus commented Nov 30, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as affa804. The hidden child-status entry is unchanged; an idle parent now gets one short line when a child result cannot reach its chat. The red ratchet came from main (see the comment above).

vincentkoc added a commit that referenced this pull request Nov 30, 2026
* commit 'b21f557c8fa038ebc1842e204e356eb063aea4c6': (46 commits)
  test(ui): keep real exports in the channel settings distribution mock (#208855)
  test(normalization): preserve inline code in quoted previews (#208857)
  fix(ci): restore adaptive priors across large repository trees (#208838)
  test(agents): cover typography preservation in patch updates (#208851)
  fix(ci): wait for selected agent during model setup proof (#208847)
  fix: keep Telegram topic messages out of Home’s chat history (#208778)
  fix(worktrees): name the session to restore and say agents can't (#208828)
  fix: tell an idle parent when a child result couldn't reach its chat (#208772)
  fix: keep the provider search focused when accounts load (#208780)
  fix(clawrouter): respect permitted speeds on model fallback (#208830)
  fix(ui): show provider rejection details without Markdown escapes (#208829)
  fix: make the cloud worker deletion test reliable across reconnects (#208812)
  fix(update): preserve preparation lock ownership (#207139)
  chore(release): update appcast for 2026.11.12 (#208820)
  fix(android): Talk does nothing when mic access is permanently denied (#206609)
  test(config): preserve media model primaries across repeated edits (#208837)
  fix(browser): use the mock keychain for new headed macOS profiles (#208814)
  fix: start source workers without synchronous filesystem reads in the caller (#208789)
  refactor(ios): stop loading retired Overview data (#208795)
  perf(knowledge): stop repeating write-input schemas in batch and correct tools (#208617)
  ...
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 impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant