Skip to content

improve: sessions_send delivers a peer's reply once instead of running automatic agent ping-pong - #162227

Merged
steipete merged 44 commits into
mainfrom
steipete/announce-skip-agent-logic-c83574
Oct 1, 2026
Merged

steipete merged 44 commits into
mainfrom
steipete/announce-skip-agent-logic-c83574

Conversation

@steipete

@steipete steipete commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

When one agent used sessions_send to message another, OpenClaw ran up to five automatic agent turns of ping-pong between them (stopped by a REPLY_SKIP token), then forced one more "announce" turn in the target session (silenced by ANNOUNCE_SKIP) to post a summary to the target's channel. That machinery predates agents having real tools. It burned model turns nobody asked for, and an inline peer reply even started a second requester turn that redelivered the same reply.

User Impact

User impact: a sessions_send peer reply now reaches the requesting agent exactly once. It comes back inline when the caller waited, or as a single delayed delivery otherwise. There are no automatic reply-back or announce turns. Agents continue a conversation by calling sessions_send again and post to channels with the message tool.

Behavior changes worth knowing:

  • No automatic peer ping-pong and no target-side announce post to the target's channel. A channel-bound target that should tell its humans something uses message during its own turn.
  • ANNOUNCE_SKIP / REPLY_SKIP are no longer runtime control tokens. A child replying ANNOUNCE_SKIP is now ordinary text. NO_REPLY and HEARTBEAT_OK keep their existing semantics. Old transcripts and stored cron prompts that contain the tokens are still hidden from chat surfaces.
  • The sessions_send tool result's delivery drops its single-valued mode, leaving { status: "pending" | "skipped" }.
  • Hidden message-argument aliases (SendMessage/content/text) are retired. The schema already requires message.
  • A key-only sessions_send caller replying from an unthreaded DM key is no longer re-routed to the agent's main session. Replies go to the caller's own session.

No config, schema, Gateway protocol, or public plugin SDK contract changes. No migration is needed.

Why This Change Was Made

The peer flow collapses to one owner: settle the target's reply, then either deliver it to the requester once or (for self-sends) deliver it to the captured source route under the original session-generation fence. The same campaign deslopped the subagent announce, completion, registry, and spawn owners and the session tools. It removed unreachable wait paths, naming-only adapters, duplicate type declarations, always-supplied optionals, re-checks of caller-established invariants, dead exports, and restating comments. Net production change against the integrated main base: −1,870 lines (1,205 added, 3,075 deleted).

Bugs fixed along the way, each with a regression test that fails on the base and passes here:

  • An inline peer reply started a duplicate requester turn (6 extra agent calls for a peer, 2 for an internal requester).
  • Required children that ended silent or empty were dropped from batch findings instead of being reported as missing output.
  • Active-wake retries after source_reply_delivery_mode_mismatch reset to the full delivery budget.
  • Interrupted finalization during restart drain swallowed an unknown SQLite outcome.
  • Session delivery-route lookup only searched the first 200 sessions, losing the stored account.
  • A failed same-ID registration dropped the previous in-memory row.
  • Collector attachment cleanup skipped its isCurrent guard.
  • Pending-lifecycle grace timers could settle a same-ID successor run.
  • Cold compact registry reads dropped pauseReason.
  • A fork-preparation lookup rejection orphaned the provisional child session.
  • Persisted visible-child quota counts mixed agents sharing a bare requester key.
  • The trusted-creation transport fallback ignored its timeoutMs.

Evidence

The original branch proof below was accepted at 2bdb624da95d74d69e1c4b1038099e922cc16caa; conflict-integration proof is recorded separately below.

  • Live, real OpenAI through a real Gateway (Blacksmith Testbox, hydrated secret):
    • sessions-send-peer.live.test.ts holds the peer on a gate, then releases it. Each session gets exactly one inter-session input, and there are zero automatic reply or announce turns.
    • subagent-announce.live.test.ts confirms completion provenance end to end. Both pass.
  • Red→green: every bug above has a regression test proven failing against the original production code on the Testbox, and passing here.
  • Changed-lane gate (check-changed against the base, on Testbox): green. That covers full core/extension/root typecheck, lint:core, all three dead-export scans, the line-cap/max-lines/assertion ratchets, format, plugin boundaries, and SDK surface budget. pnpm build passes, and the strict plugin SDK API diff shows no changes.
  • Focused matrices on Testbox: about 4,900 tests across the touched announce, completion, registry, spawn, sessions, Gateway, and cron suites, plus the two registry/sandbox E2E files.
  • Reviews: independent Codex review per batch and over the full branch. One finding was rejected with evidence: inline same-session delivery is unreachable because waited self-sends are refused before dispatch.
  • Changed test costs (pnpm test <file> --maxWorkers=1 wall): sessions.test.ts 11.7s, openclaw-tools.sessions.test.ts 18.7s, subagent-registry.store.sqlite.test.ts 8.1s, sessions-describe-worker 32.2s, publication 3.9s, capability store 48.8s (about 4s of test execution; the rest is compiler startup). No new real timers, sleeps, or per-test Gateway boots.

Known gaps, not caused by this branch:

  • The live subagent-yield-resume cancellation case is flaky on the base too: in an A/B of 3 runs each, 1 failure on each side, with different signatures. A pre-existing completion-writer/cancellation overlap is described for follow-up.
  • The opt-in issue-82913 busy-parent repro fails on base and branch alike.
  • Three requester-owner E2E cases and one control-refresh test fail identically on the base.
  • Consolidating the compact SQLite decoder onto the canonical codec was tried and reverted after a benchmark showed it 89% slower. The duplicate-JSON-key reader disagreement remains a follow-up.

