Skip to content

fix(update): record why the managed-service handoff was refused - #149202

Merged
steipete merged 2 commits into
mainfrom
upd/handoff-refusal-facts-149161
Sep 15, 2026
Merged

steipete merged 2 commits into
mainfrom
upd/handoff-refusal-facts-149161

Conversation

@steipete

@steipete steipete commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Gateway-managed update failures could leave only managed-service-handoff-failed and Failed phase requested: exit unknown, hiding the refusal the Gateway observed.

Refs #149161, #144052, #142942.

User Impact

New handoff start and ownership-transfer failures retain their cause in the run ledger and RPC result. Status, chat, and reviewed failure reports consume the same recorded facts. The CLI's missing-updater report preserves its openclaw doctor guidance.

This improves diagnostics once the updated Gateway is running. It cannot reconstruct old reports or fix the underlying service failure. Configuration, schemas, retention, and immutable terminal history are unchanged.

Why This Change Was Made

The Gateway preserves typed refusal reasons and failure facts, normalizes plain errors into the existing fact format, and records them before cancelling a started helper. Cancellation still settles before the RPC returns and runs even if recording throws. The existing helper settlement owner preserves that recorded refusal instead of replacing it with a generic skipped cancellation.

Public redaction recognizes fixed handoff messages and closed helper-exit/timeout phrases; arbitrary suffixes remain private. Status projects the recorded cause alongside the existing outcome.

Reported by @Leoin1 (#149161), @373246784-design (#144052), and @flyintothesky (#142942). The last report concerns target-metadata-preflight, so it is related diagnostic context rather than a verified handoff failure.

Evidence

The original repair had eight failing-before Gateway regressions, failing-before CLI/public-report regressions, and 330 passing tests across 11 relevant suites. Its exact-head CI run 34988109580 passed.

The cancellation fixup adds two independent boundaries:

  • All three Gateway cancellation cases failed before the fix because the refusal was not recorded before helper settlement; all now pass.
  • The real generated helper with SQLite failed before the fix: failed / managed-service-handoff-failed became skipped / managed-service-handoff-cancelled, even with recorded facts. It now preserves the failure and leaves the serving process untouched.

node scripts/run-vitest.mjs src/gateway/server-methods/update-handoff-failure.test.ts src/gateway/server-methods/update.test.ts src/infra/update-managed-service-handoff-lifecycle.test.ts passed all 59 Gateway tests and 180 of 181 helper tests. The full run had one native-stop timing failure in joins a timed-out native request before releasing its source interval; that isolated case passed on both the exact pre-fix head and the repaired source. No timeout or assertion was weakened.

The final focused command passed all five selected cases:

node scripts/run-vitest.mjs src/gateway/server-methods/update-handoff-failure.test.ts src/infra/update-managed-service-handoff-lifecycle.test.ts -t 'preserves the Gateway refusal|cancels managed admission|joins a timed-out native request'

node scripts/check-changed.mjs passed for all seven fixup files, including production/test typechecking, lint, formatting, and repository guards. git diff --check passed.

Independent review of the original repair is scoped-clean through P1; the final cancellation fixup is scoped-clean through P2. Exact-head CI run 35007916027 completed successfully for 66298b1df035fd93c777727bf563bd75ede69f41, including openclaw/ci-gate. Both patches are unchanged by range-diff after rebasing onto current main with the fixture repairs.

Tests use isolated state and synthetic service-manager fixtures. No live Gateway was restarted and no published-driver/candidate upgrade cell was run. The refusal boundary precedes updater execution and requires the repaired Gateway/helper to be installed; this is not an end-to-end upgrade claim.

ClawSweeper review

Applied the P2 cancellation-settlement finding with Gateway ordering and real helper/SQLite regression proof. The requested data-model migration proof does not apply: redaction changes neither the schema nor stored-data compatibility. The published-driver/candidate request remains an explicit proof limitation above; the focused evidence covers refusal before an updater starts.

@clawsweeper

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

@steipete
steipete marked this pull request as ready for review September 15, 2026 15:23
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime cli CLI command changes commands Command implementations size: L maintainer Maintainer-authored PR labels Sep 15, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 15, 2026, 2:46 PM ET / 18:46 UTC (Revision 5).

ClawSweeper review

What this changes

Records managed-update handoff refusals so status, chat notices, and redacted failure reports retain the observed cause, including missing-updater recovery guidance.

Merge readiness

⛔ Blocked before merge - 3 items remain

This remains a useful diagnostic fix absent from current main and the latest release. The earlier cancellation-settlement defect is addressed, and no new blocking code defect was found.

Priority: P2
Reviewed head: 66298b1df035fd93c777727bf563bd75ede69f41

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful regression coverage and no remaining blocking code finding; upgrade qualification remains a separate landing requirement.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary external-contributor proof gate does not apply to this MEMBER-authored PR. Reported generated-helper/SQLite execution supports refusal settlement; Gateway and CLI cases use fixtures, and the separately required published-driver qualification remains unperformed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary external-contributor proof gate does not apply to this MEMBER-authored PR. Reported generated-helper/SQLite execution supports refusal settlement; Gateway and CLI cases use fixtures, and the separately required published-driver qualification remains unperformed.
Evidence reviewed 9 items Current main still loses the refusal: The fetched main handler logs the handoff exception but returns only the generic managed-service-handoff-failed result; its admission module has no refusal-recording helper.
Latest-release comparison: The v2026.9.4 source likewise reduces a handoff-start exception to the generic refusal result. This diagnostic repair is not established as shipped.
Earlier cancellation finding addressed: The introduced patch records the refusal before awaiting cancellation, retains cancellation in finally, and makes the existing helper settlement preserve a recorded failed requested step.
Findings None None.
Security None None.

How this fits together

The Gateway hands managed updates to a separate helper while the existing Gateway keeps serving. Its update ledger supplies outcomes to status, chat notifications, and public failure reports.

flowchart TD
  A[Update request] --> B[Gateway handoff admission]
  B --> C[Managed update helper]
  B --> D[Recorded refusal facts]
  C --> E[Cancellation settlement]
  D --> E
  E --> F[Update ledger]
  F --> G[Status and chat notices]
  F --> H[Redacted failure report]
Loading

Before merge

  • Resolve merge risk (P1) - Published-driver × candidate qualification remains unperformed; the focused helper/SQLite evidence does not establish the upgrade path.
  • Complete next step (P2) - Record the published-driver × candidate upgrade qualification required by root AGENTS.md before landing.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +58, Tests +267, Docs +7. Total +332 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 5 77 19 +58
Tests 7 387 120 +267
Docs 1 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 13 471 139 +332

Review metrics

Metric Value Why it matters
Production versus regression coverage Production net +58 lines; tests and support net +267 lines Production growth preserves diagnostics through existing owners, with coverage for cancellation ordering, helper settlement, and public redaction.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/logging/diagnostic-support-redaction.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep refusal diagnostics with the existing ledger and helper settlement owners, preserving the serving Gateway and public redaction, and qualify the published-driver upgrade boundary.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep refusal diagnostics with the existing ledger and helper settlement owners, preserving the serving Gateway and public redaction, and qualify the published-driver upgrade boundary.

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

Yes, for diagnostic loss: current main's handoff exception path discards the observed cause from its result. The original users' service failures were not reproduced.

Is this the best way to solve the issue?

Yes: recording normalized facts at the refusal boundary and preserving them through existing settlement is a focused repair; no new data model or parallel recovery mechanism is needed.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This repairs limited-scope update diagnostic loss without claiming to fix the underlying service failures.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary external-contributor proof gate does not apply to this MEMBER-authored PR. Reported generated-helper/SQLite execution supports refusal settlement; Gateway and CLI cases use fixtures, and the separately required published-driver qualification remains unperformed.

Evidence

What I checked:

  • Current main still loses the refusal: The fetched main handler logs the handoff exception but returns only the generic managed-service-handoff-failed result; its admission module has no refusal-recording helper. (src/gateway/server-methods/update.ts:475, e7dde047904e)
  • Latest-release comparison: The v2026.9.4 source likewise reduces a handoff-start exception to the generic refusal result. This diagnostic repair is not established as shipped. (src/gateway/server-methods/update.ts:474, 3a9d69db306c)
  • Earlier cancellation finding addressed: The introduced patch records the refusal before awaiting cancellation, retains cancellation in finally, and makes the existing helper settlement preserve a recorded failed requested step. (src/gateway/server-methods/update.ts:656, 66298b1df035)
  • Boundary evidence and its limits: The captured PR body reports failing-before/passing-after Gateway ordering and generated-helper/SQLite regressions. Source inspection confirms the helper scenario starts the generated process, records a refusal, closes its unarmed input, and checks retained failure facts with no service commands or parent signal. Service-manager fixtures are synthetic; no published-driver/candidate qualification is claimed. Tests were not executed during this read-only review. (src/infra/update-managed-service-handoff-lifecycle.test.ts:536, 66298b1df035)
  • Public diagnostic boundary: Public reports retain only exact recognized handoff messages or fixed extracted phrases; arbitrary suffixes remain redacted. The new facts use the existing bounded normalization and ledger contracts, without changing schemas, retention, or authorization. (src/logging/diagnostic-support-redaction.ts:471, 66298b1df035)
  • Applicable upgrade qualification: Root policy requires a published-driver × candidate cell for update changes. The captured PR body explicitly says this was not performed; the previous review's qualification request therefore remains unresolved. The earlier data-model migration concern does not apply to this diff. (AGENTS.md:69, 66298b1df035)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rank-up moves

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

  • Record the published-driver × candidate qualification required by the repository's update policy.

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 (4 earlier review cycles)
  • reviewed 2026-09-15T15:30:54.254Z sha 1fb4ac6 :: blocked before merge. :: [P2] Preserve refusal facts through helper cancellation settlement
  • reviewed 2026-09-15T17:01:01.317Z sha e1f6e51 :: blocked before merge. :: none
  • reviewed 2026-09-15T17:12:23.179Z sha e1f6e51 :: blocked before merge. :: none
  • reviewed 2026-09-15T18:22:45.206Z sha 99dd42811cebc15d2adfce882addbb3771315fd1 :: blocked before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

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

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 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. labels Sep 15, 2026
@steipete
steipete force-pushed the upd/handoff-refusal-facts-149161 branch from e1f6e51 to 99dd428 Compare September 15, 2026 18:12
Record the refusal before cancelling a started helper, and let its existing settlement owner preserve that reason and its failure facts. Keep cancellation in finally and preserve immutable terminal history. Refs #149161.
@steipete
steipete force-pushed the upd/handoff-refusal-facts-149161 branch from 99dd428 to 66298b1 Compare September 15, 2026 18:30
@steipete
steipete merged commit 189db40 into main Sep 15, 2026
195 checks passed
@steipete
steipete deleted the upd/handoff-refusal-facts-149161 branch September 15, 2026 19:57
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 16, 2026
…claw#149202)

* fix(update): record why the managed-service handoff was refused

* fix(update): preserve refusal through helper cancellation

Record the refusal before cancelling a started helper, and let its existing settlement owner preserve that reason and its failure facts. Keep cancellation in finally and preserve immutable terminal history. Refs openclaw#149161.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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