Skip to content

fix(agents): preserve WebChat native subagent continuation - #188526

Open
dubr1k wants to merge 3 commits into
openclaw:release/2026.10.10from
dubr1k:fix/10.10-webchat-completion-origin
Open

dubr1k wants to merge 3 commits into
openclaw:release/2026.10.10from
dubr1k:fix/10.10-webchat-completion-origin

Conversation

@dubr1k

@dubr1k dubr1k commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes #188524

Related: #153354

Targets release/2026.10.10. The WebChat scope argument still exists on this branch; main retired it in #181851. The catalog-continuity change is also submitted separately for main: #188698.

What Problem This Solves

Fixes native child completions losing their initiating WebChat context and replacing the parent thread before it can follow up with the same child.

User Impact

WebChat users can receive an automatic child completion and continue with that child while keeping the same native parent thread and accepted tools, including when the session has saved external delivery history. No outbound recipient, configuration, or migration is added. Duplicate visible completion replies remain outside this fix.

Why This Change Was Made

Two existing boundaries need to remain connected. First, pass the normalized WebChat-only origin to the existing host-issued completion scope. Explicit channel precedence and the other channels' behavior are preserved.

Second, the last child's completion releases live-child execution protection before delivery. The existing catalog-recovery guard then misses that automatic continuation. Let the existing completion-delivery owner identify its exact in-flight parent/child/session/run/client custody and recover the native thread's accepted catalog for that delivery. Recheck that custody after awaited metadata reads. Keep runtime, home, transport, catalog fingerprints, current tool-execution authority, and ordinary-turn behavior intact. This is a bounded completion-lifetime fix, rather than the older deployment workaround that weakened runtime matching.

Published 2026.10.10: release maintenance scope

The release notes include #174900 for native catalog continuity and #181204 for busy-thread fallback classification. This PR builds on the former and does not duplicate the latter. Two gaps remain in the published tag:

  • The completion-scope call still omits requesterOrigin, losing the initiating WebChat context.
  • The native catalog guard still requires live-thread protection, which has already ended when the last child's completion is delivered. This leaves that automatic continuation outside the upstream catalog recovery path.

This PR joins those two boundaries for WebChat continuation. The catalog-only main-line submission is #188698. The remaining busy session-retirement correction is separate in #188640; JSONL backup restoration is separate in #188522. Since 10.10 has now shipped, this remains a release-maintenance candidate rather than a claim that these changes were included in the release. Main retired the WebChat scope argument in #181851, so the release-specific hunk should not be applied to main mechanically.

Evidence

Additional published-release check — November 3, 2026

The WebChat and completion-catalog changes were selectively ported to official 10.10 packages, alongside the separate retirement correction from #188640. All 50 focused checks for the combined port passed. On both macOS and Linux, a real-model authenticated WebChat run completed parent → child → automatic completion → same parent → follow-up to the same child, with the same parent thread and physical client, the remembered child marker, and settled shipped-CLI history. Linux also executed session_status after completion. Each run produced one visible final success reply; that observation does not establish an exactly-once delivery guarantee.

This is additional evidence from the installed combined port, not a new exact-head run of this PR. Native metadata was inspected after the runs without an independent before-run snapshot. Downstream native-dispatch denial and custody-reassignment proof remain incomplete. Historical exact-head checks, inherited failures, and prior duplicate-reply observations remain below and are not relabeled as current proof.

  • The existing dispatcher fixture fails on the base in the three WebChat cases and passes with the origin fix. Its 39-test dispatcher, completion SDK, and requester-settle routing set passes, covering normalization, alias handling, explicit-channel precedence, and channel-only output without an external target.
  • Completion-owner and catalog-loader regression cases are red before their respective production changes and green afterward. The release catalog scope's 41 focused tests pass, including current execution authority and related continuity consumers.
  • Core and Codex production/test typechecks, targeted lint/format, and git diff --check pass. Existing catalog regression cases grow by 118 net test lines, without additional fixture launches or a shared test-ceiling increase.
  • Shared autoreview against release base 06d598c818155a5ac6ad00c9611bbb4b6ed57d45 found no actionable P0–P2 findings for the WebChat delta and, separately, the complete release catalog delta and owner/authority context. The reviewed catalog delta was applied unchanged on top of the WebChat commit. Tests were executed separately, not by the reviewer.
  • pnpm build:runtime passes on exact combined head 12d7d8d051888503b68a4ce3ff1bd73ca2f63945 (53.1 s). A real-model authenticated WebChat run on that source/build completes parent → child → automatic completion → parent continuation → follow-up to the same child. The parent and physical client stay the same through both resumptions; the child returns its remembered marker; all 44 accepted functions and the canonical native metadata digest remain unchanged. Shipped CLI history confirms the visible result, preserved synthetic Telegram context/origin, and settled session.
  • Full local Codex extension lane on the code-identical catalog candidate: 5,057 passed, 3 failed, 1 skipped, across 433 executed files (512.52 s). The three previously reproduced baseline macOS failures are the nonempty Git identity expectation in thread-shell-environment.native.test.ts and two process-inspection permission errors in transport-startup.test.ts. This full lane is not claimed as passing; no assertions, timeouts, retries, skips, or expected-failure settings were weakened. The separate WebChat delta is covered by the dispatcher/core checks above and current-head CI.

Updated release base and isolated Linux verification (2026-10-31)

Current head: 92bc37d0739f288b25d1f9fc90081c68ee0c5d98. Merged release base 6b96f139020b581adecfde84736331a710492c31 specifically to remove the inherited missing-helper CI failure described below. Upstream #188809 (a1dbc50ba87819f2a42e8e554187898a59584571) supplies test/helpers/gateway-startup.ts; its SHA-256 in this candidate exactly matches the repaired release base (125a2b72ce8bcdcebf04dd323f90728778a711cc3893a0b62229093b758b32dd). No local stub, check suppression, baseline relaxation, or failure exception was introduced.

Independent read-only review found no actionable integration findings: the PR's same ten-file delta and added/removed lines are preserved relative to the new base, including the newer release Stop/process-cleanup ownership. The merge is conflict-free and git diff --check passes.

On a fresh isolated Linux checkout with Node v24.22.1 and pinned pnpm 12.15.0, pnpm build:runtime passes (8m23.3s), and pnpm openclaw --help passes using task-owned state/config paths. No operator Gateway, installed package, live service or production data was changed. Dependency-bundler warnings about direct eval in third-party web-tree-sitter remain warnings, not a clean-warning claim.

The real-model continuity trace below remains evidence from its stated prior head 12d7d8d; it was not rerun or relabeled as fresh live proof after the base merge. Fresh hosted CI for the new head is in progress and is not yet claimed passing.

Historical CI failure on the previous head

Historical CI on the previous head 12d7d8d: all jobs completed. The remaining failure is check-test-types-core-5, with TS2307 for ../../test/helpers/gateway-startup.js at src/gateway/server.required-placement-scopes.test.ts:5; the aggregate gate also fails. The runner checked merge f75e317e8cfe8816df932b2da73952600414e38c, whose first parent is the newer release base f47d762e6fbc30950bbb81a18d4a5eec22e76f6a from #188692. That base already imports the missing helper. Its test blob and the merge's test blob are identical (bb91488e5808fe5b86d39e119e2aad6f2b5a762f), and the helper is absent from the base tree. The original release base and this PR's own head do not contain that import. pnpm test:ci-failed 188526 initially calls this job new relative to main, without comparing the selected scope; the exact release-base source comparison above establishes the inherited omission. The remaining CI blocker is in the updated release base. No rerun or unrelated source change was used to hide it.

This exact-head live run supersedes the earlier routing-only probe that rotated the parent. It used Node 24.22.1 and Codex 0.164.0, one original request, isolated synthetic state, a synthetic non-recipient Telegram history with no external channels configured, and disabled model fallbacks. Two child completion announcements produced two identical final replies. The proof qualifies the requested routing/thread/catalog/child continuity; it does not qualify exactly-once visible delivery or general fallback behavior. CI and bot reviews of the prior head apply only to that prior head.

Sanitized exact-candidate runtime proof
Exact-candidate real WebChat catalog-continuity proof
Source/build commit: 12d7d8d051888503b68a4ce3ff1bd73ca2f63945
Runtime: Node v24.22.1; workspace-pinned Codex 0.164.0.
Environment: isolated synthetic session, authenticated WebChat client, no external channels configured. Existing Telegram delivery history used a synthetic non-recipient. Model fallbacks were disabled.

