Skip to content

fix: open an agent turn for a subagent that finishes after the reply - #205580

Merged
vyctorbrzezowski merged 9 commits into
mainfrom
openclaw/melhorar-injecao-de-subagents-finalizados-692eb4
Nov 29, 2026
Merged

vyctorbrzezowski merged 9 commits into
mainfrom
openclaw/melhorar-injecao-de-subagents-finalizados-692eb4

Conversation

@vyctorbrzezowski

@vyctorbrzezowski vyctorbrzezowski commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Problem

If a subagent finishes after the parent has already replied, its " finished" row floats under the finished turn. It has no avatar and isn't part of any turn. The parent's work on that result then starts a separate turn below it. If the same child finishes again in the meantime, the row shows up twice.

The cause is in the Gateway's display projection. A completion that wakes the parent becomes a receipt, and that receipt kept no run id. The wake input is saved with the send key of the run it starts (<runId>:user). subagentCompletionMessage read the run id only from steerTargetRunId and runId, so the receipt belonged to no run. The UI's turn grouping then left it outside every agent frame.

A turn that opens with a row instead of text, such as a "finished" row or a tool row like "Read a.ts", also sat at the top of the avatar instead of centered on it. Text lines are centered by the bubble's top padding, but rows had no matching offset.

Change

  • subagentCompletionMessage falls back to the wake's send key. The receipt now carries the run its wake started, so the Control UI puts it at the top of that agent turn, with the avatar, followed by the parent's work and reply. This also works while the parent hasn't written anything yet.
  • History is projected when it's read, so existing transcripts are fixed too. No migration is needed.
  • A second completion from the same child that steers into that run now has the same run id, so it joins the same row. Each agent in the row is named once and shows the outcome of its latest run.
  • Completions that arrive while the parent waits on its children (a settle wake that resumes the turn) still stay in the answered block with their Resumed rule.
  • When an assistant turn with a gutter avatar opens with an activity group or tool row, that row gets top padding of (avatar − row line height) / 2, so its line is centered on the avatar. Direct threads without an avatar, reply-attributed groups and turns that open with text keep their current spacing.

Evidence

  • Gateway projection test: a wake receipt carries the run it started. It fails on main and passes here.
  • New transcript-chain test: a completion that arrives after the answer opens its own agent frame, both before and after the parent replies.
  • Render test: two receipts in a row for the same agent show one "finished" row.
  • Passing: chat-display-projection.visibility, chat-message.tools, chat-background-run-lifecycle, chat-thread-incremental, chat-pending-input-display, tsgo:ui, tsgo:core, oxlint, oxfmt and stylelint.
  • Reproduced from a real parent transcript: receipts at seq 3096, 3112 and 3068 rendered outside every agent frame. With the run id, each one joins the frame of its announce run.
  • Alignment measured in the browser: with a 36px avatar and a 21px row, the row's top used to match the avatar's top (169px for both). With this change it is at 177px, which centers it on the avatar.

Clean comparison: the parent replied to the completion

Control UI with a mock Gateway. The history was made by running projectChatDisplayMessages from each revision on the same synthetic raw transcript: a wake input saved with the announce run's send key, then the parent's reply. Before is main at aecbf92, after is this branch.

Before After
Before: the finished row floats between two turns, with no avatar After: the finished row opens the agent turn that replies to it

Annotated comparison

Before After
The finished row outside any turn highlighted The agent turn that holds the finished row and the reply highlighted

Before the parent writes anything

Before After
Before: the finished row alone, with no avatar After: the finished row as its own agent turn

Rows centered on the avatar

Same mock setup, 2× crop. Before is this branch without the CSS change, after is with it. The first turn opens with a tool row and the second with a "finished" row.

Before After
Before: the tool row and the finished row sit at the top of their avatars After: both rows are centered on their avatars

🦞 Made with OpenClaw

@clawsweeper

clawsweeper Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 25, 2026
@clawsweeper

clawsweeper Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: passed.

What this changes

This PR assigns late subagent completion receipts to their parent’s follow-up turn, combines repeated child outcomes, and aligns opening activity rows with avatars.

Example: The Composer fix subagent finishes after the parent replies, starting run announce:child-one.

  • Before: The completion floats outside the parent’s follow-up turn without an avatar.
  • After: The completion opens announce:child-one beside its avatar, followed by the parent’s response.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A useful, focused repair with visual and integration evidence; live-flow validation is limited and the CSS needs minor coordination with current main.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is exempt from the contributor proof gate; inspected browser screenshots demonstrate receipt placement using synthetic projected history and a mock Gateway, with no live completion flow established.
Patch quality 🐚 platinum hermit (4/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Late completion notices appear detached from the parent’s follow-up response, and repeated completions can name the same child twice.
Reason: The focused change restores chronological turn presentation on an existing feature, with direction established by its maintainer author.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR fixes a current display defect and resolves the previous continuation finding; one minor alignment interaction with current main remains.

Reviewed head: 93d184257d911d4705e9c1f7108d9019623efcfd

Before merge

None.

Findings

  • [P3] Avoid adding padding to completion rows already centered on main — ui/src/styles/chat/grouped.css:1129-1130
Agent review details

How this fits together

The Gateway projects private coordination inputs into public completion receipts; the Control UI combines those receipts and groups them into visible agent turns.

flowchart LR
  A[Subagent completion] --> B[Persisted wake input]
  B --> C[Gateway display projection]
  C --> D[Public completion receipt]
  D --> E[UI receipt grouping]
  E --> F[Agent turn and avatar]
Loading

Technical review

Best possible solution:

Retain the receipt identity and continuation fixes while making opening-row spacing compose with main’s existing completion alignment.

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

Current main drops the only run identity on a completion wake carrying completion-turn:user, and the inspected before screenshot shows the resulting unframed receipt.

Is this the best way to solve the issue?

The existing display projection is the appropriate repair boundary, and the UI changes preserve continuation ownership without rewriting transcripts.

Full review comments:

  • [P3] Avoid adding padding to completion rows already centered on main — ui/src/styles/chat/grouped.css:1129-1130
    When combined with current main, this selector also matches the leading completion row already centered by Control UI: keep reply headers off subagent completion notices #206312. That rule gives the grid an avatar-sized minimum height, and its inline-flex summary centers the label within it. Adding asymmetric top padding shifts the label below the avatar center—about 3.75px for a 36px avatar and 21px line—exceeding the existing browser assertion’s one-pixel tolerance. Exclude those already-centered completion rows or consolidate the alignment rule. This interaction comes from the newer main change and was not equally visible at the earlier review.
    Confidence: 0.93

Overall correctness: patch is correct
Overall confidence: 0.9

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • Run the existing chat-reply-attribution browser case and confirm the leading completion label remains within one pixel of the avatar center.
  • Run chat-background-run-lifecycle and chat-message.tools tests.
  • Run pnpm lint:ui:styles and git diff --check.
  • Inspect tool-leading and completion-leading turns with and without avatar gutters.

What I checked:

Likely related people:

  • Vyctor H. Brzezowski: Raw commit 18136c9 adds src/shared/subagent-completion.ts:74 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 18136c960eaf; files: src/shared/subagent-completion.ts)
  • Ayaan Zaidi: Raw commit 24385a2 adds ui/src/pages/chat/chat-background-run-lifecycle.test.ts:222 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 24385a20428a; files: ui/src/pages/chat/chat-background-run-lifecycle.test.ts)

PR surface

Source +35, Tests +100. Total +135 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 39 4 +35
Tests 3 105 5 +100
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 144 9 +135

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: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • 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 follows the weaker of proof and patch quality; ✨ 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-25T22:31:52.292Z sha 59523b4 :: needs changes before merge. :: [P2] Preserve the first receipt’s continuation when merging across runs

Reviewed November 28, 2026, 6:59 PM ET / 23:59 UTC (Revision 2).

@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Nov 25, 2026
@vyctorbrzezowski vyctorbrzezowski changed the title fix(ui): show an agent that settles twice in a row once fix: open an agent turn for a subagent that finishes after the reply Nov 25, 2026
@clawsweeper clawsweeper Bot removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Nov 25, 2026
@vyctorbrzezowski vyctorbrzezowski self-assigned this Nov 28, 2026
@vyctorbrzezowski
vyctorbrzezowski marked this pull request as ready for review November 28, 2026 23:37
@vyctorbrzezowski

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀

Re-review progress:

@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 29, 2026
@vyctorbrzezowski
vyctorbrzezowski merged commit d0c74cf into main Nov 29, 2026
31 of 32 checks passed
@vyctorbrzezowski
vyctorbrzezowski deleted the openclaw/melhorar-injecao-de-subagents-finalizados-692eb4 branch November 29, 2026 17:53
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
…205580)

* fix(ui): show an agent that settles twice in a row once

* fix(ui): show an agent that settles twice in a row once

OpenClaw-Publication: 0b5d0508-3076-45a8-9d57-01a205a74095

* fix: open an agent turn for a subagent that finishes after the reply

* Publish openclaw/melhorar-injecao-de-subagents-finalizados-692eb4

OpenClaw-Publication: fb01d441-86e1-41aa-ad00-55a70796e260

* fix(ui): center a turn that opens with a tool or agent row on its avatar

* Publish openclaw/melhorar-injecao-de-subagents-finalizados-692eb4

OpenClaw-Publication: c53b05d8-26b9-447f-8341-e75805d815c7

* fix(ui): retain continuation on merged subagent receipts

* fix(ui): center leading subagent completion rows

(cherry picked from commit d0c74cf)

Release adaptation: Keep the release chat fixture location and add the consecutive same-session receipts regression there, without duplicating its separate interrupted-tracking fixture.

Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 30, 2026
…penclaw#205580)

* fix(ui): show an agent that settles twice in a row once

* fix(ui): show an agent that settles twice in a row once

OpenClaw-Publication: 0b5d0508-3076-45a8-9d57-01a205a74095

* fix: open an agent turn for a subagent that finishes after the reply

* Publish openclaw/melhorar-injecao-de-subagents-finalizados-692eb4

OpenClaw-Publication: fb01d441-86e1-41aa-ad00-55a70796e260

* fix(ui): center a turn that opens with a tool or agent row on its avatar

* Publish openclaw/melhorar-injecao-de-subagents-finalizados-692eb4

OpenClaw-Publication: c53b05d8-26b9-447f-8341-e75805d815c7

* fix(ui): retain continuation on merged subagent receipts

* fix(ui): center leading subagent completion rows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui gateway Gateway runtime impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S 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