Repository navigation
feat: resume requesters after deferred sessions_send replies - #112388
rabsef-bicrym wants to merge 1 commit into
Conversation
4c61757 to
f4a689f
Compare
9bc1916 to
5aea705
Compare
|
Codex review: needs real behavior proof before merge. Reviewed August 24, 2026, 8:07 PM ET / August 25, 2026, 00:07 UTC (Revision 8). ClawSweeper reviewWhat this changesThe branch adds an opt-in Merge readiness⛔ Blocked before merge - 14 items remain This feature is still absent from current main, so the PR remains necessary, but it is not merge-ready: three prior durability/context blockers remain on the unchanged head, and current main has moved the Gateway execution owners that this draft modifies. Priority: P2 Review scores
Verification
How this fits together
flowchart LR
A[Requester session] --> B[sessions_send request]
B --> C[Deferred completion record]
B --> D[Target agent run]
D --> E[Terminal outcome]
E --> F[Gateway continuation]
F --> G[Exact requester route]
Decision needed
Why: This is a new public tool mode with durable state and cross-session delivery authority; VISION.md gives such core additions a high bar, so correctness fixes alone cannot choose the product direction. Before merge
Findings
Agent review detailsSecurityNeeds attention: No route-fallback bypass was found, but this persisted delivery authority needs final-effect rejection proof before merge. PR surfaceSource +959, Tests +781, Docs +3, Generated +19. Total +1762 across 19 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: If maintainers sponsor this core contract, reimplement it on current agent-turn ownership with bounded payload storage, lifecycle-owned expiry, original-run recovery correlation, and an end-to-end Gateway delivery proof. Do we have a high-confidence way to reproduce the issue? Yes, from source: oversized request/result text reaches an unbounded continuation prompt, and restart/expiry paths are directly traceable without executing the external branch. Is this the best way to solve the issue? No: the intended behavior needs product sponsorship and a reimplementation on current agent-turn ownership rather than changes to replaced Gateway server-method files. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 058a72fe6601. LabelsLabel justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
- Add opt-in one-shot requester continuation for deferred sessions_send runs - Bind continuation delivery to the captured requester session incarnation and ingress route - Persist terminal outcomes and recover accepted continuations across gateway restarts - Cover failure, replay, expiry, account isolation, and restart behavior
5aea705 to
16ccee3
Compare
|
Compared with merged #160018, this PR has a different scope: opt-in |
|
Best-effort implementation is complete; the tested candidate is ready for the branch owner to apply. This supersedes my earlier persistence/recovery proposal. What Problem This SolvesAn inter-session sender can request a reply without blocking its current turn. With User ImpactNo ping-pong or extra target-channel announcement for this opted-in path. The requester session incarnation and captured return route stay pinned. Omitting the option preserves existing behavior, and existing native-task/ACP completion ownership is retained without a second wake. This is deliberately best effort: no new storage, retention policy, restart replay, or “result unavailable after restart” mechanism. Empty results do not wake the requester; a Gateway restart may lose a pending wake. Unsupported combinations are rejected before dispatch. Candidate and HandoffReviewed candidate The original contributor's commit/history is retained: current PR head A writer of git fetch https://github.com/pavonis-martian/openclaw.git pr-112388-best-effort
git push https://github.com/rabsef-bicrym/moltbot.git a5471921031d341618c8f0f9dc3a616fc168bd7f:refs/heads/codex/sessions-send-deferred-originEvidence
Related: #112372 (deliberately narrower than durable delivery), #148296 (eventual-reply behavior). |
|
This pull request has been automatically marked as stale due to inactivity. |
|
Thanks for the PR. We're closing older pull requests that have gone stale against current This large draft has had no commits since early August and is still blocked on durability and proof items. Thanks for the design work; if wake-on-reply for sessions_send is still wanted, please open a fresh, smaller PR against current main. |
Closes #112372
What Problem This Solves
Adds opt-in
wakeOnReply: truebehavior tosessions_send. The tool returns after target dispatch, then resumes the exact requesting session incarnation and captured ingress route when that target run succeeds or fails.Why
An agent can currently delegate work and return from the tool call, but it cannot durably express “my user is waiting for this particular result.” Legacy A2A announce behavior is not correlated to one target run or pinned to the exact requester route, so the user may not hear the result until another inbound turn wakes the requester.
Changes
wakeOnReplytool contractSafety And Recovery
The model cannot provide a return destination. OpenClaw captures the requester session ID and normalized
DeliveryContextfrom trusted runtime state. Registration fails if the external origin does not contain an explicitchannel,to, andaccountId; continuation dispatch therefore cannot substitute a provider-default account.The target terminal payload is written while the registration remains
pending, before the target is allowed to settle. After settlement, dispatch changes the row todispatching. Gateway acceptance does not complete that row. The row is retired only after the continuation's user turn is durably written to the exact requester transcript.Gateway startup reconciles both prepared
pendingrows and interrupteddispatchingrows. If the exact requester session incarnation owns the continuation run ID and its transcript contains that run's user turn, deferred recovery retires its row without another gateway call and leaves the existing main-session recovery system as the sole post-restart continuation owner. If no transcript turn exists, deferred recovery replays the dispatch with the same continuation ID. Durable-ownership inspection failure suppresses dispatch and leaves the row available for a later recovery attempt.Persistence failure before target settlement prevents settlement. Ambiguous continuation dispatch failure remains durable and restart-replayable. Completed, expired, explicitly cancelled, or mismatched state produces no new continuation. Required delivery and
expectedExistingSessionIdprevent route or incarnation fallback.This is not a general durable outbound outbox. It provides durable target-result correlation and coordinates accepted continuation ownership with OpenClaw's existing main-session restart recovery for this opt-in
sessions_sendpath.Evidence
Current head
16ccee3e2f2b, rebased ontoopenclaw/mainat9faf34d3bcb:pnpm test src/agents/sessions-send-deferred.test.ts src/agents/tools/sessions.test.ts src/gateway/server-startup-post-attach.test.tspnpm tsgo:corepnpm format:check <changed files>andnode scripts/run-oxlint.mjs <changed files>node scripts/generate-kysely-types.mjs --verifyandgit diff --checkThe previous head also passed
check:changed, the build, the full test type graph, and 363 focused agent/gateway tests. Those broader results predate the current-main rebase; current CI is the broad validation source for this head.Regression coverage includes:
Not yet run: a live two-agent channel round trip using
wakeOnReply. This remains a draft for external design review before live proof.Redacted AI-assisted decision transcript
This PR is AI-assisted. The author reviewed the implementation and validation and can explain the code.
User need: “We do not want to destroy wake in the channel you asked. We want a setting for ‘my user is expecting me to come back with an answer.’”
Agreed contract: make the behavior opt-in on
sessions_send; return after the target run is accepted; do not expose the target result to the initiating turn; resume the exact requester session incarnation and ingress route on target success or terminal failure; suppress legacy A2A ping-pong/announce only for that call; never use a fallback destination.Review corrections: persist the completion payload before target settlement; reconcile both prepared and interrupted dispatches after restart; reject external origins without a canonical account so ordinary delivery cannot choose a provider default; and keep an accepted dispatch durable until transcript persistence transfers restart ownership to the existing main-session recovery system.
The optional
autoreviewskill was not run. Direct diff review and the repository gates listed above were run instead.Review Focus