Skip to content

fix(auto-reply): deliver embedded fallback replies after CLI failures - #121897

Merged
joshavant merged 17 commits into
mainfrom
joshavant/issue-121605-20260810t171350z-2a4019a1
Aug 11, 2026
Merged

joshavant merged 17 commits into
mainfrom
joshavant/issue-121605-20260810t171350z-2a4019a1

Conversation

@joshavant

Copy link
Copy Markdown
Collaborator

Closes #121605

What Problem This Solves

Fixes an issue where a successful embedded fallback after a CLI-backed primary failure could produce a short assistant reply but never deliver it to the source channel.

Why This Change Was Made

The repair separates stable source constraints from runtime-derived delivery ownership. CLI prompt bytes stay session-stable, while embedded delivery mode and model-visible guidance are finalized only after hook, route, auth, transport, and harness preparation. Internal ownership state is stripped before plugin handoff, and later prompt additions such as post-compaction context are preserved.

User Impact

Users in direct source chats receive the reply produced by a successful embedded fallback after a CLI failure. Explicit message-tool modes, privacy-sensitive room/group paths, rejected sends, and normal CLI or embedded delivery retain their existing behavior.

Evidence

  • Fresh pre-fix reproduction confirmed the fallback produced an answer while source delivery remained suppressed.
  • Exact reviewed head: 18b185e3003f35fe824aefd9b804f24c15721bda.
  • Composed fallback and dispatch proof: 346/346 passing, including the real block-delivery handler and both prepared-ownership directions.
  • Prompt, compaction, plugin-boundary, CLI-session, privacy, recovery, and rejection sibling suites passed; the final independent verifier and adversarial falsifier reported no findings.
  • The reset-heavy composed test now runs in its canonical dedicated embedded overflow-compaction owner: former contaminating pair 69/69, dedicated owner 8/8 twice, routing/config/CI-plan 302/302.
  • Blacksmith Testbox types, lint, and formatting passed. Exact-base autoreview was clean.
  • TruffleHog 3.96.0 found zero secrets in the integration-base-to-head patch and finalized artifact tree.
  • Final integration-base-to-head churn: 1,107 lines (production +324/-87; tests and test support +644/-52).

AI-assisted: Yes — Codex. Exact-head developer, verifier, and adversarial review evidence was checked before publication.

@clawsweeper

clawsweeper Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Aug 11, 2026
@joshavant
joshavant marked this pull request as ready for review August 11, 2026 06:26
@joshavant
joshavant marked this pull request as draft August 11, 2026 06:26
@joshavant
joshavant marked this pull request as ready for review August 11, 2026 06:27
@joshavant
joshavant marked this pull request as draft August 11, 2026 06:33
@joshavant
joshavant marked this pull request as ready for review August 11, 2026 06:43
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 11, 2026
@clawsweeper

clawsweeper Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 5:50 AM ET / 09:50 UTC.

ClawSweeper review

What this changes

This PR updates auto-reply fallback handling so an embedded fallback uses its final prepared harness’s delivery mode and can send a successful direct-chat reply to the originating channel.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for maintainer review. The supplied branch addresses the prior plugin-finalization leak finding and targets a source-proven silent fallback-delivery regression, but its runtime-selected delivery change still needs exact-head validation and a maintainer decision on delivery/privacy risk.

Priority: P1
Reviewed head: a330061f758bb6fe0bc530698a5177f3e845c873
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The repair has a source-backed rationale and resolves the previous boundary finding, but the worker could not independently inspect the complete final tree or claimed exact-head runs.
Proof confidence 🌊 off-meta tidepool Not applicable: The review state identifies the author as a repository MEMBER, so the external-contributor proof gate does not apply; a redacted direct-channel trace would still materially reduce delivery risk.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The review state identifies the author as a repository MEMBER, so the external-contributor proof gate does not apply; a redacted direct-channel trace would still materially reduce delivery risk.
Evidence reviewed 6 items Current-main root cause: The fallback cycle snapshots whether replies are tool-only from the original run before it resolves and executes each fallback candidate; a later embedded harness cannot change that value in the current path.
Delivery-policy contract: Current policy makes message-tool-only suppress automatic source delivery, while direct chats otherwise resolve to automatic delivery; the linked report’s successful fallback can therefore finish without a final send when the stale mode remains tool-only.
Prior finding addressed: The supplied final PR diff centralizes plugin handoff projection and removes the private source-delivery runtime from both attempt and settled-turn finalization handoffs, matching the prior P1 finding.
Findings None None.
Security None None.

