Skip to content

fix(agents): replies fail after restart recovery posts progress - #174745

Merged
roboclaw-bot merged 3 commits into
mainfrom
openclaw/tender-crayfish
Oct 17, 2026
Merged

roboclaw-bot merged 3 commits into
mainfrom
openclaw/tender-crayfish

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes replies failing with “Session transcript keyed user is outside the current turn” when restart recovery encounters a progress update from the interrupted run.

User Impact

Users can continue interrupted work after a nonfinal progress reply without duplicating their input. Final replies, newer input, unrelated runs, transcript writer fences, and stale-turn protection remain barriers. No configuration or data migration is required; this does not rewrite already-failed transcripts.

Why This Change Was Made

Preserve explicit final: false at the message-tool producer, including recovered runs without channel-source context. The existing replay owner then recognizes only marked same-run progress as unfinished work. Progress stays visible in history but is excluded from model input. No new state store, replay owner, compatibility path, or exception to keyed-user ownership is introduced.

Worked on by

Work sessions

Evidence

  • Red baseline reproduced missing progress finality and failure to dispatch the original user; final, unmarked, and other-run negative controls already refused correctly.
  • 184 focused tests passed across message-tool delivery, ordinary message actions, and interrupted-turn replay (122.27s total runner wall time).
  • Core and affected agent-test typechecks, targeted lint/format, docs MDX, and diff checks passed.
  • Independent Codex P0–P2 reviews of the production change and added cold-process regression found no actionable findings.
  • Real isolated Gateway double cold restart passed: three distinct process IDs, one progress message, one final message, updated widget revision 2, durable/projected status done, no active run, and no keyed-user error. Test body: 18.97s; runner: 39.12s (including worker compilation). Synthetic local model responses exercised real tools, transcript persistence, SIGKILL/restart, and public Gateway APIs; the shared Team Gateway was not changed.
  • Initial E2E attempts exposed fixture defects, now corrected: inherited proxy settings intercepted loopback provider traffic, and socket readiness preceded recovery lifecycle admission. Explicit loopback routing and a produced-provider-request barrier fixed those failures without increasing timeouts or relaxing assertions.

The real-process test extends the existing widget-restart fixture rather than adding another Gateway composition. Its additional restart is necessary to prove that progress produced during source-less recovery survives a later process replacement; the focused replay tests cover the narrower acceptance/rejection contract. Exact-head CI passed: run 38973896475, attempt 1, including the required openclaw/ci-gate; the run completed in 10m11s. Independent ClawSweeper review of this head also reported no findings.


View the OpenClaw team session

roboclaw-bot and others added 3 commits October 16, 2026 21:53
Retain explicit nonfinal source-reply intent when a recovered internal run has no channel source turn. Replay may traverse only marked same-run progress mirrors, without reopening final, unmarked, or other-run replies.

Co-authored-by: steipete <[email protected]>
Worked on by:
- @steipete

Co-authored-by: steipete <[email protected]>
OpenClaw-Publication: dae702d6-2300-477a-ad12-580b48aba105
@clawsweeper

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

@roboclaw-bot
roboclaw-bot marked this pull request as ready for review October 16, 2026 22:08
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: S labels Oct 16, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR preserves explicit progress finality and lets restart recovery continue past same-run nonfinal message-tool replies.

Example: A recovered run sends “Widget recovery is still working.” with final:false, then the Gateway restarts again.

  • Before: Replay rejects the saved user input with “Session transcript keyed user is outside the current turn.”
  • After: Recovery retains the progress update, resumes the original input once, and produces the final reply.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch and exact-head CI support correctness; directly inspected runtime evidence is limited to regression source and the reported process-run result.
Proof confidence 🦐 gold shrimp (3/6) This collaborator-authored PR is outside the ordinary contributor proof gate; its body reports real Gateway double-restart success, and the inspected regression exercises tools, persistence, process replacement, and public APIs, but no raw runtime artifact was supplied.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Interrupted work fails to resume after restart recovery has posted a nonfinal progress reply.
Reason: The maintainer-authored repair restores the documented unfinished-turn contract without adding configuration, another owner, or broader completion semantics.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it fixes a current restart-recovery failure through the existing owners, and no actionable introduced defect was found.

Priority: P2
Reviewed head: 7bff3c983d21ccdc6a9825e31bc44056c9df76b7

Before merge

None.

Findings

None.

Agent review details

How this fits together

The message tool persists visible reply mirrors; the embedded runner uses transcript ancestry and current writer authority to decide whether an interrupted user turn can resume.

flowchart LR
  A[Accepted user turn] --> B[Embedded agent run]
  B --> C[Message tool progress]
  C --> D[Session transcript]
  D --> E[Restart replay owner]
  E --> F[Current writer validation]
  F --> B
Loading

Technical review

Best possible solution:

Preserve explicit progress at production and reuse the existing guarded replay owner without relaxing final-reply or current-writer boundaries.

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

Current-main source exposes both missing finality propagation and replay rejection; the PR reports a failing baseline and a passing double-restart regression, but no target code was executed during this review.

Is this the best way to solve the issue?

The repair addresses the producer omission and the existing replay policy directly, while preserving conservative handling of completed, unmarked, unrelated, and superseded turns.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 38314adc3a4d.

Provenance checked

  • Interrupted-turn replay policy keeps the original intent (24f9297: Allow unfinished same-run tool activity while rejecting completed replies, newer users, and lost ownership.)
  • Source-less message-tool finality changes intended behavior with a stated reason (unknown: The existing guard restricts terminal reconciliation to an admitted source turn; supplied blame identifies a later refactor, while git log --follow encountered unavailable older content and did not establish the guard's introduction.)
  • Cold-process widget recovery regression keeps the original intent (13c1d87: Prove recovery and durable completion after process replacement without reconnecting an inline-widget client.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 5a53688 adds src/agents/embedded-agent-runner/run/pre-persisted-user-turn.ts:43 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5a53688e4685; files: src/agents/embedded-agent-runner/run/pre-persisted-user-turn.ts)

PR surface

Source +11, Tests +125, Docs +3. Total +139 across 7 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 13 2 +11
Tests 4 129 4 +125
Docs 1 3 0 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 145 6 +139

Review metrics

Metric Value Why it matters
Production versus test changes Production +13/-2; tests and fixtures +129/-4 The small production repair is supported by distinct persisted-marker, replay-boundary, and cold-process recovery coverage.

Labels

Label changes:

  • add P2: A bounded restart-recovery defect prevents an interrupted agent turn from completing after progress was saved.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: A bounded restart-recovery defect prevents an interrupted agent turn from completing after progress was saved.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 16, 2026, 6:24 PM ET / 22:24 UTC.

@roboclaw-bot
roboclaw-bot merged commit 50e8b86 into main Oct 17, 2026
230 of 231 checks passed
@roboclaw-bot
roboclaw-bot deleted the openclaw/tender-crayfish branch October 17, 2026 01:10
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…claw#174745)

* fix(agents): preserve progress replies across restart replay

Retain explicit nonfinal source-reply intent when a recovered internal run has no channel source turn. Replay may traverse only marked same-run progress mirrors, without reopening final, unmarked, or other-run replies.

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

* test(gateway): prove progress survives repeated cold restart

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

* fix(agents): replies fail after restart recovery posts progress

Worked on by:
- @steipete

Co-authored-by: steipete <[email protected]>
OpenClaw-Publication: dae702d6-2300-477a-ad12-580b48aba105

---------

Co-authored-by: steipete <[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 docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S 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