Skip to content

fix(subagents): preserve announce drop vs none delivery reasons - #122855

Merged
steipete merged 5 commits into
openclaw:mainfrom
felirami:cursor/preserve-announce-drop-reason-732b
Aug 25, 2026
Merged

steipete merged 5 commits into
openclaw:mainfrom
felirami:cursor/preserve-announce-drop-reason-732b

Conversation

@felirami

@felirami felirami commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Closes #122615

What Problem This Solves

Fixes an issue where operators monitoring subagent completion delivery could tell that an announce failed, but could not tell a live requester queue refusal (dropped) from no viable requester session (none). Both collapsed to path: "none" and persisted as lastDropReason: "sink_unavailable". A failed completion direct delivery followed by a dropped steer fallback also kept only one reason, so either the direct classification or the queue refusal was lost.

Why This Change Was Made

Dropped is not marked terminal, so completion still returns the failed direct result instead of replacing it with the steer miss. Dual-reason design: top-level reason stays the direct failure (visible_reply_missing / message_tool_delivery_missing); the fallback phase records steer_dropped; cleanup persists lastDropReason: "steer_dropped" from that phase without clobbering the direct code in lastError.

This does not add a direct-delivery fallback for a live requester that refused steering.

User Impact

Managers and local monitors can distinguish a refused announce into an active requester from a missing requester session, including the completion path where direct delivery fails and steer fallback is dropped. Both the direct failure classification and the queue refusal remain visible.

Evidence

Head: 05565da36288836ddc822e8eb377d6a9e3c198ff

Wall-clock Node process (not Vitest). Isolated HOME / OPENCLAW_STATE_DIR. Drove production runSubagentAnnounceFlow → deliverSubagentAnnouncement → runSubagentAnnounceDispatch → startSubagentAnnounceCleanupFlow. Real queueEmbeddedAgentMessageWithOutcomeAsync against a registered non-streaming embedded requester run (not_streaming → dropped). Recording fake only at the gateway RPC client (empty announce-agent payloads / empty chat.history).

node v22.22.3
NODE_ENV=test
node --import tsx /tmp/subagent-announce-drop-trace.mts
sha=05565da36288836ddc822e8eb377d6a9e3c198ff
wall_sec=23.200
ok=true

After-fix owner/transport trace (redacted):

{
  "topLevelReason": "visible_reply_missing",
  "phases": [
    {
      "phase": "direct-primary",
      "delivered": false,
      "path": "direct",
      "reason": "visible_reply_missing",
      "error": "completion agent did not produce a visible reply"
    },
    {
      "phase": "steer-fallback",
      "delivered": false,
      "path": "none",
      "reason": "steer_dropped"
    }
  ],
  "persistedAtOnDeliveryResult": {
    "lastDropReason": "steer_dropped",
    "lastError": "completion agent did not produce a visible reply; visible_reply_missing; direct-primary: completion agent did not produce a visible reply"
  },
  "lastDropReason": "steer_dropped",
  "queue_client_result": { "queued": false, "reason": "not_streaming", "gatewayHealth": "live" },
  "gateway_client": { "method": "agent", "expectFinal": true }
}

lastDropReason stayed steer_dropped after cleanup. Later retry bookkeeping rewrote lastError to announce deferred or direct delivery failed; that rewrite is existing pending-retry text, not a loss of steer_dropped.

Not live-run: no live Telegram/Slack/Discord network, no isolated gateway process, no live model provider, no packaged/Docker/Crabbox.

By: @felirami (acct 2014-02-21) | OpenClaw: 13 PRs, 0 issues, 1 commits/12mo | GitHub: 612 commits, 140 PRs, 11 issues, 1 reviews

Keep live-queue refusals as steer_dropped through dispatch mapping and
registry persistence so they stay distinguishable from no viable
requester (sink_unavailable). Do not mark dropped as terminal, so
completion fallback still returns the primary direct result.
@clawsweeper

clawsweeper Bot commented Aug 12, 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: S labels Aug 12, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 12, 2026
@clawsweeper

clawsweeper Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 4:35 AM ET / 08:35 UTC.

ClawSweeper review

What this changes