One chat.send request was accepted. No manual continuation or retry was sent.
Initial native parent: 01a18e8d-a149-7c10-915d-f1e3bfa2b778
Native child: 01a18e8d-cd4c-7632-9f18-446d7adc82a0 (agent target /root/catalog_child)
Parent thread_ready events: started, resumed, resumed; all used the same parent and physical client.
Parent native transcript: exactly one spawn_agent and one followup_task to that same child.
Child terminal results: FIRST_READY; then FOLLOWUP_OK CATALOG_MEMORY_110.
Accepted native catalog: 7 top-level declarations / 44 functions.
Accepted catalog fingerprint before/after: sha256:eeffd1a561be4d614c6a715154aa3ae3d3679f341bf58ae744401b327cdb9b3f
The retained binding still identifies the same parent, client, and accepted catalog. Canonical native metadata digest was unchanged before and after both automatic continuations.

Shipped CLI verification:
  OPENCLAW_STATE_DIR=<isolated-state> OPENCLAW_CONFIG_PATH=<isolated-config> pnpm openclaw gateway call chat.history --params '{"sessionKey":"agent:main:catalog-chain-proof","limit":100}' --json
Result: same logical session; visible CATALOG_CHAIN_OK /root/catalog_child; saved Telegram context/origin retained; hasActiveRun=false; pendingInputs.total=0.

Observed limitation: the two child completion announcements produced two identical visible CATALOG_CHAIN_OK replies. This run proves the requested catalog/thread/child continuity, not exactly-once visible replies or general fallback behavior. Inherited parent history in the child's rollout was not counted as another spawn.

Cleanup: the client exited successfully; the task-owned Gateway stopped cleanly after settlement; its listening port is closed. No production services or data were used.

@clawsweeper

clawsweeper Bot commented Oct 30, 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.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS labels Oct 30, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head 12d7d8d051888503b68a4ce3ff1bd73ca2f63945, but the PR head is now 92bc37d0739f288b25d1f9fc90081c68ee0c5d98. Its old verdict and PR readiness labels are no longer current.

Next step
Comment @clawsweeper re-review when the current head is ready; pushes after the first review are not reviewed automatically.

Review history (3 earlier review cycles)
  • reviewed 2026-10-30T16:50:30.427Z sha deeb167 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-30T19:47:29.689Z sha deeb167 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-30T21:16:58.032Z sha 12d7d8d :: blocked before merge. :: none

@dubr1k

dubr1k commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added 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. 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 rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 30, 2026
@dubr1k dubr1k changed the title fix(agents): preserve WebChat context for native subagent completions fix(agents): preserve WebChat native subagent continuation Oct 30, 2026
@dubr1k

dubr1k commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

The current head 12d7d8d now includes the narrowly scoped completion-catalog fix as well as the WebChat-origin repair. The main-line catalog PR is #188698. The updated body contains exact-head, real-model proof of the complete parent → child → completion → parent continuation → follow-up to the same child, with the parent/client/catalog preserved and the observed duplicate-reply limitation explicit.

CI has finished. Its only failing leaf is the missing gateway-startup helper import introduced into the newer release base by #188692; the aggregate gate consequently fails. I traced the checked merge f75e317 to release parent f47d762 and verified that the failing test has the identical blob in both, while the helper is absent from the base. The body links the exact job and records that evidence. The changed-path tests, builds, and other checks passed.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 30, 2026
@clawsweeper clawsweeper Bot removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. labels Nov 2, 2026
@dubr1k

dubr1k commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Published 10.10 follow-up: I updated the description to distinguish the release's existing #174900 catalog recovery and #181204 busy-thread correction from the two remaining gaps here: omitted WebChat origin and catalog recovery after the last child's execution protection ends. Exact published-tag links and the main-line counterpart #188698 are included.

A selective port to official 10.10 packages completed the real parent/child/completion/same-child-follow-up flow on both macOS and Linux. The body labels this as combined installed-port evidence and retains the original exact-head results, broader test failures, duplicate-delivery limits, and remaining denial/reassignment proof gap. Since 10.10 has shipped, please consider this for release maintenance; the WebChat hunk remains branch-specific. This description update does not change head 92bc37d0739f288b25d1f9fc90081c68ee0c5d98 or claim that the stale prior-head review is current.

This branch has not been deployed

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

Labels

agents Agent runtime and tooling extensions: codex P2 Normal backlog priority with limited blast radius. size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant