Skip to content

fix(agents): retain completed results in detached recovery replies - #150300

Closed
roboclaw-bot wants to merge 1 commit into
mainfrom
fix/detached-finalization-live-broker
Closed

roboclaw-bot wants to merge 1 commit into
mainfrom
fix/detached-finalization-live-broker

Conversation

@roboclaw-bot

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

Copy link
Copy Markdown
Collaborator

Related: #142168

What Problem This Solves

Fixes an issue where users running a detached task could lose the results of completed actions when the task needed a final recovery answer. The actions had already finished, but the final answer was prepared from an empty conversation instead of the task's existing transcript.

Why This Change Was Made

Restricted finalization now retains the original session manager and detached persistence mode while preserving its tool-free, capability-restricted contract. The live test pool also runs on process main threads, as required by the shared-state broker, with a credential-free regression exercising the actual plugin-state range read.

User Impact

Recovery answers can use completed task results without repeating those actions. No model, thinking, authentication, tool-permission, or persistence-policy defaults change.

Evidence

  • Focused finalization unit and sibling coverage: 37 tests passed on this branch.
  • Credential-free live-pool broker regression: passed on this branch. The unmodified pool reproduces the exact host-broker admission refusal.
  • Retained deterministic before/after replay for the patch-identical finalizer owner: the original finalization request loses a committed receipt; the fixed request retains it. The fixture executes the receipt action once and never repeats the unfinished write.
  • Production types, selected test types, targeted lint, formatting, and fresh independent P0 review passed before publication.
  • Exact-head CI run 35150485516/1 is blocked in checks-fast-baseline-ratchets during dependency installation: @matrix-org/[email protected] receives HTTP 403 downloading its native asset, then its postinstall throws ReferenceError: err is not defined. The ratchet commands never started. Dependency manifests, lockfile, and the install action are unchanged by this PR. Failed job. CI is not claimed green.

No live-provider requests or package build were run for this focused fix. Diagnostic response fixtures and private logs are not committed. This PR does not qualify or alter a release candidate.

CI recovery and remaining blockers — September 16

The original attempt-1 Matrix download failure is retained above. After verifying a successful same-asset download in another Ubuntu job from that attempt and a direct public download matching the published SHA-256, one job-specific recovery was requested on this unchanged head. Attempt-2 ratchet job 105001771544 executed the normal postinstall download and the ratchet commands successfully. No dependency/Node pins, postinstall behavior, or source code changed. Only that job and its dependent CI gate executed again; other attempt-2 records retain earlier execution times.

The overall run remains failed because four earlier test-shard failures are retained. No additional retry is being requested here.

The late review finding is also independently confirmed: an actual detached finalization retained its receipt but persisted one internal recovery instruction as a user turn. The original manager's already-installed guard ignores the newly requested one-shot suppression. No production fix has been applied in this CI recovery, and this PR remains blocked pending the guard-owner repair and remaining CI resolution. The diagnostic fixtures and logs are not committed.

Keep the original session manager and detached persistence when a tool-free
finalizer prepares the recovery answer. Exercise the required process-main-
thread broker contract in the live test pool without changing admission.

Co-authored-by: steipete <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
@clawsweeper

clawsweeper Bot commented Sep 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.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS maintainer Maintainer-authored PR labels Sep 16, 2026
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review September 16, 2026 21:06
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 5, 2026, 11:56 PM ET / October 6, 2026, 03:56 UTC (Revision 4).

ClawSweeper review

What this changes

The PR preserves detached task transcripts during tool-free recovery answers and runs live tests in forked processes with a credential-free shared-state regression.

Regression provenance

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

Merge readiness

⛔ Blocked before merge - 4 items remain

The production fix is superseded by merged work on main, but the protected maintainer label requires human cleanup. The unchanged PR head still contains the previously reported suppression defect; its credential-free broker regression remains unique.

Priority: P2
Reviewed head: f78bbaac7ae1ef0b192a350c16ce2769abae99ab
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful focused work remains, but the pinned implementation retains a confirmed transcript defect already repaired on main.
Proof confidence 🌊 off-meta tidepool Not applicable: The bot-authored PR is exempt from ordinary contributor proof. Its body reports receipt retention through actual detached finalization and independently confirms the suppression defect. No stored-data format, schema, or migration contract changes.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The bot-authored PR is exempt from ordinary contributor proof. Its body reports receipt retention through actual detached finalization and independently confirms the suppression defect. No stored-data format, schema, or migration contract changes.
Evidence reviewed 9 items Pinned introduced change: The merge-base-to-head delta forwards the session manager and persistence mode, extends the forwarding test, adds a credential-free broker regression, and selects the fork pool. Base-branch drift was excluded from PR ownership.
Previous blocker remains on the pinned head: Attempt preparation reuses the forwarded manager and requests suppression, but the head's guard reuse branch updates run context without refreshing suppression. The captured PR body independently confirms an internal recovery instruction was retained and states that no repair was applied.
Merged production replacement: GitHub verifies #161091 merged on September 30. Its recorded commit describes preserving detached history and refreshing one-shot suppression. Current main forwards both fields, refreshes suppression in the guard owner, and includes a runner regression covering empty-answer retries and the next genuine user turn.
Findings 1 actionable finding [P2] Re-arm user-message suppression on the reused session manager
Security None None.

How this fits together

OpenClaw’s built-in agent runtime prepares recovery answers after completed tool work fails to produce a final reply. Its session manager supplies the completed results, while transcript guards prevent internal recovery instructions from becoming retained user messages.

flowchart TD
  A[Detached task] --> B[Completed tool results]
  B --> C[Session transcript]
  C --> D[Tool-free recovery]
  D --> E[Transcript guard]
  E --> F[Final answer]
  E --> G[Retained conversation]
Loading

Decision needed

Question Recommendation
Should this protected PR be retired after the merged replacements, or retained solely to carry its credential-free broker regression? Retire the superseded branch: Close this PR explicitly and consider the broker regression separately without reopening the completed production repair.

Why: Automatic closure is prohibited by the maintainer label, and the branch still contains a useful test absent from main.

Before merge

  • Re-arm user-message suppression on the reused session manager (P2) - Forwarding the ordinary attempt’s manager reaches the existing-guard branch of guardSessionManager(), which ignores the new suppression request. The internal finalization prompt is therefore retained as a user turn, including on empty-answer retries. This previously reported late finding remains on the identical reviewed head and is independently confirmed in the PR body. Current main fixes it through fix(agents): detached runs keep their transcript when a settled turn is finalized #161091; retain that owner repair if this branch is continued.
  • Resolve merge risk (P1) - The current head has merge conflicts and no verified test-merge result; retaining it requires reconciliation with the already-merged production and pool repairs.
  • Complete next step (P2) - Choose whether to retire this protected PR or retain only its unique broker regression; a retained branch must be reconciled with current main.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

  • [P2] Re-arm user-message suppression on the reused session manager — src/agents/harness/builtin-openclaw.ts:32-33
Agent review details

Security

None.

PR surface

Source +2, Tests +42. Total +44 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 2 0 +2
Tests 3 42 0 +42
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 44 0 +44

Review metrics

None.

Root-cause cluster

Relationship: partial_overlap
Canonical: #161091
Summary: The merged canonical PR supersedes the production repair, while a separate merged PR covers pool selection and this branch retains unique broker coverage.

Members:

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

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep main’s complete transcript and suppression repair; preserve the unique broker regression only if its additional coverage warrants a narrow follow-up.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep main’s complete transcript and suppression repair; preserve the unique broker regression only if its additional coverage warrants a narrow follow-up.

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

Yes, for the pinned PR head: an ordinary detached attempt installs the guard, then finalization reuses it without re-arming suppression. The PR body confirms the resulting retained internal prompt; current main repairs this path, and no tests were executed during this read-only review.

Is this the best way to solve the issue?

No, the branch is incomplete by itself and its production change is already covered by main’s broader owner-level repair. Only the distinct broker regression warrants a separate retention decision.

