Skip to content

fix: stop repeated browser replies after background child work - #166362

Merged
shakkernerd merged 1 commit into
mainfrom
fix/exec-reply-route
Oct 7, 2026
Merged

shakkernerd merged 1 commit into
mainfrom
fix/exec-reply-route

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #166344.

What Problem This Solves

A background command can resume a browser conversation, delegate a private child, and yield while that child finishes. The parent's final answer appears in the chat, but the completion record rejects it and starts another synthesis turn, producing repeated answers without another user message.

The failure comes from the internal wake sender being copied into the reply destination. Child work then inherits {to: "heartbeat"} without a channel, which the completion classifier correctly treats as an unresolved destination.

User Impact

Browser continuations retain their session-only reply destination, so the parent can complete its owed final answer once. Resolved external channel destinations still carry their account and thread context, and unresolved external delivery continues to require evidence. Private child output, intentional silence, and cancellation or replacement checks retain their existing behavior. No configuration or data migration is required.

Why This Change Was Made

The heartbeat execution context now takes To from the resolved delivery destination and respects the existing originating-context suppression. From continues to identify the wake sender. This corrects the value before the shared tool context passes it to child spawning, rather than adding destination exceptions in the completion classifier.

Two existing tests now check the absent browser destination and the resolved Slack destination. The implementation changes one assignment; the real Gateway/browser recorder remains a task-specific proof fixture.

Evidence

An isolated Linux Gateway and its served Control UI reproduced the original behavior with a loopback Responses provider. Exec completion, child spawning, yield, transcript publication, and settlement all used the normal runtime. The browser retained two identical finals after reload; the provider recorded one child and two settlement requests. A Node debugger observation at the actual classifier call showed a successful visible terminal reply rejected solely with the malformed destination. The owner regression also failed on the original To: "heartbeat" value.

Remote validation passed on the candidate: all 45 selected static checks, all selected production and test type graphs, the selected plugin-boundary compile/canary, the full runtime build, 805 Node tests across 66 files, 78 mocked UI tests across 23 files, and the browser-extension E2E. The Node batch retained one existing Mac-only APFS skip. The trusted private-key scan and production dependency audit also passed. Independent source review and repository autoreview found no actionable defects in their scopes.

Single-worker commands pnpm test <file> --maxWorkers=1 took 30.88 seconds for heartbeat-runner.sender-prefers-delivery-target.test.ts and 102.64 seconds for heartbeat-runner.webchat-exec-completion.test.ts. The latter's existing 23 cases exercise real dispatcher and SQLite publication, visibility, silence, replacement, and event retention; their case count and fixture runs are unchanged.

The integrated real Gateway/browser scenario passed on the candidate combined with main: one child, one settlement request, and one final reply before and after reload. The actual classifier accepted the visible reply; child delivery ended as delivered and its pending wake was removed. Required CI passed, and ClawSweeper awarded Platinum with no findings on the exact PR head.

Visual evidence

Open preview

Before After
Two duplicate final replies after reload One settled final reply after reload

Background completion, child yield, and one final reply

proof.webm

Visual verification

  • Baseline: dd61952
  • Exact head: 69d6e071b9ac5c7181b318d0ccab9effd9e04fa3
  • Scenario: A browser conversation resumes after exec completion, starts one private child, yields, and publishes its final reply. Reload confirms the settled history.
  • Runtime/build: Linux isolated Gateway and served Control UI; candidate composed with main 3b6b191; executed tree daa935817c0c53bc4c43697143d31d3025727bfe; synthetic loopback Responses provider.
  • Final replies after reload: 2 before; 1 after
  • Settlement requests: 2 before; 1 after; one child in both runs
  • Completion result: Visible reply accepted; delivery marked delivered; pending wake removed
  • Real exec completion, child spawn, yield, transcript and settlement paths exercised.
  • Matching 1440 x 1000 dark browser viewport. Branch badge, upstream composer spacing and elapsed durations differ between builds.
  • Classifier inspected at its actual runtime call; unresolved external destinations remain covered by existing tests.

@clawsweeper

clawsweeper Bot commented Oct 7, 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 P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 7, 2026
@clawsweeper

clawsweeper Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 6, 2026, 8:30 PM ET / October 7, 2026, 00:30 UTC.

ClawSweeper review

What this changes

The PR preserves the actual reply destination when background work resumes a conversation and strengthens existing browser and Slack regression checks.

Merge readiness

✅ Ready for maintainer review

This repair remains necessary: current main and the latest release retain the faulty destination assignment. The introduced change addresses the source-supported cause without weakening completion classification; no actionable patch defect was found.