The PR records a refused active-requester steer as steer_dropped while retaining an earlier direct-delivery failure as the top-level diagnostic.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for maintainer review: current main still collapses dropped and unavailable steer outcomes, while this PR carries the distinction through dispatch and durable cleanup. No discrete patch defect was found, but the branch is behind recent delivery-state work and needs exact-merge validation.

Priority: P2
Reviewed head: 3d8baba0d1e9db41be331766f02be1fba5389440

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused owner-boundary repair and real-process trace are solid; exact merge-result validation remains the material confidence reducer.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body includes a redacted after-fix terminal trace through the production dispatch, embedded requester queue, and cleanup owners; it is strong internal delivery proof, though not live-channel proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body includes a redacted after-fix terminal trace through the production dispatch, embedded requester queue, and cleanup owners; it is strong internal delivery proof, though not live-channel proof.
Evidence reviewed 5 items Current-main defect: Current main maps both dropped and none steer outcomes to the same { delivered: false, path: "none" } shape, so the refusal distinction is absent.
Proposed owner-boundary repair: The branch assigns steer_dropped at steer-result mapping and preserves the direct failure as the top-level completion result while retaining fallback phase evidence.
Durable-state handling: Registry cleanup records a phase-level dropped reason before persisting the authoritative direct-delivery error; the SQLite store retains the complete normalized payload JSON for rehydration.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw --help

Result: PASS (completed)

pnpm openclaw --help
runner@runnervm76f27:/tmp/clawsweeper-live-proof-122855-Lsod2r/target$ pnpm openclaw --help
$ node scripts/run-node.mjs --help
pnpm openclaw --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.88 kB
[log]
[success] rolldown v1.2.0 Finished in 43.33 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
[tsdown-build] invocation 2/2 finished in 8.2s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 10 phases completed in 4193ms (slowest: built plugin control-plane loads 3479ms)

OpenClaw 2026.8.1 (3d8baba) — All your chats, one OpenClaw.

Usage: openclaw [options] [command]

Options:
  --container ‹name›   Run the CLI inside a running Podman/Docker container named ‹name› (default: env OPENCLAW_CONTAINER)
  --dev                Dev profile: isolate state under ~/.openclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)
  -h, --help           Display help for command
  --log-level ‹level›  Global log level override for file + console (silent|fatal|error|warn|info|debug|trace)
  --no-color           Disable ANSI colors
  --profile ‹name›     Use a named profile (isolates OPENCLAW_STATE_DIR/OPENCLAW_CONFIG_PATH under ~/.openclaw-‹name›)
  -V, --version        output the version number

Commands:
  Hint: commands suffixed with * have subcommands. Run ‹command› --help for details.
  acp *                Run an ACP bridge backed by the Gateway
  agent *              Run an agent turn via the Gateway (use --local for embedded)
  agents *             Manage isolated agents (workspaces + auth + routing)
  approvals *          Manage approval policy and pending requests
  attach               Attach Claude Code to a gateway session with scoped MCP tools
  audit                Inspect activity records and exact-run identity context
  automations *        Manage automations (alias for cron)
  backup *             Create, verify, and restore backup archives and SQLite snapshots
  capability *         Run provider capability commands (fallback alias: infer)
  channels *           Manage connected chat channels and accounts
  chat                 Open a local terminal UI (alias for tui --local)
  clawbot *            Legacy clawbot command aliases
  completion           Generate shell completion script
  config *             Non-interactive config helpers (get/set/patch/unset/file/schema/validate). Run without subcommand for guided setup.
  configure            Interactive configuration for credentials, channels, gateway, and agent defaults
  connect              Connect this machine to an OpenClaw Gateway as a node
  cron *               Manage automations (via Gateway)
  daemon *             Manage the Gateway service (launchd/systemd/schtasks)
  dashboard            Open the Control UI with your current token
  database *           Inspect shared-state schema compatibility and write ownership
  devices *            Device pairing and auth tokens
  directory *          Lookup contact and group IDs (self, peers, groups) for supported chat channels
  dns *                DNS helpers for wide-area discovery (Tailscale + CoreDNS)
  docs                 Search the live OpenClaw docs
  doctor               Health checks + quick fixes for the gateway and channels
  exec-approvals *     Manage exec approvals (alias for approvals)
  exec-policy *        Show or synchronize requested exec policy with host approvals
  fleet *              Provision and manage isolated tenant cells (
… output truncated …

Assertions:

  • PASS expect_output: OpenClaw

How this fits together

Subagent completion announcements attempt direct delivery or steering into an active requester, then persist the delivery outcome in the subagent registry. Operators and retry cleanup consume that durable state to distinguish delivery failures.

flowchart LR
  A[Subagent completes] --> B[Announcement dispatch]
  B --> C{Direct or steer result}
  C --> D[Delivery phases]
  D --> E[Registry cleanup]
  E --> F[Durable delivery diagnostics]
  F --> G[Operator and retry handling]
Loading

Before merge

  • Resolve merge risk (P1) - The branch is behind current main, whose same lifecycle path now records requester-visible finals and resolves gateway context; verify the exact GitHub merge result retains those current-main behaviors alongside steer_dropped.
  • Complete next step (P2) - No repair lane is needed: the PR already contains the focused implementation, and the remaining action is normal exact-merge validation.
Agent review details

Security

None.

PR surface

Source +16, Tests +250. Total +266 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 4 21 5 +16
Tests 4 274 24 +250
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 295 29 +266

Review metrics

Metric Value Why it matters
Production versus regression-test LOC production +21/-5 (net +16), tests +274/-24 The production growth introduces one stable persisted reason and its lifecycle propagation; the larger test delta covers dispatch, delivery, and cleanup behavior.

Merge-risk options

Maintainer options:

  1. Validate the merged delivery state (recommended)
    Rebase or inspect GitHub’s merge result, then rerun the composed direct-failure plus dropped-steer cleanup scenario against that exact result.

Technical review

Best possible solution:

Land a rebased or merge-result-verified version that preserves both the new dropped diagnostic and current main’s requester-final delivery safeguards.

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

Yes: source shows that current main converts both active-session refusal and unavailable-session outcomes into the same delivery shape, and the PR supplies a production-owner trace for the dropped case.

Is this the best way to solve the issue?

Yes, conditionally: assigning the fact at dispatch and persisting it at the registry owner avoids downstream inference while retaining the direct failure; validate that shape on the current-main merge result.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 0497cd91bf71.

Labels

Label justifications:

  • P2: This is a bounded correction to subagent completion diagnostics and retry state.
  • merge-risk: 🚨 session-state: The PR changes a persisted subagent delivery-state reason and merges beside newer lifecycle-state handling on main.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes a redacted after-fix terminal trace through the production dispatch, embedded requester queue, and cleanup owners; it is strong internal delivery proof, though not live-channel proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes a redacted after-fix terminal trace through the production dispatch, embedded requester queue, and cleanup owners; it is strong internal delivery proof, though not live-channel proof.

Evidence

What I checked:

Likely related people:

  • steipete: Authored the current branch head and the central announce/registry refactors visible in the affected-path history. (role: recent area contributor; confidence: high; commits: 3d8baba0d1e9, 1ced7441eb6a, d2ac0e3b6fcd; files: src/agents/subagents/announce/subagent-announce-dispatch.ts, src/agents/subagents/registry/subagent-registry-lifecycle-delivery.ts)
  • Vito Cappello: Recent current-main work established requester-final delivery state in the same registry recorder that this PR will merge beside. (role: recent adjacent contributor; confidence: medium; commits: 094873902baf; files: src/agents/subagents/registry/subagent-registry-lifecycle-delivery.ts, src/agents/subagents/registry/subagent-registry-lifecycle-announce-cleanup.ts)

Rank-up moves

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

  • Run the composed dispatch-and-cleanup trace against the exact merge result, with private identifiers redacted.

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 (5 earlier review cycles)
  • reviewed 2026-08-12T23:21:15.229Z sha 47dc601 :: needs real behavior proof before merge. :: [P2] Propagate fallback drops into completion cleanup
  • reviewed 2026-08-13T04:36:02.648Z sha c29b89f :: needs real behavior proof before merge. :: [P2] Preserve the direct failure reason
  • reviewed 2026-08-13T19:46:52.042Z sha 05565da :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-13T21:31:33.410Z sha 05565da :: needs maintainer review before merge. :: none
  • reviewed 2026-08-19T11:12:43.957Z sha 05565da :: needs maintainer review before merge. :: none

Carry the nonterminal dropped-steer reason on the retained failed
direct completion result so registry cleanup can persist lastDropReason.
@felirami

Copy link
Copy Markdown
Contributor Author

Addressed the completion fallback persistence finding. Dropped steer is still non-terminal; the retained failed direct result now carries steer_dropped, and cleanup persists it. Added a composed delivery plus cleanup regression and reran owner-boundary proof on c29b89f59c95.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. label Aug 13, 2026
Completion fallback no longer overwrites the direct failure
classification with steer_dropped. Cleanup still persists
steer_dropped from the fallback phase so queue refusal stays
distinct from sink_unavailable.
…lback

Use the no-output Discord completion path so deliverSubagentAnnouncement
keeps the direct classification while the fallback phase records
steer_dropped.
@felirami

Copy link
Copy Markdown
Contributor Author

Preserved both facts on completion fallback. Top-level reason stays the direct failure (visible_reply_missing); the fallback phase records steer_dropped; cleanup persists that as lastDropReason without clobbering lastError.

Composed delivery plus cleanup regressions fail on c29b89f (reason overwritten to steer_dropped) and pass on 05565da3628. Not live-run.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@felirami

Copy link
Copy Markdown
Contributor Author

Added a wall-clock production-owner trace on head 05565da36288836ddc822e8eb377d6a9e3c198ff. Real deliverSubagentAnnouncement / runSubagentAnnounceDispatch / queueEmbeddedAgentMessageWithOutcomeAsync / startSubagentAnnounceCleanupFlow. Recording fake only at the gateway RPC client. After-fix: top-level visible_reply_missing, steer-fallback steer_dropped, persisted lastDropReason: steer_dropped, and lastError kept the direct code at the cleanup callback. Not live Telegram/Slack.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 13, 2026
@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

The maintainer repair is now published at verified head 3d8baba0d1e9db41be331766f02be1fba5389440, preserving @felirami's original branch ancestry and contributor credit.

The canonical delivery recorder now owns both steer_dropped and sink_unavailable classifications while preserving the authoritative direct-delivery failure. Cleanup synchronously persists a changed drop reason even when the existing delivery error is identical, without repeating unchanged writes. The original-order lifecycle regression covers the live-requester queue refusal, fallback phase, stalled announcement bookkeeping, changed-reason durability, and unchanged-diagnostic no-op.

A clean three-way integration with current main preserves the newer recorder runs argument, requester-visible-final ownership, cleanup lifecycle-generation fencing, and producer-owned visible terminal replies. Production code decreases by seven lines.

Fresh exact-head CI and Workflow Sanity are pending; both must pass before landing.

@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete
steipete merged commit ccd8ede into openclaw:main Aug 25, 2026
250 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 26, 2026
…claw#122855)

* fix(subagents): preserve announce drop vs none delivery reasons

Keep live-queue refusals as steer_dropped through dispatch mapping and
registry persistence so they stay distinguishable from no viable
requester (sink_unavailable). Do not mark dropped as terminal, so
completion fallback still returns the primary direct result.

* fix(subagents): persist steer_dropped after completion fallback drop

Carry the nonterminal dropped-steer reason on the retained failed
direct completion result so registry cleanup can persist lastDropReason.

* fix(subagents): keep direct announce reason when steer fallback drops

Completion fallback no longer overwrites the direct failure
classification with steer_dropped. Cleanup still persists
steer_dropped from the fallback phase so queue refusal stays
distinct from sink_unavailable.

* test(subagents): keep visible_reply_missing through dropped steer fallback

Use the no-output Discord completion path so deliverSubagentAnnouncement
keeps the direct classification while the fallback phase records
steer_dropped.

* fix(agents): persist subagent drop diagnostics atomically

Co-authored-by: felirami <[email protected]>

---------

Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: felirami <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary 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.

Subagent announce delivery drops failure reason for dropped vs none outcomes

3 participants