Landing integration

Merged main at 588b5d7d50b78250148110f070d9deb55f4ace1d into the reviewed branch without rebasing. The resolution keeps main's watched-child completion and requester lifecycle changes, preserves single peer delivery, and moves the bare-key quota regression into main's consolidated spawn suite.

Fresh independent review of the merged candidate raised two findings, both rejected after source comparison:

  • Search discovery never copied an incarnation ID on the base, and the removed result-side visibility check only repeated the same cached discovery facts. Explicit scoped-grant incarnation fencing and its replacement test remain. The proposed discovery race was not introduced by this change.
  • Pending spawn reservations for different agents sharing a bare key were already shared on the base. This PR fixes persisted-child counting; pending-reservation namespacing remains a follow-up.

Integration repairs updated newer main callers to the phase-aware publication API and explicit changed-row IDs, retained the regressions in smaller existing suites, and moved requester adoption into its existing lifecycle controller. Independent review of these repairs and the final mechanical lint fixes completed with no actionable findings.

Focused integration proof at 86536582a9f1c8212d286c3796e6e3f5558b9109: 72 files / 1,372 tests / 8 Vitest shards passed in 234.87 seconds on Blacksmith Testbox run 36809309289. The remote checkout verified commit and tree (b9f5de680b2e79248b1a888a6a7c0aa1b9c92508) before testing. Source transfer used a pinned Git bundle over the allocated Testbox's SSH route after full-sync timeouts; those earlier timeouts executed no tests. The Actions run supplies the lease, while the command results above are the validation evidence.

The complete check-changed --base 588b5d7d50b78250148110f070d9deb55f4ace1d run passed (exit 0) on the same exact head and Testbox lease. All type, lint, dead-export, format, ratchet, plugin-boundary, SDK-budget, storage and import-cycle checks passed. Earlier integration failures (publication call signatures, changed-row fixture IDs, file growth and lint) were repaired and verified; none were waived.

Moved-test cost (pnpm test <file> --maxWorkers=1, wall): subagent-announce-delivery.runtime.test.ts 18.21s / 8 tests; sessions-spawn-tool.visible.test.ts 16.33s / 2 tests. Both pass; these move existing regression coverage into existing suites.

Hosted CI run 36813917464 exposed stale generated prompt snapshots and cancelled downstream jobs. The same drift reproduced on Testbox run 36815568067. Regeneration changed only the intended sessions_send description and derived counts/hashes (4 files, +25/−25); prompt:snapshots:check and the snapshot-only changed checks then passed. Independent review of this generated delta is clean. The production code and its 1,372-test/full changed-lane proof remain unchanged.

A second main merge at 16a7c1f118c4c85e644e5ddf38a154610172cd73 had one hot-reload E2E fixture conflict. Its resolution preserves main's diagnostic recorder and the single requester reply. On Testbox run 36819087177, the hot-reload E2E passed (1 test, 23.584s; 554s including fresh prerequisite build), and all 7 prompt snapshots remained current. This flow verifies a real Gateway runtime reload from model A to model B with exactly one detached reply.

Main's new timeout-race guard also required removing an extra wall-clock wrapper from the live descendant-settlement helper. The existing owned completion signal and test-finalization cleanup remain. Independent review is clean. Final conflict/helper changed checks passed in 295s with zero warnings/errors on Testbox run 36823450516, with exact tree 363a28fb51f079ecc66d14c9980139d1a6ab14d5 matching 10e00685387dffe855150d0494cd77ee9fde6261. An initial ratchet invocation used the prior branch rather than integrated-main baseline; that proof-planning error was corrected without any source or baseline waiver.

CI run 36825510027 then caught a type-only Madge cycle introduced by deriving the follow-up owner contract from its implementation class. Restoring main's standalone interface and implements check removes that cycle without runtime changes. Testbox run 36828083388 reproduced the exact baseline failure, then passed the complete architecture gate (runtime and Madge cycles both zero), core types, 14 focused tests and scoped lint. The verified repaired tree is ecc718228990f860b86997cadb6f699ea6d35603, matching 702a35bea3c991b71ce817ad7087bdb042fdbadd. Fresh independent review is clean.

CI run 36830431873 found an exported-name collision in the new reply lookup. Naming that private async owner resolveSessionsSendReplyTarget distinguishes it from the existing synchronous outbound resolver. Testbox run 36833438453 reproduced the collision, then passed the export guard, core types, 82 focused tests and scoped lint for e9dcaf9e220114d4a21e99f960ba595010e0c419 (tree 0ad6b9cb911631355a1414e9d80382ab080053c4). Review is clean; runtime behavior is unchanged.

Independently qualified pre-existing CI failure: test/scripts/lint-status.test.ts cannot bundle its copied fixture because scripts/run-oxlint.mts:12 imports the omitted ./generate-kysely-types.mts. The same Testbox run reproduced all 40 failures on clean main f885caa955f023a496be46105d0b421ea1cc112a with node scripts/run-vitest.mjs test/scripts/lint-status.test.ts --maxWorkers=1 (exit 1). The test, wrapper, generator, package/lock and tooling configuration are untouched by this PR; wrapper/test blobs match the failed CI merge's main parent 3f7689e64a0842c5b45a682f387cc7f201fb1bb9 and the reproduced main. The originating PR job was 110265960686; its downstream cancellations are not passing coverage. This failure is eligible for the repository owner's explicit pre-existing-failure landing exception; security and enforced reviews remain required.