How this fits together

Auto-reply receives a channel message, chooses source-delivery policy, and may run multiple provider or harness fallback candidates before dispatching the final payload. This change lets the selected embedded harness update automatic-versus-message-tool delivery only when that default is runtime-derived.

flowchart LR
  A[Inbound direct chat] --> B[Initial source delivery policy]
  B --> C[Primary CLI attempt]
  C --> D[Embedded fallback candidate]
  D --> E[Prepared harness delivery default]
  E --> F[Final reply payload]
  F --> G[Originating channel delivery]
Loading

Decision needed

Question Recommendation
Should this cross-runtime delivery-mode repair require an exact-head direct-chat fallback proof before merge, in addition to its composed harness coverage? Require direct fallback proof: Obtain a redacted exact-head Telegram direct-message transcript showing a failed CLI primary, successful embedded fallback, and one delivered final reply while confirming message-tool-only paths remain suppressed.

Why: The code intentionally changes whether a successful fallback is sent to users, while preserving private and message-tool-only behavior; that tradeoff needs maintainer acceptance.

Before merge

  • Resolve merge risk (P1) - A runtime-derived delivery-mode change can restore direct replies but must not turn privacy-sensitive room or explicit message-tool paths into automatic sends.
  • Resolve merge risk (P1) - The new private delivery controller crosses agent-harness preparation; every plugin handoff must continue to omit it, including settled-turn finalization.
Agent review details

Security

None.

PR surface

Source +284, Tests +613. Total +897 across 22 files.

View PR surface stats
Area Files Added Removed Net
Source 16 433 149 +284
Tests 6 622 9 +613
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 22 1055 158 +897

Review metrics

Metric Value Why it matters
Production versus test delta production +324/-87; tests and test support +644/-52 (PR body declaration) The bug repair adds a cross-runtime delivery-state owner, so the positive production growth needs owner-boundary and direct-delivery proof.

Stored data model

Persistent data-model change detected: serialized state: src/auto-reply/reply/agent-runner-memory.test.ts, vector/embedding metadata: src/auto-reply/reply/agent-runner-memory.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #121605
Summary: The PR is the candidate repair for the linked silent embedded-fallback delivery regression.

Members:

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

Mantis proof suggestion

A redacted Telegram direct-message transcript would directly prove the user-visible fallback delivery this PR changes. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis telegram live proof: verify that a failed CLI primary followed by a successful embedded fallback sends exactly one final reply to the originating direct chat.

Merge-risk options

Maintainer options:

  1. Capture the direct fallback outcome (recommended)
    Before merge, record a redacted exact-head direct-chat fallback run that shows the final outbound reply and confirms no automatic send on message-tool-only paths.
  2. Accept the composed harness evidence
    Maintainers may merge after exact-head CI if they judge the existing prepared-harness and plugin-boundary suites sufficient for the delivery/privacy change.

Technical review

Best possible solution:

Keep one private runtime owner for only runtime-derived defaults, retain the shared plugin-handoff projection, and land only after exact-head direct-fallback and message-tool/privacy behavior are demonstrated.

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

Yes—source inspection shows that delivery mode is captured before fallback harness selection, matching the linked issue’s CLI-failure-to-embedded-fallback path; this read-only review did not execute it.

Is this the best way to solve the issue?

Yes, conditionally: resolving only runtime-derived defaults at prepared-harness ownership is cleaner than changing stable session policy, provided the private controller remains excluded from every plugin handoff.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 38fabc4e0310.

Labels