Priority: P1
Reviewed head: 69d6e071b9ac5c7181b318d0ccab9effd9e04fa3

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused producer repair with useful existing-boundary regressions and no identified correctness or security defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The author is a MEMBER, so the external-contributor proof gate does not apply. The captured body establishes the reported pre-fix Gateway/browser scenario and candidate test validation, but does not yet establish the promised after-fix browser result. No stored-data format or migration contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The author is a MEMBER, so the external-contributor proof gate does not apply. The captured body establishes the reported pre-fix Gateway/browser scenario and candidate test validation, but does not yet establish the promised after-fix browser result. No stored-data format or migration contract changes.
Evidence reviewed 9 items Pinned introduced repair: The introduced production hunk replaces To: sender with the resolved delivery destination under the existing originating-context suppression. From, account, thread, and delivery classification remain unchanged.
Current main still needs the repair: Fetched main still assigns sender to To. Comparing the verified test merge against its recorded main parent shows the same focused repair, with no removal of base-only behavior.
Latest release retains the assignment: The v2026.9.8 source also contains To: sender; this requested repair is not already present in the supplied latest release.
Findings None None.
Security None None.

How this fits together

The heartbeat runner resumes conversations after background commands finish. Its reply context feeds child spawning and completion settlement, which determine whether a final answer has satisfied the conversation’s delivery obligation.

flowchart TD
  A[Background command finishes] --> B[Heartbeat runner]
  C[Conversation delivery route] --> B
  B --> D[Reply context]
  D --> E[Private child work]
  E --> F[Parent final answer]
  F --> G[Completion settlement]
  G --> H[Complete or retry]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source 0, Tests +14. Total +14 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 1 1 0
Tests 2 18 4 +14
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 19 5 +14

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #166344
Summary: This PR is the explicitly linked candidate repair for the open browser continuation issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep reply destinations faithful to the resolved conversation route while preserving the existing evidence requirements for external delivery.

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

Yes: the linked report gives a precise Gateway/browser sequence, and current-main destination propagation and settlement classification support its failure mechanism. This review did not run the sequence.

Is this the best way to solve the issue?

Yes: correcting the destination at the heartbeat context producer is narrower than adding classifier exceptions and retains unresolved external-delivery safeguards.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P1: The linked report establishes a browser agent workflow that repeats final answers without another user message.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The author is a MEMBER, so the external-contributor proof gate does not apply. The captured body establishes the reported pre-fix Gateway/browser scenario and candidate test validation, but does not yet establish the promised after-fix browser result. No stored-data format or migration contract changes.

Label justifications:

  • P1: The linked report establishes a browser agent workflow that repeats final answers without another user message.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The author is a MEMBER, so the external-contributor proof gate does not apply. The captured body establishes the reported pre-fix Gateway/browser scenario and candidate test validation, but does not yet establish the promised after-fix browser result. No stored-data format or migration contract changes.

Evidence

What I checked:

  • Pinned introduced repair: The introduced production hunk replaces To: sender with the resolved delivery destination under the existing originating-context suppression. From, account, thread, and delivery classification remain unchanged. (src/infra/heartbeat-runner-run.ts:80, 69d6e071b9ac)
  • Current main still needs the repair: Fetched main still assigns sender to To. Comparing the verified test merge against its recorded main parent shows the same focused repair, with no removal of base-only behavior. (src/infra/heartbeat-runner-run.ts:80, eaf3a178599c)
  • Latest release retains the assignment: The v2026.9.8 source also contains To: sender; this requested repair is not already present in the supplied latest release. (src/infra/heartbeat-runner-run.ts:80, fc23bc864e45)
  • Destination propagation: Embedded tool context uses OriginatingTo ?? To as messageTo. Agent tool assembly passes messageTo as agentTo, and the native child planner normalizes agentTo into requesterOrigin.to. An absent browser destination therefore previously inherited the synthetic heartbeat sender. (src/auto-reply/reply/agent-runner-utils.ts:290, 69d6e071b9ac)
  • Completion safeguards remain intact: The unchanged classifier accepts transcript-visible successful output for channel-less origins only when their destination is absent. Existing yielded-settle tests reject undelivered external text, failed turns, and replaced requesters. The patch fixes the producer instead of relaxing these checks. (src/agents/subagents/announce/subagent-announce-direct-response.ts:291, 69d6e071b9ac)
  • Existing owner-boundary regressions: The browser test now checks absent external destination fields while exercising the existing dispatcher and SQLite publication fixture. The Slack test checks the resolved channel destination and actual transport target. Neither change adds cases, runtime fixtures, or production test seams. (src/infra/heartbeat-runner.webchat-exec-completion.test.ts:221, 69d6e071b9ac)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • Marvinthebored: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@shakkernerd
shakkernerd merged commit 513871f into main Oct 7, 2026
130 checks passed
@shakkernerd
shakkernerd deleted the fix/exec-reply-route branch October 7, 2026 00:48
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: browser conversations no longer repeat final replies after background work delegates and yields.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 7, 2026
…w#166362)

Preserve browser reply destinations when background completion delegates and yields, so the final reply settles once.

Fixes openclaw#166344.
RomneyDa pushed a commit that referenced this pull request Oct 11, 2026
Preserve browser reply destinations when background completion delegates and yields, so the final reply settles once.

Fixes #166344.

(cherry picked from commit 513871f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

Browser exec continuations repeat final replies after private child work

1 participant