The third main integration at d6a09202b143883f3a60e1dd2faec5b90a0b1d9e conflicted only in generated prompt counts/hashes. The generator resolved them on Testbox run 36837948365; all 7 snapshots are current. The combined tree 83cbb214f6de3188c839ac37c6533f0d654f1834 (commit bca345553b385c6165b4381d361a23b910c92d17) passed 70 files / 1,359 tests, core types, targeted integration lint and snapshot-scoped changed checks. Independent review is clean. The separately qualified main lint-harness issue has an owning main change, 4f34af88e6dc91217568e8cf233b9ad75e135d84 (#162489).

CI run 36841560654 found one stale property in a newly added main fixture: steerMessage duplicated the retained triggerMessage. Removing that retired argument changes no assertion or runtime behavior. Testbox run 36843538852 reproduced TS2353 on the baseline, then passed the exact core test-type stripe 2/5, all 18 yielded-settle cases and lint for f745a90aee7ec45044159f85e3e7b104f03c609a (tree 9df6bf5e5298776ba3222b371b46ea9ef670b950). Independent review is clean.

The fourth main integration at 3a3d68111cc8ace6f257acddfe79913bf5ebcab1 composes the new custody-before-return fix with once-only peer delivery and preserves successful optional-empty child results. The admission fixture holds capture inside the tool invocation so both early native-child custody and delayed peer custody remain covered.

Fresh full-candidate independent review completed. One finding about retired reply tokens was rejected after tracing the source: control-reply-text.ts remains a chat-display/cron classifier, and this PR changes only its comment. Authoritative terminal snapshots are built and normalized by agent-run-terminal-reply.ts, which treats only NO_REPLY as silent; run-wait.ts reads that snapshot directly, and session reply selection excludes only NO_REPLY and HEARTBEAT_OK. The proposed sessions-send normalization path does not call the display classifier. No actionable findings remain.

On Blacksmith Testbox run 36847559745, candidate tree d45a7f9575642e2117d1fccda62bdce8996fa5cc passed all 261 focused tests across 17 files / 5 shards in 160 seconds. The admission file passed 9/9 in 33 seconds; restoring the old reply flow and removing the four custody awaits made the peer case fail at the return-before-capture assertion (23 seconds), then the exact candidate tree was restored. A runtime probe confirms both retired tokens remain visible through terminal snapshot construction, normalization and child-result selection. Scoped check-changed against pinned main 3a3d68111cc8ace6f257acddfe79913bf5ebcab1 passed in 1,379 seconds, including production types, all 27 selected core-test type graphs, lint, dead-export scans, ratchets and architecture guards.

All 7 generated prompt snapshots are current (prompt:snapshots:check, exit 0, 17 seconds) on the same verified tree. No regeneration was needed.

The fifth main integration at d07e6df877a27de919f5ce7d5b17f40307ac3a33 keeps registered-yield behavior, captured raw-key child ownership and agent-scoped queue cleanup. Hand-written conflicts were mechanical: prompt-handler files match the prior tested branch; the runtime export takes main's cleanup owner, and the requester-authority fixture uses the relocated pause-notice owner. The prompt snapshot generator produced tree 89336097c228c8b284b6b9290b92c5d9b9c31e33 on Testbox run 36853585970; generation and all-seven consistency checks passed (22s/16s). Eight focused files / 222 tests passed in 95 seconds. Fresh full-candidate review found no actionable P0–P2 findings.

Fifth-integration static proof passed on that same tree: two-file production format/lint (7s), tests-only native changed gate (184s; actual agents-other type graph), and snapshots-only native changed gate (132s). A combined invocation was deliberately stopped after its mixed JSON/TypeScript scope disabled narrow graph selection; the separate native invocations retain the selected checks without skip flags.

The sixth main integration at 4b32b401503d63edd0162b84072bd0deb2574cb0 preserves main's consolidated ACP spawn tests while removing only expectations for this branch's retired transcript-file persistence path and emitStartNotice argument. Main's delegated-credit, authority, relay-order and cleanup assertions remain.

Sixth-integration focused proof passed 5 files / 113 tests in 70 seconds. The native agents-other type graph then caught TS2353 in main's new direct-completion-media fixture: a retired steerMessage field duplicated triggerMessage. The integration removes only that redundant property, retaining every assertion. Full-candidate review repeated the previously documented pending-reservation concern; it remains pre-existing on pinned main 4b32b401503d63edd0162b84072bd0deb2574cb0, whose visible-spawn call also passes controllerSessionKey: requesterKey to the unchanged reservation owner.

Final sixth candidate tree a2642c8f46424d37b5a7e3d3478b0971884236ab passed the corrected media fixture (12 tests, 18s) and the three-test-file native changed gate (186s, including agents-other, Knip and lint), on Testbox run 36853585970. The prior 113 tests remain valid; the correction changes only the rejected fixture property. Scoped review of that correction is clean.

CI run 36865792140 attached to exact head a0220bef9fede5374c7ff4073cbc2d8cbfafbd3e. Build, lint, ratchets and security-fast passed. The Windows job 110381304337 failed during three checkout fetch timeouts before tests ran. Jobs 110381305227 and 110381598470 exposed main's newly added session-row-projection.registry-refresh.test.ts still importing the retired production save export; the candidate migrates that sole stale caller to the existing test-support owner, preserving the complete-snapshot fixture behavior. Job 110381305926 reported two requester-owner E2E receipt assertions; clean-main reproduction and causal-owner comparison below establish that they are inherited. Aggregate job 110386581026 reports only those root groups.

The seventh main integration at 6010d074f754d142ee1134416bcd9a4d5290a3db was formatting-only around the { key, alias } session resolver contract already used by this branch. Current full-candidate review is clean, including the registry fixture repair.

Independently verified inherited requester-owner failure: on clean main 6010d074f754d142ee1134416bcd9a4d5290a3db (tree f8954a021521f20092b3cc228239567a9496df7e), Testbox run 36870539592 reproduces both “delivers a private result once when the child finishes before the parent yields” cases (default and local placement). Delivery already reaches delivered; the successful private-receipt count is expected 1 but is 0, exactly as CI run 36865792140, job 110381305926. The cases took 11.719s/10.544s; the 776s wrapper wall includes a fresh E2E prerequisite build. The private-settle policy module is byte-identical between main and the PR (blob 99ee4c0d887434a76523b589fc98add0359989f2), as are the relevant yield mutation block, Gateway receipt recorder, receipt storage and complete failing test body. Main's 9564dd651472dc639e6114bee67c5d5f152d9fce makes these yielded batches deliverable while this expectation still requires a private receipt. Adjacent announce code and the test import do differ; the attribution applies specifically to the unchanged causal owner.

Seventh candidate tree 9beb82409c4bcc90ffdf6030b8610d96ebddf20e passed 7 files / 121 tests (51s), eight-file formatting/scoped lint (27s), and the native test-only changed gate (351s, selecting agents-tools and gateway-root, plus all static, Knip and lint checks) on Testbox run 36870539592. This verifies the CI fixture repair. Full-candidate review is clean.

CI run 36877999997 at f017f23f4b5bbe935fd92471857b895e0b6b985f cleared the earlier registry fixture/type failures. Its two roots were a newly landed required-results fixture mocking the retired persistence-event owner (job 110422878012, 120-second timeout) and a chat-steering skills-watcher leak during teardown (job 110422877801; both test cases passed). Main fixes the latter in 7570c6d0d952f685a1d7c3bbbf0a78022bd88bcc (#162753).

The eighth integration cleanly merges main 43873ce187b16340c553ab2d866e0a36119b224d, including that watcher fix, and migrates the required-results fixture to the existing publication mock contract. Actual projection subscriptions and all required-result, cancellation and cleanup assertions remain. The branch's two new registry test files were consolidated into one events suite to fit the existing type-root cap; all seven original cases and their test bodies/cleanup are retained without changing any budget.

Final candidate 9c6e2e4c69fef869be559dc12da84a9514e65c08 (tree f2811de2601f289107216d96abe0d2c275470baa) is verified on Testbox run 36882844614: 43 focused tests across three files passed in 61s; all seven consolidated registry cases passed; the native three-file changed gate passed in 369s, including its three selected type graphs, Knip and lint. Per-file pnpm test <file> --maxWorkers=1 wall: required-wait 19.96s/2 cases; registry-events 21.70s/7 cases. All seven prompt snapshots are current (20s). The Testbox imported the exact final merge commit, verified its tree and main-parent ancestry, and passed the environment-variable budget comparison (472/472), filling the earlier shallow-patch comparison omission without a guard exception. Independent review of the fixture repair and consolidation is clean.

…very

Deliver delayed peer results once to the requester and return waited replies inline without a continuation. Preserve child completion custody and same-session generation-bound channel delivery. Use exact-key saved-route lookup, retire legacy peer control tokens from runtime decisions, and retain historical display suppression.

Simplify the announce owner, preserve required missing child output, and keep wake retries within the remaining operation budget. Update session guidance and the opt-in live peer scenario.

Candidate regression scenarios pass. Broad focused tests and changed-lane validation remain incomplete under host load; original-code regression proof is still pending. No live provider test was run.
Share terminal-effect persistence and requester-wake settlement adapters while preserving their distinct authority, frozen-wave, and publication guards. Remove unused preparation and accessor paths and reuse existing parameter contracts.

Propagate unknown SQLite write outcomes before scheduling interrupted completion recovery during restart drain. The focused candidate regression passes; original-code failure proof and the broader validation matrix remain pending.
Assert that an ACP target already owned by its requester keeps task completion and starts no detached reply. Keep isolated cron fallback routing and participant-store checks while asserting no detached wait.

Remove assertions on the retired duplicate steerMessage field; retain complete source-reply content, ordering, exclusions, visibility and batch settlement checks. Remove the redundant inner same-session return while retaining the enclosing branch exit.

Validation: scoped Codex review at P2, formatting and diff checks passed. Two attempts on the coordinator Testbox lease failed during file sync before installation or tests. Baseline regression proof, the full matrix and the changed-lane gate remain pending.
Restore the previous resident row when same-ID registration persistence fails.
Carry collector cleanup authority into attachment removal, and bind lifecycle
grace timers to their captured registration and generation.

Regression coverage exercises failed writes, retirement during cleanup, and
same-ID successors without changing storage or timer durations.
Read pauseReason from existing stored JSON for ordinary and private-parent
records so cold projections preserve the resident paused status. Derive compact
SQL row types from the query and shrink the removed-assertion allowance.

No schema, serialized representation, or migration changes are required.
Route fork lookup failures through provisional-child cleanup. Reuse the spawn
admission owner for visible work with the resolved requester agent identity.
Pass trusted-creation transport timeouts through the argument the transport reads.

Consolidate in-process dispatch while preserving creation custody, source
fencing, per-interface deadlines, and signed fallback behavior.
Remove unused registry APIs, callback declarations, presentation adapters,
registration inputs, and bootstrap scaffolding. Share registration ACK control
flow while retaining both durable writes and the original settlement error owner.

Complete keyed capability lookups, reuse heartbeat and timeout owners, carry
resolved model references, and remove obsolete ACP transcript work and relay
options. Preserve legacy stored attachment safety and protocol-v4 fallbacks.
Move full-registry fixture writes into test support and require named production mutations. Consolidate publication subscriptions while preserving projection ordering and persistence observer exception isolation. Remove duplicate completion retry scaffolding, runtime barrels, test-only exports, duplicate types, and single-caller adapters.
Name all retired fixture rows when replacing describe/list facts. Warm the compact cache before its initial publication so the existing ordering assertion still detects an unintended SQL reload.
Retain the public record-or-lookup store contract, including normalized first-match identity lookup and canonical depth fallback for partial records. Keep migrated internal callers on keyed lookups. Restore the base handoff declarations and requester query/caller linkage so the existing SDK declaration gate stays unchanged.
Publish the staged in-memory owner through commitOwnership before asserting describe and list projections. Named durable writes no longer trigger the whole-index rebuild that accidentally discovered the fixture row. Preserve the existing assertions.
Project only formatter-consumed child fields without mutating authoritative rows, and carry the session resolver's required requesterOwned boolean directly. Preserve formatting, nested identity references, authority checks, and public signatures while resolving the full core lint findings.
Remove the full-registry writer no-op from the memory benchmark's typed module mock after the production writer cutover. Preserve the named-write mock and benchmark behavior.
Child cleanup can publish before the requester delivery acknowledgement. Join persistence publications until the requester wake settles, preserving the existing delivery assertions and deadlines.
Require the canonical message argument already declared by the public tool schema. Remove alias-only reasoning stripping and keep canonical message indentation unchanged.
Replace the separate compact decoder with the canonical codec and session-list projector. Keep bounded SQL metadata projection, private envelopes, and duplicate-key last-value semantics without transferring retained results. Add real-reader duplicate-key and retained-content regression coverage. Schema, persisted bytes, and update behavior are unchanged.
Revert 2c0fd63 as required by the performance gate. Across five scoped 2000-row reads per revision, the base median was 227.31 ms and the candidate median was 429.25 ms (88.84% slower). Retain the sessions_send alias retirement and comment cleanup; leave the duplicate-key reader fix for separately approved work.
Keep all four rejection cases in the assembled-tool suite where retired preparation coverage freed space. The oversized sessions test file shrinks again; no assertions, mocks, timeouts, skips, or line-cap baselines change.
Use the shared isRecord guard from the retired alias normalizer instead of a new type assertion. Preserve canonical missing-message errors for non-record input and satisfy the assertion safety gate without a suppression.
Remove the legacy key-only DM-to-main reply remap and its routing exceptions. Use the resolved caller key for reply context, provenance, watches and followup preparation. Preserve exact-incarnation and authorization checks.
Keep the key-only DM requester authority test on the native child completion path. Settle the existing completion owner before mock acceptance and reset queued mock implementations between cases.
@clawsweeper

clawsweeper Bot commented Oct 1, 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 docs Improvements or additions to documentation app: web-ui App: web-ui labels Oct 1, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 3, 2026
…ach other's subagent runs (openclaw#163282)

* fix(subagents): keep raw child-key lookups on the recorded owning agent

When two agents both had live raw-key children with the same key (for
example `global` for `main` and `research`), the in-memory registry still
looked runs up by the raw key alone. Generation numbering, registration
ownership, the watched sessions_send follow-up's completion child and
steered adoption, and subagents-tool cancel could select the other agent's
row: wrong generation, unregistered watched follow-ups, and cancels
rejected as outside the controlled tree.

Child-key lookups now take an optional owner and filter the existing
raw-key buckets through one predicate, matchesSubagentChildSessionOwner,
using the childAgentId recorded by openclaw#162540. Rows without a recorded owner
(agent-qualified keys and legacy unbound raw rows) and callers without an
owner keep raw-key matching. Kill, admin kill, kill scope and run
currentness keep the requester-agent filter for legacy unbound raw rows.
No schema, payload shape, or schema-version change: list reads project the
existing payload_json childAgentId.

Proof: real-entry sessions_send/subagents tests with two agents failed
before (generation 2 vs 1, missing watched registration, forbidden cancel,
legacy cancel selecting main's row) and pass after; full
src/agents/subagents sweep plus sessions-send/subagents-tool/gateway caller
suites on Testbox (166 files, 2,686 tests).

Follow-ups (owner not available at the call site): gateway
session-subagent-reactivation, session-subagent-resume,
approval-session-audience, ACP spawn admission, raw-key list aggregation.

* fix(subagents): keep required cfg on owned-run control helpers

Upstream openclaw#162227 made cfg required on getLatestOwnedSubagentRun and isCurrentSubagentRun; the rebase had loosened it back to optional. Every caller passes it.

* fix(subagents): keep owner matching out of the registry import graph

Moving the shared owner predicate into leaf registry modules (memory,
queries, generation, view, state) imported it from the module that also
resolves owner store paths through agent-scope, and the requester-settle
state helper started importing registry reads. Both edges joined the
registry into one large import cycle that the Madge architecture check
rejects.

The pure predicate now lives in its own leaf module with only a
session-key dependency, and the requester-settle run lookup returns to the
wake owner that already reads the registry. A record-based
getLatestSubagentRunForChild replaces positional undefined placeholders at
restore, restart recovery, and kill reconciliation; the registered
subagent timeout inheritance moves next to the Gateway subagent admission
helpers. Both keep their files within the line cap. Parent-resume adoption
now checks the latest run for the adopted record's own owner.

* test(subagents): hold raw-owner registry commits through the current persistence seam
steipete added a commit that referenced this pull request Oct 15, 2026
…ply text (wave-4 bundle) (#172669)

* refactor(infra): remove redundant replay and freshness machinery

Trust successful migration statements inside their synchronous transactions,
reuse unchanged approval parses, share canonical package-root discovery,
namespace directory caches by plugin identity, and simplify ephemeral presence,
OS facts and suspension timer bookkeeping. Keep source validation, conflicts,
transaction durability, postcommit checks, security authority and write settlement.

Best-effort tradeoffs accepted

- Node-host own-write verification (#108457): no human successful-SQL-loss report; SQL errors still roll back, and independent source retirement checks remain.
- Workspace setup/attestation replay (#109147): no human driver-rewrite report; trust successful writes while retaining fingerprints and later source checks.
- APNs expected-ID replay (#108543): no human silent-insert-loss report; canonical parsing, tombstones and receipts remain.
- Device-auth presence assertion (#112663): no human successful-upsert-loss report; credential validation and transaction failure handling remain.
- Device-identity replay (#110392): no human silent-row-rewrite report; preserve independent post-await verification before source deletion.
- MCP OAuth replay (#161219): no human silent-write-loss report; canonical/source parsing and worker admission remain.
- Exec-approval read/parse/deep-compare replay (#114063): no human successful-driver-rewrite report; malformed policy stays fail-closed and actual authority is unchanged.
- Shared-auth target reread (#123349): no human silent-row-rewrite report; return the known SQL postimage and keep independent copy/flip/cleanup checks.
- Identical authored approval bytes (#168094) reuse the existing parse; changed normalized bytes still parse before publication.
- Plugin metadata fingerprinting (353d778): no human in-place metadata-mutation report; distinct objects remain isolated, and same-object edits use TTL/reset.
- Duplicate asset ancestor search (7224585): no human cached-miss incident; canonical realpath/wrapper discovery remains, while newly appearing packages need owner invalidation/restart.
- Presence logical clock (#134737): provenance is synthetic rollback/suspend tests; clock correction may temporarily retain or hide display rows until full update/reconnect, wall time catches up, or restart. TTL, capacity and connection privacy remain.
- Suspension timer generation (#130003): the removed test directly called a canceled callback; native timer cancellation and current-entry authority remain. An out-of-contract timer implementation could resume a renewed lease early.
- OS tuple-keyed cache (#135911): keep measured probe sharing and sticky labels; hot-patching OS identity needs restart rather than another namespace.
- Presence list type guards (409a160): callers supply validated arrays; existing normalization still owns their values.

Production +40/-228, net -188. Focused migration, asset/cache, presence/caller,
approval-publication and suspension/OS tests pass, as do production and infra-test
types, changed-file lint, assertion and suppression checks, and zero-cycle checks.
Independent final review has no actionable P0-P2 findings. No schema, durability,
retention, indexing, permission, recovery or public SDK change is intended.

Broad changed-check is not claimed green: the original base reproduces the
455-versus-454 environment budget failure. The initial Web Push Doctor timeout
remains unattributed; all Web Push production hunks were dropped and its exact
test passed on restored source. Full build and hosted CI remain unrun.

* refactor(agents): simplify reply preparation and refresh bookkeeping

Share typed actor-store adapters and prepared async auth reads. Reuse the
admitted memory-flush plan, retain last-good catalog views by provider, and
remove unused metadata bookkeeping and config projections. Preserve live
credential/effect authority, FIFO, transcript durability, and ordinary write
settlement. Net production reduction: 303 lines.

Best-effort tradeoffs accepted:
- Plugin-drain successors (#162301, synthetic): wait the current drain once;
  a later reload owns its own publication and recovery.
- A changed memory-flush plan during preparation (#162177/#121157, synthetic):
  finish with the admitted plan; the next turn resolves again.
- Per-row catalog freshness (#158113, synthetic): failed discovery retains
  the provider's last-good configured and supplemental overlays until success.
  Existing auth/profile/source gates and successful-empty replacement remain.
- MCP sibling invalidation during discovery (#138694, synthetic): a listing
  may briefly be stale; the next read observes the invalidation.
- Passive context metadata supersession (#119607, synthetic): late discovered
  metadata may win until refresh. Keep the single current-promise check before
  replacing configured limits, preserving the human capacity fix (#39857).
- Registration-time question answers (#110372/#134003, synthetic): a prompt
  can briefly race the answer; its terminal signal closes delivery.
- Duplicate or never-attached internal question registrations: both real
  producers attach once synchronously. Unsupported misuse loses its extra
  diagnostic/disposal wakeup; ordinary lifecycle rejection remains.
- Cancellation publication once/must-consume flags (#161124, synthetic): the
  sole internal producer invokes once. Keep active-scope/effect authority.
- In-flight placement-service replacement (#164744, synthetic): use the
  captured startup service, with its observation and writer authority intact.
- Compaction callback rebinding (#146732/#163264, synthetic): current work
  retains its captured callbacks and live assertion; later work captures anew.
- Re-entrant logging between synchronous run-owner checks: #162227 removed
  the awaited retry, making the second check redundant. Real post-await and
  mutation-effect checks remain.
- Startup diagnostic admission (#146792): the sole producer checks lifecycle
  immediately before recording. Remove only the recorder's duplicate check;
  preserve the human abort/recovery fix (#146692), reset, and admin redaction.

Release-note context: verbose diagnostics no longer include suppressed reply
text or background bash command contents. Execution and user replies remain
unchanged. Config show uses the same schema-aware redactor without cloning
an already detached result or redacting unused snapshot views.

Validation: touched core, messaging and Gateway-method type graphs passed;
49 changed TypeScript files passed targeted lint/format; runtime and Madge
cycles are both zero. Auth reader, question authority, memory flush, restart
claim, catalog worker, cancellation and compaction boundary proof is recorded
in the lane ledger. Final supplemental run: 392 tests passed, four failed
across 28 files, with final source verification. All 120 agents-support tests
passed, including refresh coalescing, publication, run-wait and compaction.
The four failures were an unchanged 120s ACP reset deadline and three MCP
fixtures settling before child startup markers (empty logs, existing 1-2s
connection/4s catalog deadlines). Narrow failed-case replay passed ACP reset
and two MCP cases; the one-second MCP retirement fixture still failed before
its first child marker. Clean lane-base comparison could not reach assertions:
the temporary checkout lacked workspace-local dependency links for worker
compilation. That case is unresolved, not proven inherited; coordinator-bundle
CI must adjudicate it. No deadline, retry, skip or assertion was weakened.
The final selected real-dispatch suppressed-reply logging regression passed
with completed source verification (one selected case, 202.58s wrapper).

Independent P0-P2 review completed four passes. Declined duplicate findings
about unsupported placement-service hot-swap (real observation/database/writer
authority remains) and alleged run-wait awaits (only synchronous logging lies
between the checks; real mutation and post-await checks remain).

Broad check-changed is NOT green: env-name budget 455/454 also fails on the
unchanged lane-base index, with no added env names; production/full-tree Knip
hit their existing 600s budget; the silent legacy-store scan was interrupted
after 782s. Those two scans are missing proof, not attributed inherited reds.
Hosted coordinator-bundle CI remains the broad gate. Owned mock/type/legacy
fixture findings were corrected and their targeted replays pass.

No changelog, dependency, database schema, durability, retention, permission,
or public API change is included. BELOW-500 branch-only coordinator handoff;
no lane PR or merge.

* chore: shrink stale reply assertion allowance

* test: align catalog publication calls with current contract
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 15, 2026
…ply text (wave-4 bundle) (openclaw#172669)

* refactor(infra): remove redundant replay and freshness machinery

Trust successful migration statements inside their synchronous transactions,
reuse unchanged approval parses, share canonical package-root discovery,
namespace directory caches by plugin identity, and simplify ephemeral presence,
OS facts and suspension timer bookkeeping. Keep source validation, conflicts,
transaction durability, postcommit checks, security authority and write settlement.

Best-effort tradeoffs accepted

- Node-host own-write verification (openclaw#108457): no human successful-SQL-loss report; SQL errors still roll back, and independent source retirement checks remain.
- Workspace setup/attestation replay (openclaw#109147): no human driver-rewrite report; trust successful writes while retaining fingerprints and later source checks.
- APNs expected-ID replay (openclaw#108543): no human silent-insert-loss report; canonical parsing, tombstones and receipts remain.
- Device-auth presence assertion (openclaw#112663): no human successful-upsert-loss report; credential validation and transaction failure handling remain.
- Device-identity replay (openclaw#110392): no human silent-row-rewrite report; preserve independent post-await verification before source deletion.
- MCP OAuth replay (openclaw#161219): no human silent-write-loss report; canonical/source parsing and worker admission remain.
- Exec-approval read/parse/deep-compare replay (openclaw#114063): no human successful-driver-rewrite report; malformed policy stays fail-closed and actual authority is unchanged.
- Shared-auth target reread (openclaw#123349): no human silent-row-rewrite report; return the known SQL postimage and keep independent copy/flip/cleanup checks.
- Identical authored approval bytes (openclaw#168094) reuse the existing parse; changed normalized bytes still parse before publication.
- Plugin metadata fingerprinting (f31bc71): no human in-place metadata-mutation report; distinct objects remain isolated, and same-object edits use TTL/reset.
- Duplicate asset ancestor search (40fb74f): no human cached-miss incident; canonical realpath/wrapper discovery remains, while newly appearing packages need owner invalidation/restart.
- Presence logical clock (openclaw#134737): provenance is synthetic rollback/suspend tests; clock correction may temporarily retain or hide display rows until full update/reconnect, wall time catches up, or restart. TTL, capacity and connection privacy remain.
- Suspension timer generation (openclaw#130003): the removed test directly called a canceled callback; native timer cancellation and current-entry authority remain. An out-of-contract timer implementation could resume a renewed lease early.
- OS tuple-keyed cache (openclaw#135911): keep measured probe sharing and sticky labels; hot-patching OS identity needs restart rather than another namespace.
- Presence list type guards (3965f6b): callers supply validated arrays; existing normalization still owns their values.

Production +40/-228, net -188. Focused migration, asset/cache, presence/caller,
approval-publication and suspension/OS tests pass, as do production and infra-test
types, changed-file lint, assertion and suppression checks, and zero-cycle checks.
Independent final review has no actionable P0-P2 findings. No schema, durability,
retention, indexing, permission, recovery or public SDK change is intended.

Broad changed-check is not claimed green: the original base reproduces the
455-versus-454 environment budget failure. The initial Web Push Doctor timeout
remains unattributed; all Web Push production hunks were dropped and its exact
test passed on restored source. Full build and hosted CI remain unrun.

* refactor(agents): simplify reply preparation and refresh bookkeeping

Share typed actor-store adapters and prepared async auth reads. Reuse the
admitted memory-flush plan, retain last-good catalog views by provider, and
remove unused metadata bookkeeping and config projections. Preserve live
credential/effect authority, FIFO, transcript durability, and ordinary write
settlement. Net production reduction: 303 lines.

Best-effort tradeoffs accepted:
- Plugin-drain successors (openclaw#162301, synthetic): wait the current drain once;
  a later reload owns its own publication and recovery.
- A changed memory-flush plan during preparation (openclaw#162177/openclaw#121157, synthetic):
  finish with the admitted plan; the next turn resolves again.
- Per-row catalog freshness (openclaw#158113, synthetic): failed discovery retains
  the provider's last-good configured and supplemental overlays until success.
  Existing auth/profile/source gates and successful-empty replacement remain.
- MCP sibling invalidation during discovery (openclaw#138694, synthetic): a listing
  may briefly be stale; the next read observes the invalidation.
- Passive context metadata supersession (openclaw#119607, synthetic): late discovered
  metadata may win until refresh. Keep the single current-promise check before
  replacing configured limits, preserving the human capacity fix (openclaw#39857).
- Registration-time question answers (openclaw#110372/openclaw#134003, synthetic): a prompt
  can briefly race the answer; its terminal signal closes delivery.
- Duplicate or never-attached internal question registrations: both real
  producers attach once synchronously. Unsupported misuse loses its extra
  diagnostic/disposal wakeup; ordinary lifecycle rejection remains.
- Cancellation publication once/must-consume flags (openclaw#161124, synthetic): the
  sole internal producer invokes once. Keep active-scope/effect authority.
- In-flight placement-service replacement (openclaw#164744, synthetic): use the
  captured startup service, with its observation and writer authority intact.
- Compaction callback rebinding (openclaw#146732/openclaw#163264, synthetic): current work
  retains its captured callbacks and live assertion; later work captures anew.
- Re-entrant logging between synchronous run-owner checks: openclaw#162227 removed
  the awaited retry, making the second check redundant. Real post-await and
  mutation-effect checks remain.
- Startup diagnostic admission (openclaw#146792): the sole producer checks lifecycle
  immediately before recording. Remove only the recorder's duplicate check;
  preserve the human abort/recovery fix (openclaw#146692), reset, and admin redaction.

Release-note context: verbose diagnostics no longer include suppressed reply
text or background bash command contents. Execution and user replies remain
unchanged. Config show uses the same schema-aware redactor without cloning
an already detached result or redacting unused snapshot views.

Validation: touched core, messaging and Gateway-method type graphs passed;
49 changed TypeScript files passed targeted lint/format; runtime and Madge
cycles are both zero. Auth reader, question authority, memory flush, restart
claim, catalog worker, cancellation and compaction boundary proof is recorded
in the lane ledger. Final supplemental run: 392 tests passed, four failed
across 28 files, with final source verification. All 120 agents-support tests
passed, including refresh coalescing, publication, run-wait and compaction.
The four failures were an unchanged 120s ACP reset deadline and three MCP
fixtures settling before child startup markers (empty logs, existing 1-2s
connection/4s catalog deadlines). Narrow failed-case replay passed ACP reset
and two MCP cases; the one-second MCP retirement fixture still failed before
its first child marker. Clean lane-base comparison could not reach assertions:
the temporary checkout lacked workspace-local dependency links for worker
compilation. That case is unresolved, not proven inherited; coordinator-bundle
CI must adjudicate it. No deadline, retry, skip or assertion was weakened.
The final selected real-dispatch suppressed-reply logging regression passed
with completed source verification (one selected case, 202.58s wrapper).

Independent P0-P2 review completed four passes. Declined duplicate findings
about unsupported placement-service hot-swap (real observation/database/writer
authority remains) and alleged run-wait awaits (only synchronous logging lies
between the checks; real mutation and post-await checks remain).

Broad check-changed is NOT green: env-name budget 455/454 also fails on the
unchanged lane-base index, with no added env names; production/full-tree Knip
hit their existing 600s budget; the silent legacy-store scan was interrupted
after 782s. Those two scans are missing proof, not attributed inherited reds.
Hosted coordinator-bundle CI remains the broad gate. Owned mock/type/legacy
fixture findings were corrected and their targeted replays pass.

No changelog, dependency, database schema, durability, retention, permission,
or public API change is included. BELOW-500 branch-only coordinator handoff;
no lane PR or merge.

* chore: shrink stale reply assertion allowance

* test: align catalog publication calls with current contract
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts 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.

1 participant