Label justifications:

  • P1: The linked regression silently drops replies after a successful model fallback on a real channel path.
  • merge-risk: 🚨 message-delivery: The patch changes whether a fallback result is automatically sent to the originating conversation.
  • merge-risk: 🚨 security-boundary: The patch introduces private mutable delivery state that must remain excluded from plugin harness handoffs.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The review state identifies the author as a repository MEMBER, so the external-contributor proof gate does not apply; a redacted direct-channel trace would still materially reduce delivery risk.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The reported and repaired behavior is a visible Telegram direct-message reply outcome that can be demonstrated in a short fallback scenario.

Evidence

What I checked:

  • Current-main root cause: The fallback cycle snapshots whether replies are tool-only from the original run before it resolves and executes each fallback candidate; a later embedded harness cannot change that value in the current path. (src/auto-reply/reply/agent-runner-fallback-candidate.ts:29, 38fabc4e0310)
  • Delivery-policy contract: Current policy makes message-tool-only suppress automatic source delivery, while direct chats otherwise resolve to automatic delivery; the linked report’s successful fallback can therefore finish without a final send when the stale mode remains tool-only. (src/auto-reply/reply/source-reply-delivery-mode.ts:115, 38fabc4e0310)
  • Prior finding addressed: The supplied final PR diff centralizes plugin handoff projection and removes the private source-delivery runtime from both attempt and settled-turn finalization handoffs, matching the prior P1 finding. (src/agents/harness/selection.ts:752, a330061f758b)
  • History routing: Current blame attributes the fallback snapshot and existing plugin-handoff projections to Peter Steinberger at the shallow-history boundary commit f788af0. (src/auto-reply/reply/agent-runner-fallback-candidate.ts:29, f788af023831)
  • Shipped affected release: The reported affected build is locally tagged as v2026.7.1-2; current main is newer but still contains the pre-fix fallback snapshot. (0790d9f593ad)
  • Inspection limitation: The read-only checkout has the PR commit object but missing promisor file blobs, and GitHub network reads failed; claimed exact-head suite output could not be independently rerun or fully inspected here. (a330061f758b)

Likely related people:

  • Peter Steinberger: Current blame covers both the fallback delivery snapshot and the plugin-handoff projection that the PR changes. (role: recent area contributor; confidence: medium; commits: f788af023831; files: src/auto-reply/reply/agent-runner-fallback-candidate.ts, src/agents/harness/selection.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add a redacted exact-head direct-chat fallback transcript or live output showing the final delivery and preserved message-tool-only behavior.

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.

History

Review history (3 earlier review cycles)
  • reviewed 2026-08-11T06:55:40.366Z sha 18b185e3003f35fe824aefd9b804f24c15721bda :: found issues before merge. :: [P1] Restore the prepared admission context
  • reviewed 2026-08-11T07:59:23.836Z sha d540999 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-11T08:58:52.946Z sha 4f2cd25 :: needs changes before merge. :: [P1] Strip the delivery controller from finalization handoffs

@joshavant
joshavant force-pushed the joshavant/issue-121605-20260810t171350z-2a4019a1 branch from 18b185e to d540999 Compare August 11, 2026 07:12
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 11, 2026
@joshavant
joshavant marked this pull request as draft August 11, 2026 08:44
@joshavant
joshavant marked this pull request as ready for review August 11, 2026 08:48
@joshavant
joshavant marked this pull request as draft August 11, 2026 08:49
@joshavant
joshavant marked this pull request as ready for review August 11, 2026 08:49
@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 11, 2026
@clawsweeper clawsweeper Bot added mantis: telegram-visible-proof Mantis should capture Telegram visible proof. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 11, 2026
@joshavant
joshavant merged commit e5be751 into main Aug 11, 2026
124 checks passed
@joshavant
joshavant deleted the joshavant/issue-121605-20260810t171350z-2a4019a1 branch August 11, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL 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.

[Bug]: after model fallback from claude-cli, the assistant reply is produced but never delivered to the channel (2026.7.1-2; works on 2026.5.28)

1 participant