Full review comments:

  • [P2] Re-arm user-message suppression on the reused session manager — src/agents/harness/builtin-openclaw.ts:32-33
    Forwarding the ordinary attempt’s manager reaches the existing-guard branch of guardSessionManager(), which ignores the new suppression request. The internal finalization prompt is therefore retained as a user turn, including on empty-answer retries. This previously reported late finding remains on the identical reviewed head and is independently confirmed in the PR body. Current main fixes it through fix(agents): detached runs keep their transcript when a settled turn is finalized #161091; retain that owner repair if this branch is continued.
    Confidence: 0.99
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 4308a8fb8d92; fix evidence: commit 8f924bff5d68, main fix timestamp 2026-09-30T09:54:19Z.

Labels

Label changes:

  • remove merge-risk: 🚨 session-state: Current PR review selected no merge-risk labels.

Label justifications:

  • P2: This is bounded agent-recovery work whose production repair is already on main, leaving protected branch disposition and test coverage.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The bot-authored PR is exempt from ordinary contributor proof. Its body reports receipt retention through actual detached finalization and independently confirms the suppression defect. No stored-data format, schema, or migration contract changes.

Evidence

What I checked:

  • Pinned introduced change: The merge-base-to-head delta forwards the session manager and persistence mode, extends the forwarding test, adds a credential-free broker regression, and selects the fork pool. Base-branch drift was excluded from PR ownership. (src/agents/harness/builtin-openclaw.ts:32, f78bbaac7ae1)
  • Previous blocker remains on the pinned head: Attempt preparation reuses the forwarded manager and requests suppression, but the head's guard reuse branch updates run context without refreshing suppression. The captured PR body independently confirms an internal recovery instruction was retained and states that no repair was applied. (src/agents/session-tool-result-guard-wrapper.ts:119, f78bbaac7ae1)
  • Merged production replacement: GitHub verifies fix(agents): detached runs keep their transcript when a settled turn is finalized #161091 merged on September 30. Its recorded commit describes preserving detached history and refreshing one-shot suppression. Current main forwards both fields, refreshes suppression in the guard owner, and includes a runner regression covering empty-answer retries and the next genuine user turn. (src/agents/harness/builtin-openclaw.ts:60, 8f924bff5d68)
  • Current-main implementation: The fully inspected current-main guard passes suppression through its reuse branch and invokes the underlying guard's suppression setter. This addresses the historical head defect; no pinned test merge was available to assess a merged result. (src/agents/session-tool-result-guard-wrapper.ts:131, 4308a8fb8d92)
  • Fix timestamp and release check: The production replacement commit is dated 2026-09-30T09:54:19Z and is an ancestor of fetched main. The release containment check listed publication markers, not a versioned release; the commit is not an ancestor of the supplied v2026.9.8 release SHA. A shipped release containing this exact fix was not established. (8f924bff5d68)
  • Live-pool replacement and unique remainder: GitHub verifies fix(test): live Gateway validation loses shared state #150873 merged the same fork-pool selection. Current main retains it, but its tree does not contain test/live-state-broker.live.test.ts. That test exercises a real shared-state range read rather than merely inspecting configuration. (test/vitest/vitest.live.config.ts:28, 493ad2f4f304)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Dallin Romney: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • LiuwqGit: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • If retaining the branch, preserve main’s suppression repair and verify receipt retention, repeated finalization, and subsequent genuine user persistence.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-09-16T21:12:43.075Z sha f78bbaa :: needs maintainer review before merge. :: none
  • reviewed 2026-09-16T21:27:59.643Z sha f78bbaa :: blocked before merge. :: [P2] Re-arm user-message suppression on the reused session manager
  • reviewed 2026-09-16T23:11:55.214Z sha f78bbaa :: blocked before merge. :: [P2] Re-arm user-message suppression on the reused session manager

@clawsweeper clawsweeper Bot added merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 16, 2026
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. label Oct 6, 2026
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Closing as superseded.

Superseded by #161091 (session manager and detached persistence in recovery finalization) and #150873 (the required forked live-test pool). The additional deterministic broker smoke test is distinct coverage, not an outstanding implementation repair.

This closes the PR without deleting its branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant